Browse Source

Merge pull request #44044 from izeye

* pr/44044:
  Use consistent exception messages in Assert calls

Closes gh-44044
pull/44051/head
Moritz Halbritter 1 year ago
parent
commit
0c166c1126
  1. 2
      spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/data/mongo/MongoHealthIndicator.java
  2. 2
      spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/jmx/JmxEndpointExporter.java
  3. 4
      spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/error/DefaultErrorViewResolver.java
  4. 2
      spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/quartz/QuartzAutoConfigurationTests.java
  5. 2
      spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/session/SessionAutoConfigurationEarlyInitializationIntegrationTests.java
  6. 4
      spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/error/DefaultErrorViewResolverTests.java
  7. 2
      spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/remote/server/HttpStatusHandler.java
  8. 2
      spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/server/HttpStatusHandlerTests.java
  9. 2
      spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/SpringBootMockResolver.java
  10. 4
      spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/BuildpackCoordinates.java
  11. 2
      spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/configuration/DockerConfiguration.java
  12. 4
      spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/build/BuildpackCoordinatesTests.java
  13. 2
      spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Layer.java
  14. 8
      spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Packager.java
  15. 2
      spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/layer/ApplicationContentFilter.java
  16. 6
      spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/layer/CustomLayers.java
  17. 4
      spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/layer/IncludeExcludeContentSelector.java
  18. 2
      spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/layer/LibraryContentFilter.java
  19. 2
      spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/AbstractPackagerTests.java
  20. 4
      spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/LayerTests.java
  21. 4
      spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/layer/ApplicationContentFilterTests.java
  22. 4
      spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/layer/IncludeExcludeContentSelectorTests.java
  23. 4
      spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/layer/LibraryContentFilterTests.java
  24. 2
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/BootstrapRegistry.java
  25. 6
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java
  26. 2
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/GraylogExtendedLogFormatStructuredLogFormatter.java
  27. 2
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/GraylogExtendedLogFormatStructuredLogFormatter.java
  28. 4
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ssl/SslManagerBundle.java
  29. 8
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/task/SimpleAsyncTaskSchedulerBuilder.java
  30. 2
      spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/ValueObjectBinderTests.java
  31. 2
      spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/ConfigurationPropertyNameTests.java
  32. 2
      spring-boot-project/spring-boot/src/test/java/org/springframework/boot/origin/MockOrigin.java
  33. 8
      spring-boot-project/spring-boot/src/test/java/org/springframework/boot/task/SimpleAsyncTaskSchedulerBuilderTests.java

2
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/data/mongo/MongoHealthIndicator.java

