From 3bbd10879475a9a67259936f37fa3f383a7c6731 Mon Sep 17 00:00:00 2001 From: Johnny Lim Date: Sun, 2 Feb 2025 23:11:11 +0900 Subject: [PATCH] Use consistent exception messages in Assert calls See gh-43780 Signed-off-by: Johnny Lim --- .../boot/actuate/data/mongo/MongoHealthIndicator.java | 2 +- .../boot/actuate/endpoint/jmx/JmxEndpointExporter.java | 2 +- .../web/servlet/error/DefaultErrorViewResolver.java | 4 ++-- .../quartz/QuartzAutoConfigurationTests.java | 2 +- ...oConfigurationEarlyInitializationIntegrationTests.java | 2 +- .../web/servlet/error/DefaultErrorViewResolverTests.java | 4 ++-- .../boot/devtools/remote/server/HttpStatusHandler.java | 2 +- .../devtools/remote/server/HttpStatusHandlerTests.java | 2 +- .../boot/test/mock/mockito/SpringBootMockResolver.java | 2 +- .../buildpack/platform/build/BuildpackCoordinates.java | 4 ++-- .../docker/configuration/DockerConfiguration.java | 2 +- .../platform/build/BuildpackCoordinatesTests.java | 4 ++-- .../java/org/springframework/boot/loader/tools/Layer.java | 2 +- .../org/springframework/boot/loader/tools/Packager.java | 8 ++++---- .../boot/loader/tools/layer/ApplicationContentFilter.java | 2 +- .../boot/loader/tools/layer/CustomLayers.java | 6 +++--- .../loader/tools/layer/IncludeExcludeContentSelector.java | 4 ++-- .../boot/loader/tools/layer/LibraryContentFilter.java | 2 +- .../boot/loader/tools/AbstractPackagerTests.java | 2 +- .../org/springframework/boot/loader/tools/LayerTests.java | 4 ++-- .../loader/tools/layer/ApplicationContentFilterTests.java | 4 ++-- .../tools/layer/IncludeExcludeContentSelectorTests.java | 4 ++-- .../loader/tools/layer/LibraryContentFilterTests.java | 4 ++-- .../java/org/springframework/boot/BootstrapRegistry.java | 2 +- .../properties/source/ConfigurationPropertyName.java | 6 +++--- .../GraylogExtendedLogFormatStructuredLogFormatter.java | 2 +- .../GraylogExtendedLogFormatStructuredLogFormatter.java | 2 +- .../org/springframework/boot/ssl/SslManagerBundle.java | 4 ++-- .../boot/task/SimpleAsyncTaskSchedulerBuilder.java | 8 ++++---- .../context/properties/bind/ValueObjectBinderTests.java | 2 +- .../properties/source/ConfigurationPropertyNameTests.java | 2 +- .../java/org/springframework/boot/origin/MockOrigin.java | 2 +- .../boot/task/SimpleAsyncTaskSchedulerBuilderTests.java | 8 ++++---- 33 files changed, 56 insertions(+), 56 deletions(-) diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/data/mongo/MongoHealthIndicator.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/data/mongo/MongoHealthIndicator.java index 307fa646c8c2..577120f4e640 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/data/mongo/MongoHealthIndicator.java +++ b/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 { 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; } diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/jmx/JmxEndpointExporter.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/jmx/JmxEndpointExporter.java index b0c0e7d5cdd3..159e010d22f5 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/jmx/JmxEndpointExporter.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/jmx/JmxEndpointExporter.java @@ -95,7 +95,7 @@ private boolean hasOperations(ExposableJmxEndpoint endpoint) { } 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); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/error/DefaultErrorViewResolver.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/error/DefaultErrorViewResolver.java index 23474a1dc5b7..39659420bf70 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/error/DefaultErrorViewResolver.java +++ b/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 { * @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); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/quartz/QuartzAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/quartz/QuartzAutoConfigurationTests.java index 23aabcf57768..34d54264ff4e 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/quartz/QuartzAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/quartz/QuartzAutoConfigurationTests.java @@ -574,7 +574,7 @@ DataSourceScriptDatabaseInitializer customInitializer(DataSource dataSource) { static class ComponentThatUsesScheduler { ComponentThatUsesScheduler(Scheduler scheduler) { - Assert.notNull(scheduler, "Scheduler must not be null"); + Assert.notNull(scheduler, "'scheduler' must not be null"); } } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/session/SessionAutoConfigurationEarlyInitializationIntegrationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/session/SessionAutoConfigurationEarlyInitializationIntegrationTests.java index da11c9381ca5..3b40cffc7ba1 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/session/SessionAutoConfigurationEarlyInitializationIntegrationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/session/SessionAutoConfigurationEarlyInitializationIntegrationTests.java @@ -57,7 +57,7 @@ static class TestConfiguration { @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<>()); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/error/DefaultErrorViewResolverTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/error/DefaultErrorViewResolverTests.java index 1f4b6e4599d7..e9e24e34df71 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/error/DefaultErrorViewResolverTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/error/DefaultErrorViewResolverTests.java @@ -83,14 +83,14 @@ void setup() { @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 diff --git a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/remote/server/HttpStatusHandler.java b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/remote/server/HttpStatusHandler.java index 218e6796e003..42f30cc3829f 100644 --- a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/remote/server/HttpStatusHandler.java +++ b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/remote/server/HttpStatusHandler.java @@ -47,7 +47,7 @@ public HttpStatusHandler() { * @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; } diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/server/HttpStatusHandlerTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/server/HttpStatusHandlerTests.java index 4adef3962403..886ecf37ed51 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/server/HttpStatusHandlerTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/server/HttpStatusHandlerTests.java @@ -56,7 +56,7 @@ void setup() { @Test void statusMustNotBeNull() { assertThatIllegalArgumentException().isThrownBy(() -> new HttpStatusHandler(null)) - .withMessageContaining("Status must not be null"); + .withMessageContaining("'status' must not be null"); } @Test diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/SpringBootMockResolver.java b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/SpringBootMockResolver.java index c78ce88b213e..996ef637f22f 100644 --- a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/SpringBootMockResolver.java +++ b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/SpringBootMockResolver.java @@ -44,7 +44,7 @@ public Object resolve(Object instance) { @SuppressWarnings("unchecked") private static 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(); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/BuildpackCoordinates.java b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/BuildpackCoordinates.java index 954ddd902589..9f39c674a6af 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/BuildpackCoordinates.java +++ b/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 { 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 @@ private static BuildpackCoordinates fromToml(TomlParseResult toml, Path path) { * @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()); } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/configuration/DockerConfiguration.java b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/configuration/DockerConfiguration.java index 9a650d42bdac..e04f4c9cb10e 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/configuration/DockerConfiguration.java +++ b/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 DockerConfiguration withBindHostToBuilder(boolean bindHostToBuilder) { } 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); } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/build/BuildpackCoordinatesTests.java b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/build/BuildpackCoordinatesTests.java index 5a2820a85fcd..bad30a3a562f 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/build/BuildpackCoordinatesTests.java +++ b/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 @@ void fromTomlWhenContainsBothStacksAndOrderThrowsException() throws IOException @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 @@ void fromBuildpackMetadataReturnsCoordinates() throws Exception { @Test void ofWhenIdIsNullThrowsException() { assertThatIllegalArgumentException().isThrownBy(() -> BuildpackCoordinates.of(null, null)) - .withMessage("ID must not be empty"); + .withMessage("'id' must not be empty"); } @Test diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Layer.java b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Layer.java index 544a7ec772c3..f64dc19cfda6 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Layer.java +++ b/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 { * @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"); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Packager.java b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Packager.java index 07fa54e66352..2ab0ec42dce4 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Packager.java +++ b/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 { * @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 void setLayoutFactory(LayoutFactory layoutFactory) { * @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 @@ protected final void write(JarFile sourceJar, Libraries libraries, AbstractJarWr 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)); } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/layer/ApplicationContentFilter.java b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/layer/ApplicationContentFilter.java index 734ea7e2605b..6bc5c4490827 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/layer/ApplicationContentFilter.java +++ b/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 { 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; } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/layer/CustomLayers.java b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/layer/CustomLayers.java index c8334b5b1607..0aa928181304 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/layer/CustomLayers.java +++ b/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 { public CustomLayers(List layers, List> applicationSelectors, List> 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); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/layer/IncludeExcludeContentSelector.java b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/layer/IncludeExcludeContentSelector.java index 947f3959d271..ef42768f1391 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/layer/IncludeExcludeContentSelector.java +++ b/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 IncludeExcludeContentSelector(Layer layer, List> include public IncludeExcludeContentSelector(Layer layer, List includes, List excludes, Function> 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(); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/layer/LibraryContentFilter.java b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/layer/LibraryContentFilter.java index 295994c6bd95..da6083df6c5e 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/layer/LibraryContentFilter.java +++ b/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 { 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); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/AbstractPackagerTests.java b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/AbstractPackagerTests.java index 8962c11a4d23..f9f1c31b3fb5 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/AbstractPackagerTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/AbstractPackagerTests.java @@ -182,7 +182,7 @@ void nullLibraries() throws Exception { 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 diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/LayerTests.java b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/LayerTests.java index 0328e2b9f10b..d4f6e0784dc0 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/LayerTests.java +++ b/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 { @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 diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/layer/ApplicationContentFilterTests.java b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/layer/ApplicationContentFilterTests.java index fd2e7838f998..800859f8967c 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/layer/ApplicationContentFilterTests.java +++ b/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 { @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 diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/layer/IncludeExcludeContentSelectorTests.java b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/layer/IncludeExcludeContentSelectorTests.java index f012acdcab32..d908e8bbc936 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/layer/IncludeExcludeContentSelectorTests.java +++ b/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 @@ void createWhenLayerIsNullThrowsException() { 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 diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/layer/LibraryContentFilterTests.java b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/layer/LibraryContentFilterTests.java index b6dd41c06cc3..acf4f876401d 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/layer/LibraryContentFilterTests.java +++ b/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 { @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 diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/BootstrapRegistry.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/BootstrapRegistry.java index b983d03f4188..5870aefaab26 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/BootstrapRegistry.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/BootstrapRegistry.java @@ -121,7 +121,7 @@ default Scope getScope() { * @since 2.4.2 */ default InstanceSupplier withScope(Scope scope) { - Assert.notNull(scope, "Scope must not be null"); + Assert.notNull(scope, "'scope' must not be null"); InstanceSupplier parent = this; return new InstanceSupplier<>() { diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java index bd1e7f1dda00..3c4b0823b9d9 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java @@ -273,7 +273,7 @@ public ConfigurationPropertyName subName(int offset) { * @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 boolean isParentOf(ConfigurationPropertyName name) { * @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 @@ private static Elements elementsOf(CharSequence name, boolean returnNullIfInvali 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()) { diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/GraylogExtendedLogFormatStructuredLogFormatter.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/GraylogExtendedLogFormatStructuredLogFormatter.java index a8b0bec19222..f0b93d6e50a7 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/GraylogExtendedLogFormatStructuredLogFormatter.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/GraylogExtendedLogFormatStructuredLogFormatter.java @@ -141,7 +141,7 @@ private static void createAdditionalFields(ReadOnlyStringMap contextData, BiCons } private static void createAdditionalField(String name, Object value, BiConsumer 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; diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/GraylogExtendedLogFormatStructuredLogFormatter.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/GraylogExtendedLogFormatStructuredLogFormatter.java index cd5abd284814..0bfb243e0ca5 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/GraylogExtendedLogFormatStructuredLogFormatter.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/GraylogExtendedLogFormatStructuredLogFormatter.java @@ -133,7 +133,7 @@ private static void createAdditionalField(List keyValuePairs, BiCo } private static void createAdditionalField(String name, Object value, BiConsumer 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; diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ssl/SslManagerBundle.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ssl/SslManagerBundle.java index 330ab2eb1836..30a7066cdb44 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ssl/SslManagerBundle.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ssl/SslManagerBundle.java @@ -132,7 +132,7 @@ static SslManagerBundle from(SslStoreBundle storeBundle, SslBundleKey key) { * @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 @@ static SslManagerBundle from(TrustManagerFactory trustManagerFactory) { * @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)); diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/task/SimpleAsyncTaskSchedulerBuilder.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/task/SimpleAsyncTaskSchedulerBuilder.java index 2424a6d6cacd..9a543fe94752 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/task/SimpleAsyncTaskSchedulerBuilder.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/task/SimpleAsyncTaskSchedulerBuilder.java @@ -131,7 +131,7 @@ public SimpleAsyncTaskSchedulerBuilder taskDecorator(TaskDecorator taskDecorator * @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 SimpleAsyncTaskSchedulerBuilder customizers(SimpleAsyncTaskSchedulerCusto */ public SimpleAsyncTaskSchedulerBuilder customizers( Iterable 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 SimpleAsyncTaskSchedulerBuilder customizers( * @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 SimpleAsyncTaskSchedulerBuilder additionalCustomizers(SimpleAsyncTaskSche */ public SimpleAsyncTaskSchedulerBuilder additionalCustomizers( Iterable 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)); } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/ValueObjectBinderTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/ValueObjectBinderTests.java index 4b843c7d62c7..a52651c24003 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/ValueObjectBinderTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/ValueObjectBinderTests.java @@ -674,7 +674,7 @@ static class ValidatingConstructorBean { 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; } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/ConfigurationPropertyNameTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/ConfigurationPropertyNameTests.java index 707e4468670d..7d399a294d07 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/ConfigurationPropertyNameTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/ConfigurationPropertyNameTests.java @@ -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 diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/origin/MockOrigin.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/origin/MockOrigin.java index 7774ce5795fa..39032bee279e 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/origin/MockOrigin.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/origin/MockOrigin.java @@ -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; } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/task/SimpleAsyncTaskSchedulerBuilderTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/task/SimpleAsyncTaskSchedulerBuilderTests.java index d4ee11457683..fd866142b705 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/task/SimpleAsyncTaskSchedulerBuilderTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/task/SimpleAsyncTaskSchedulerBuilderTests.java @@ -79,14 +79,14 @@ void taskDecoratorShouldApply() { 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) null)) - .withMessageContaining("Customizers must not be null"); + .withMessageContaining("'customizers' must not be null"); } @Test @@ -121,14 +121,14 @@ void customizersShouldReplaceExisting() { 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) null)) - .withMessageContaining("Customizers must not be null"); + .withMessageContaining("'customizers' must not be null"); } @Test