@ -37,7 +37,7 @@ public class MongoHealthIndicator extends AbstractHealthIndicator { @@ -37,7 +37,7 @@ public class MongoHealthIndicator extends AbstractHealthIndicator {
public MongoHealthIndicator(MongoTemplate mongoTemplate) {
super("MongoDB health check failed");
Assert.notNull(mongoTemplate, "MongoTemplate must not be null");
Assert.notNull(mongoTemplate, "'mongoTemplate' must not be null");
this.mongoTemplate = mongoTemplate;
}

2
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/jmx/JmxEndpointExporter.java

@ -95,7 +95,7 @@ public class JmxEndpointExporter implements InitializingBean, DisposableBean, Be @@ -95,7 +95,7 @@ public class JmxEndpointExporter implements InitializingBean, DisposableBean, Be
}
private ObjectName register(ExposableJmxEndpoint endpoint) {
Assert.notNull(endpoint, "Endpoint must not be null");
Assert.notNull(endpoint, "'endpoint' must not be null");
try {
ObjectName name = this.objectNameFactory.getObjectName(endpoint);
EndpointMBean mbean = new EndpointMBean(this.responseMapper, this.classLoader, endpoint);

4
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/error/DefaultErrorViewResolver.java

@ -81,8 +81,8 @@ public class DefaultErrorViewResolver implements ErrorViewResolver, Ordered { @@ -81,8 +81,8 @@ public class DefaultErrorViewResolver implements ErrorViewResolver, Ordered {
* @since 2.4.0
*/
public DefaultErrorViewResolver(ApplicationContext applicationContext, Resources resources) {
Assert.notNull(applicationContext, "ApplicationContext must not be null");
Assert.notNull(resources, "Resources must not be null");
Assert.notNull(applicationContext, "'applicationContext' must not be null");
Assert.notNull(resources, "'resources' must not be null");
this.applicationContext = applicationContext;
this.resources = resources;
this.templateAvailabilityProviders = new TemplateAvailabilityProviders(applicationContext);

2
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/quartz/QuartzAutoConfigurationTests.java

@ -574,7 +574,7 @@ class QuartzAutoConfigurationTests { @@ -574,7 +574,7 @@ class QuartzAutoConfigurationTests {
static class ComponentThatUsesScheduler {
ComponentThatUsesScheduler(Scheduler scheduler) {
Assert.notNull(scheduler, "Scheduler must not be null");
Assert.notNull(scheduler, "'scheduler' must not be null");
}
}

2
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/session/SessionAutoConfigurationEarlyInitializationIntegrationTests.java

@ -57,7 +57,7 @@ class SessionAutoConfigurationEarlyInitializationIntegrationTests { @@ -57,7 +57,7 @@ class SessionAutoConfigurationEarlyInitializationIntegrationTests {
@Bean
MapSessionRepository mapSessionRepository(ConfigurableApplicationContext context) {
Assert.isTrue(context.getBeanFactory().isConfigurationFrozen(), "Context should be frozen");
Assert.isTrue(context.getBeanFactory().isConfigurationFrozen(), "'context' should be frozen");
return new MapSessionRepository(new LinkedHashMap<>());
}

4
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/error/DefaultErrorViewResolverTests.java

@ -83,14 +83,14 @@ class DefaultErrorViewResolverTests { @@ -83,14 +83,14 @@ class DefaultErrorViewResolverTests {
@Test
void createWhenApplicationContextIsNullShouldThrowException() {
assertThatIllegalArgumentException().isThrownBy(() -> new DefaultErrorViewResolver(null, new Resources()))
.withMessageContaining("ApplicationContext must not be null");
.withMessageContaining("'applicationContext' must not be null");
}
@Test
void createWhenResourcePropertiesIsNullShouldThrowException() {
assertThatIllegalArgumentException()
.isThrownBy(() -> new DefaultErrorViewResolver(mock(ApplicationContext.class), (Resources) null))
.withMessageContaining("Resources must not be null");
.withMessageContaining("'resources' must not be null");
}
@Test

2
spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/remote/server/HttpStatusHandler.java

@ -47,7 +47,7 @@ public class HttpStatusHandler implements Handler { @@ -47,7 +47,7 @@ public class HttpStatusHandler implements Handler {
* @param status the status
*/
public HttpStatusHandler(HttpStatus status) {
Assert.notNull(status, "Status must not be null");
Assert.notNull(status, "'status' must not be null");
this.status = status;
}

2
spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/server/HttpStatusHandlerTests.java

@ -56,7 +56,7 @@ class HttpStatusHandlerTests { @@ -56,7 +56,7 @@ class HttpStatusHandlerTests {
@Test
void statusMustNotBeNull() {
assertThatIllegalArgumentException().isThrownBy(() -> new HttpStatusHandler(null))
.withMessageContaining("Status must not be null");
.withMessageContaining("'status' must not be null");
}
@Test

2
spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/SpringBootMockResolver.java

@ -44,7 +44,7 @@ public class SpringBootMockResolver implements MockResolver { @@ -44,7 +44,7 @@ public class SpringBootMockResolver implements MockResolver {
@SuppressWarnings("unchecked")
private static <T> T getUltimateTargetObject(Object candidate) {
Assert.notNull(candidate, "Candidate must not be null");
Assert.notNull(candidate, "'candidate' must not be null");
try {
if (AopUtils.isAopProxy(candidate) && candidate instanceof Advised advised) {
TargetSource targetSource = advised.getTargetSource();

4
spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/BuildpackCoordinates.java

@ -42,7 +42,7 @@ final class BuildpackCoordinates { @@ -42,7 +42,7 @@ final class BuildpackCoordinates {
private final String version;
private BuildpackCoordinates(String id, String version) {
Assert.hasText(id, "ID must not be empty");
Assert.hasText(id, "'id' must not be empty");
this.id = id;
this.version = version;
}
@ -123,7 +123,7 @@ final class BuildpackCoordinates { @@ -123,7 +123,7 @@ final class BuildpackCoordinates {
* @return a new {@link BuildpackCoordinates} instance
*/
static BuildpackCoordinates fromBuildpackMetadata(BuildpackMetadata buildpackMetadata) {
Assert.notNull(buildpackMetadata, "BuildpackMetadata must not be null");
Assert.notNull(buildpackMetadata, "'buildpackMetadata' must not be null");
return new BuildpackCoordinates(buildpackMetadata.getId(), buildpackMetadata.getVersion());
}

2
spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/configuration/DockerConfiguration.java

@ -81,7 +81,7 @@ public final class DockerConfiguration { @@ -81,7 +81,7 @@ public final class DockerConfiguration {
}
public DockerConfiguration withBuilderRegistryTokenAuthentication(String token) {
Assert.notNull(token, "Token must not be null");
Assert.notNull(token, "'token' must not be null");
return new DockerConfiguration(this.host, new DockerRegistryTokenAuthentication(token),
this.publishAuthentication, this.bindHostToBuilder);
}

4
spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/build/BuildpackCoordinatesTests.java

@ -99,7 +99,7 @@ class BuildpackCoordinatesTests extends AbstractJsonTests { @@ -99,7 +99,7 @@ class BuildpackCoordinatesTests extends AbstractJsonTests {
@Test
void fromBuildpackMetadataWhenMetadataIsNullThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> BuildpackCoordinates.fromBuildpackMetadata(null))
.withMessage("BuildpackMetadata must not be null");
.withMessage("'buildpackMetadata' must not be null");
}
@Test
@ -113,7 +113,7 @@ class BuildpackCoordinatesTests extends AbstractJsonTests { @@ -113,7 +113,7 @@ class BuildpackCoordinatesTests extends AbstractJsonTests {
@Test
void ofWhenIdIsNullThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> BuildpackCoordinates.of(null, null))
.withMessage("ID must not be empty");
.withMessage("'id' must not be empty");
}
@Test

2
spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Layer.java

@ -40,7 +40,7 @@ public class Layer { @@ -40,7 +40,7 @@ public class Layer {
* @param name the name of the layer.
*/
public Layer(String name) {
Assert.hasText(name, "Name must not be empty");
Assert.hasText(name, "'name' must not be empty");
Assert.isTrue(PATTERN.matcher(name).matches(), () -> "Malformed layer name '" + name + "'");
Assert.isTrue(!name.equalsIgnoreCase("ext") && !name.toLowerCase(Locale.ROOT).startsWith("springboot"),
() -> "Layer name '" + name + "' is reserved");

8
spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Packager.java

@ -107,9 +107,9 @@ public abstract class Packager { @@ -107,9 +107,9 @@ public abstract class Packager {
* @param source the source archive file to package
*/
protected Packager(File source) {
Assert.notNull(source, "Source file must not be null");
Assert.notNull(source, "'source' file must not be null");
Assert.isTrue(source.exists() && source.isFile(),
() -> "Source must refer to an existing file, got " + source.getAbsolutePath());
() -> "'source' must refer to an existing file, got " + source.getAbsolutePath());
this.source = source.getAbsoluteFile();
}
@ -163,7 +163,7 @@ public abstract class Packager { @@ -163,7 +163,7 @@ public abstract class Packager {
* @param layers the jar layers
*/
public void setLayers(Layers layers) {
Assert.notNull(layers, "Layers must not be null");
Assert.notNull(layers, "'layers' must not be null");
this.layers = layers;
this.layersIndex = new LayersIndex(layers);
}
@ -204,7 +204,7 @@ public abstract class Packager { @@ -204,7 +204,7 @@ public abstract class Packager {
protected final void write(JarFile sourceJar, Libraries libraries, AbstractJarWriter writer,
boolean ensureReproducibleBuild) throws IOException {
Assert.notNull(libraries, "Libraries must not be null");
Assert.notNull(libraries, "'libraries' must not be null");
write(sourceJar, writer, new PackagedLibraries(libraries, ensureReproducibleBuild));
}

2
spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/layer/ApplicationContentFilter.java

@ -34,7 +34,7 @@ public class ApplicationContentFilter implements ContentFilter<String> { @@ -34,7 +34,7 @@ public class ApplicationContentFilter implements ContentFilter<String> {
private final String pattern;
public ApplicationContentFilter(String pattern) {
Assert.hasText(pattern, "Pattern must not be empty");
Assert.hasText(pattern, "'pattern' must not be empty");
this.pattern = pattern;
}

6
spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/layer/CustomLayers.java

@ -44,10 +44,10 @@ public class CustomLayers implements Layers { @@ -44,10 +44,10 @@ public class CustomLayers implements Layers {
public CustomLayers(List<Layer> layers, List<ContentSelector<String>> applicationSelectors,
List<ContentSelector<Library>> librarySelectors) {
Assert.notNull(layers, "Layers must not be null");
Assert.notNull(applicationSelectors, "ApplicationSelectors must not be null");
Assert.notNull(layers, "'layers' must not be null");
Assert.notNull(applicationSelectors, "'applicationSelectors' must not be null");
validateSelectorLayers(applicationSelectors, layers);
Assert.notNull(librarySelectors, "LibrarySelectors must not be null");
Assert.notNull(librarySelectors, "'librarySelectors' must not be null");
validateSelectorLayers(librarySelectors, layers);
this.layers = new ArrayList<>(layers);
this.applicationSelectors = new ArrayList<>(applicationSelectors);

4
spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/layer/IncludeExcludeContentSelector.java

@ -47,8 +47,8 @@ public class IncludeExcludeContentSelector<T> implements ContentSelector<T> { @@ -47,8 +47,8 @@ public class IncludeExcludeContentSelector<T> implements ContentSelector<T> {
public <S> IncludeExcludeContentSelector(Layer layer, List<S> includes, List<S> excludes,
Function<S, ContentFilter<T>> filterFactory) {
Assert.notNull(layer, "Layer must not be null");
Assert.notNull(filterFactory, "FilterFactory must not be null");
Assert.notNull(layer, "'layer' must not be null");
Assert.notNull(filterFactory, "'filterFactory' must not be null");
this.layer = layer;
this.includes = (includes != null) ? adapt(includes, filterFactory) : Collections.emptyList();
this.excludes = (excludes != null) ? adapt(excludes, filterFactory) : Collections.emptyList();

2
spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/layer/LibraryContentFilter.java

@ -36,7 +36,7 @@ public class LibraryContentFilter implements ContentFilter<Library> { @@ -36,7 +36,7 @@ public class LibraryContentFilter implements ContentFilter<Library> {
private final Pattern pattern;
public LibraryContentFilter(String coordinatesPattern) {
Assert.hasText(coordinatesPattern, "CoordinatesPattern must not be empty");
Assert.hasText(coordinatesPattern, "'coordinatesPattern' must not be empty");
StringBuilder regex = new StringBuilder();
for (int i = 0; i < coordinatesPattern.length(); i++) {
char c = coordinatesPattern.charAt(i);

2
spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/AbstractPackagerTests.java

@ -182,7 +182,7 @@ abstract class AbstractPackagerTests<P extends Packager> { @@ -182,7 +182,7 @@ abstract class AbstractPackagerTests<P extends Packager> {
this.testJarFile.addClass("a/b/C.class", ClassWithMainMethod.class);
P packager = createPackager();
assertThatIllegalArgumentException().isThrownBy(() -> execute(packager, null))
.withMessageContaining("Libraries must not be null");
.withMessageContaining("'libraries' must not be null");
}
@Test

4
spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/LayerTests.java

@ -31,12 +31,12 @@ class LayerTests { @@ -31,12 +31,12 @@ class LayerTests {
@Test
void createWhenNameIsNullThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> new Layer(null)).withMessage("Name must not be empty");
assertThatIllegalArgumentException().isThrownBy(() -> new Layer(null)).withMessage("'name' must not be empty");
}
@Test
void createWhenNameIsEmptyThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> new Layer("")).withMessage("Name must not be empty");
assertThatIllegalArgumentException().isThrownBy(() -> new Layer("")).withMessage("'name' must not be empty");
}
@Test

4
spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/layer/ApplicationContentFilterTests.java

@ -33,13 +33,13 @@ class ApplicationContentFilterTests { @@ -33,13 +33,13 @@ class ApplicationContentFilterTests {
@Test
void createWhenPatternIsNullThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> new ApplicationContentFilter(null))
.withMessage("Pattern must not be empty");
.withMessage("'pattern' must not be empty");
}
@Test
void createWhenPatternIsEmptyThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> new ApplicationContentFilter(""))
.withMessage("Pattern must not be empty");
.withMessage("'pattern' must not be empty");
}
@Test

4
spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/layer/IncludeExcludeContentSelectorTests.java

@ -42,14 +42,14 @@ class IncludeExcludeContentSelectorTests { @@ -42,14 +42,14 @@ class IncludeExcludeContentSelectorTests {
assertThatIllegalArgumentException()
.isThrownBy(
() -> new IncludeExcludeContentSelector<>(null, Collections.emptyList(), Collections.emptyList()))
.withMessage("Layer must not be null");
.withMessage("'layer' must not be null");
}
@Test
void createWhenFactoryIsNullThrowsException() {
assertThatIllegalArgumentException()
.isThrownBy(() -> new IncludeExcludeContentSelector<>(LAYER, null, null, null))
.withMessage("FilterFactory must not be null");
.withMessage("'filterFactory' must not be null");
}
@Test

4
spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/layer/LibraryContentFilterTests.java

@ -38,13 +38,13 @@ class LibraryContentFilterTests { @@ -38,13 +38,13 @@ class LibraryContentFilterTests {
@Test
void createWhenCoordinatesPatternIsNullThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> new LibraryContentFilter(null))
.withMessage("CoordinatesPattern must not be empty");
.withMessage("'coordinatesPattern' must not be empty");
}
@Test
void createWhenCoordinatesPatternIsEmptyThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> new LibraryContentFilter(""))
.withMessage("CoordinatesPattern must not be empty");
.withMessage("'coordinatesPattern' must not be empty");
}
@Test

2
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/BootstrapRegistry.java

@ -121,7 +121,7 @@ public interface BootstrapRegistry { @@ -121,7 +121,7 @@ public interface BootstrapRegistry {
* @since 2.4.2
*/
default InstanceSupplier<T> withScope(Scope scope) {
Assert.notNull(scope, "Scope must not be null");
Assert.notNull(scope, "'scope' must not be null");
InstanceSupplier<T> parent = this;
return new InstanceSupplier<>() {

6
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java

@ -273,7 +273,7 @@ public final class ConfigurationPropertyName implements Comparable<Configuration @@ -273,7 +273,7 @@ public final class ConfigurationPropertyName implements Comparable<Configuration
* @return {@code true} if this name is an ancestor
*/
public boolean isParentOf(ConfigurationPropertyName name) {
Assert.notNull(name, "Name must not be null");
Assert.notNull(name, "'name' must not be null");
if (getNumberOfElements() != name.getNumberOfElements() - 1) {
return false;
}
@ -287,7 +287,7 @@ public final class ConfigurationPropertyName implements Comparable<Configuration @@ -287,7 +287,7 @@ public final class ConfigurationPropertyName implements Comparable<Configuration
* @return {@code true} if this name is an ancestor
*/
public boolean isAncestorOf(ConfigurationPropertyName name) {
Assert.notNull(name, "Name must not be null");
Assert.notNull(name, "'name' must not be null");
if (getNumberOfElements() >= name.getNumberOfElements()) {
return false;
}
@ -612,7 +612,7 @@ public final class ConfigurationPropertyName implements Comparable<Configuration @@ -612,7 +612,7 @@ public final class ConfigurationPropertyName implements Comparable<Configuration
private static Elements elementsOf(CharSequence name, boolean returnNullIfInvalid, int parserCapacity) {
if (name == null) {
Assert.isTrue(returnNullIfInvalid, "Name must not be null");
Assert.isTrue(returnNullIfInvalid, "'name' must not be null");
return null;
}
if (name.isEmpty()) {

2
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/GraylogExtendedLogFormatStructuredLogFormatter.java

@ -141,7 +141,7 @@ class GraylogExtendedLogFormatStructuredLogFormatter extends JsonWriterStructure @@ -141,7 +141,7 @@ class GraylogExtendedLogFormatStructuredLogFormatter extends JsonWriterStructure
}
private static void createAdditionalField(String name, Object value, BiConsumer<Object, Object> pairs) {
Assert.notNull(name, "fieldName must not be null");
Assert.notNull(name, "'name' must not be null");
if (!FIELD_NAME_VALID_PATTERN.matcher(name).matches()) {
logger.warn(LogMessage.format("'%s' is not a valid field name according to GELF standard", name));
return;

2
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/GraylogExtendedLogFormatStructuredLogFormatter.java

@ -133,7 +133,7 @@ class GraylogExtendedLogFormatStructuredLogFormatter extends JsonWriterStructure @@ -133,7 +133,7 @@ class GraylogExtendedLogFormatStructuredLogFormatter extends JsonWriterStructure
}
private static void createAdditionalField(String name, Object value, BiConsumer<Object, Object> pairs) {
Assert.notNull(name, "fieldName must not be null");
Assert.notNull(name, "'name' must not be null");
if (!FIELD_NAME_VALID_PATTERN.matcher(name).matches()) {
logger.warn(LogMessage.format("'%s' is not a valid field name according to GELF standard", name));
return;

4
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ssl/SslManagerBundle.java

@ -132,7 +132,7 @@ public interface SslManagerBundle { @@ -132,7 +132,7 @@ public interface SslManagerBundle {
* @since 3.5.0
*/
static SslManagerBundle from(TrustManagerFactory trustManagerFactory) {
Assert.notNull(trustManagerFactory, "TrustManagerFactory must not be null");
Assert.notNull(trustManagerFactory, "'trustManagerFactory' must not be null");
KeyManagerFactory defaultKeyManagerFactory = createDefaultKeyManagerFactory();
return of(defaultKeyManagerFactory, trustManagerFactory);
}
@ -145,7 +145,7 @@ public interface SslManagerBundle { @@ -145,7 +145,7 @@ public interface SslManagerBundle {
* @since 3.5.0
*/
static SslManagerBundle from(TrustManager... trustManagers) {
Assert.notNull(trustManagers, "TrustManagers must not be null");
Assert.notNull(trustManagers, "'trustManagers' must not be null");
KeyManagerFactory defaultKeyManagerFactory = createDefaultKeyManagerFactory();
TrustManagerFactory defaultTrustManagerFactory = createDefaultTrustManagerFactory();
return of(defaultKeyManagerFactory, FixedTrustManagerFactory.of(defaultTrustManagerFactory, trustManagers));

8
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/task/SimpleAsyncTaskSchedulerBuilder.java

@ -131,7 +131,7 @@ public class SimpleAsyncTaskSchedulerBuilder { @@ -131,7 +131,7 @@ public class SimpleAsyncTaskSchedulerBuilder {
* @see #additionalCustomizers(SimpleAsyncTaskSchedulerCustomizer...)
*/
public SimpleAsyncTaskSchedulerBuilder customizers(SimpleAsyncTaskSchedulerCustomizer... customizers) {
Assert.notNull(customizers, "Customizers must not be null");
Assert.notNull(customizers, "'customizers' must not be null");
return customizers(Arrays.asList(customizers));
}
@ -146,7 +146,7 @@ public class SimpleAsyncTaskSchedulerBuilder { @@ -146,7 +146,7 @@ public class SimpleAsyncTaskSchedulerBuilder {
*/
public SimpleAsyncTaskSchedulerBuilder customizers(
Iterable<? extends SimpleAsyncTaskSchedulerCustomizer> customizers) {
Assert.notNull(customizers, "Customizers must not be null");
Assert.notNull(customizers, "'customizers' must not be null");
return new SimpleAsyncTaskSchedulerBuilder(this.threadNamePrefix, this.concurrencyLimit, this.virtualThreads,
this.taskTerminationTimeout, this.taskDecorator, append(null, customizers));
}
@ -160,7 +160,7 @@ public class SimpleAsyncTaskSchedulerBuilder { @@ -160,7 +160,7 @@ public class SimpleAsyncTaskSchedulerBuilder {
* @see #customizers(SimpleAsyncTaskSchedulerCustomizer...)
*/
public SimpleAsyncTaskSchedulerBuilder additionalCustomizers(SimpleAsyncTaskSchedulerCustomizer... customizers) {
Assert.notNull(customizers, "Customizers must not be null");
Assert.notNull(customizers, "'customizers' must not be null");
return additionalCustomizers(Arrays.asList(customizers));
}
@ -174,7 +174,7 @@ public class SimpleAsyncTaskSchedulerBuilder { @@ -174,7 +174,7 @@ public class SimpleAsyncTaskSchedulerBuilder {
*/
public SimpleAsyncTaskSchedulerBuilder additionalCustomizers(
Iterable<? extends SimpleAsyncTaskSchedulerCustomizer> customizers) {
Assert.notNull(customizers, "Customizers must not be null");
Assert.notNull(customizers, "'customizers' must not be null");
return new SimpleAsyncTaskSchedulerBuilder(this.threadNamePrefix, this.concurrencyLimit, this.virtualThreads,
this.taskTerminationTimeout, this.taskDecorator, append(this.customizers, customizers));
}

2
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/ValueObjectBinderTests.java

@ -674,7 +674,7 @@ class ValueObjectBinderTests { @@ -674,7 +674,7 @@ class ValueObjectBinderTests {
private final String bar;
ValidatingConstructorBean(String foo, String bar) {
Assert.notNull(foo, "Foo must not be null");
Assert.notNull(foo, "'foo' must not be null");
this.foo = foo;
this.bar = bar;
}

2
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/ConfigurationPropertyNameTests.java

@ -42,7 +42,7 @@ class ConfigurationPropertyNameTests { @@ -42,7 +42,7 @@ class ConfigurationPropertyNameTests {
@Test
void ofNameShouldNotBeNull() {
assertThatIllegalArgumentException().isThrownBy(() -> ConfigurationPropertyName.of(null))
.withMessageContaining("Name must not be null");
.withMessageContaining("'name' must not be null");
}
@Test

2
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/origin/MockOrigin.java

@ -30,7 +30,7 @@ public final class MockOrigin implements Origin { @@ -30,7 +30,7 @@ public final class MockOrigin implements Origin {
private final Origin parent;
private MockOrigin(String value, Origin parent) {
Assert.notNull(value, "Value must not be null");
Assert.notNull(value, "'value' must not be null");
this.value = value;
this.parent = parent;
}

8
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/task/SimpleAsyncTaskSchedulerBuilderTests.java

@ -79,14 +79,14 @@ class SimpleAsyncTaskSchedulerBuilderTests { @@ -79,14 +79,14 @@ class SimpleAsyncTaskSchedulerBuilderTests {
void customizersWhenCustomizersAreNullShouldThrowException() {
assertThatIllegalArgumentException()
.isThrownBy(() -> this.builder.customizers((SimpleAsyncTaskSchedulerCustomizer[]) null))
.withMessageContaining("Customizers must not be null");
.withMessageContaining("'customizers' must not be null");
}
@Test
void customizersCollectionWhenCustomizersAreNullShouldThrowException() {
assertThatIllegalArgumentException()
.isThrownBy(() -> this.builder.customizers((Set<SimpleAsyncTaskSchedulerCustomizer>) null))
.withMessageContaining("Customizers must not be null");
.withMessageContaining("'customizers' must not be null");
}
@Test
@ -121,14 +121,14 @@ class SimpleAsyncTaskSchedulerBuilderTests { @@ -121,14 +121,14 @@ class SimpleAsyncTaskSchedulerBuilderTests {
void additionalCustomizersWhenCustomizersAreNullShouldThrowException() {
assertThatIllegalArgumentException()
.isThrownBy(() -> this.builder.additionalCustomizers((SimpleAsyncTaskSchedulerCustomizer[]) null))
.withMessageContaining("Customizers must not be null");
.withMessageContaining("'customizers' must not be null");
}
@Test
void additionalCustomizersCollectionWhenCustomizersAreNullShouldThrowException() {
assertThatIllegalArgumentException()
.isThrownBy(() -> this.builder.additionalCustomizers((Set<SimpleAsyncTaskSchedulerCustomizer>) null))
.withMessageContaining("Customizers must not be null");
.withMessageContaining("'customizers' must not be null");
}
@Test

Loading…
Cancel
Save