Skip to content

Commit 3bbd108

Browse files
committed
Use consistent exception messages in Assert calls
See gh-43780 Signed-off-by: Johnny Lim <[email protected]>
1 parent e207e7c commit 3bbd108

File tree

33 files changed

+56
-56
lines changed

33 files changed

+56
-56
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public class MongoHealthIndicator extends AbstractHealthIndicator {
3737

3838
public MongoHealthIndicator(MongoTemplate mongoTemplate) {
3939
super("MongoDB health check failed");
40-
Assert.notNull(mongoTemplate, "MongoTemplate must not be null");
40+
Assert.notNull(mongoTemplate, "'mongoTemplate' must not be null");
4141
this.mongoTemplate = mongoTemplate;
4242
}
4343

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ private boolean hasOperations(ExposableJmxEndpoint endpoint) {
9595
}
9696

9797
private ObjectName register(ExposableJmxEndpoint endpoint) {
98-
Assert.notNull(endpoint, "Endpoint must not be null");
98+
Assert.notNull(endpoint, "'endpoint' must not be null");
9999
try {
100100
ObjectName name = this.objectNameFactory.getObjectName(endpoint);
101101
EndpointMBean mbean = new EndpointMBean(this.responseMapper, this.classLoader, endpoint);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ public class DefaultErrorViewResolver implements ErrorViewResolver, Ordered {
8181
* @since 2.4.0
8282
*/
8383
public DefaultErrorViewResolver(ApplicationContext applicationContext, Resources resources) {
84-
Assert.notNull(applicationContext, "ApplicationContext must not be null");
85-
Assert.notNull(resources, "Resources must not be null");
84+
Assert.notNull(applicationContext, "'applicationContext' must not be null");
85+
Assert.notNull(resources, "'resources' must not be null");
8686
this.applicationContext = applicationContext;
8787
this.resources = resources;
8888
this.templateAvailabilityProviders = new TemplateAvailabilityProviders(applicationContext);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ DataSourceScriptDatabaseInitializer customInitializer(DataSource dataSource) {
574574
static class ComponentThatUsesScheduler {
575575

576576
ComponentThatUsesScheduler(Scheduler scheduler) {
577-
Assert.notNull(scheduler, "Scheduler must not be null");
577+
Assert.notNull(scheduler, "'scheduler' must not be null");
578578
}
579579

580580
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ static class TestConfiguration {
5757

5858
@Bean
5959
MapSessionRepository mapSessionRepository(ConfigurableApplicationContext context) {
60-
Assert.isTrue(context.getBeanFactory().isConfigurationFrozen(), "Context should be frozen");
60+
Assert.isTrue(context.getBeanFactory().isConfigurationFrozen(), "'context' should be frozen");
6161
return new MapSessionRepository(new LinkedHashMap<>());
6262
}
6363

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,14 @@ void setup() {
8383
@Test
8484
void createWhenApplicationContextIsNullShouldThrowException() {
8585
assertThatIllegalArgumentException().isThrownBy(() -> new DefaultErrorViewResolver(null, new Resources()))
86-
.withMessageContaining("ApplicationContext must not be null");
86+
.withMessageContaining("'applicationContext' must not be null");
8787
}
8888

8989
@Test
9090
void createWhenResourcePropertiesIsNullShouldThrowException() {
9191
assertThatIllegalArgumentException()
9292
.isThrownBy(() -> new DefaultErrorViewResolver(mock(ApplicationContext.class), (Resources) null))
93-
.withMessageContaining("Resources must not be null");
93+
.withMessageContaining("'resources' must not be null");
9494
}
9595

9696
@Test

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public HttpStatusHandler() {
4747
* @param status the status
4848
*/
4949
public HttpStatusHandler(HttpStatus status) {
50-
Assert.notNull(status, "Status must not be null");
50+
Assert.notNull(status, "'status' must not be null");
5151
this.status = status;
5252
}
5353

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ void setup() {
5656
@Test
5757
void statusMustNotBeNull() {
5858
assertThatIllegalArgumentException().isThrownBy(() -> new HttpStatusHandler(null))
59-
.withMessageContaining("Status must not be null");
59+
.withMessageContaining("'status' must not be null");
6060
}
6161

6262
@Test

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public Object resolve(Object instance) {
4444

4545
@SuppressWarnings("unchecked")
4646
private static <T> T getUltimateTargetObject(Object candidate) {
47-
Assert.notNull(candidate, "Candidate must not be null");
47+
Assert.notNull(candidate, "'candidate' must not be null");
4848
try {
4949
if (AopUtils.isAopProxy(candidate) && candidate instanceof Advised advised) {
5050
TargetSource targetSource = advised.getTargetSource();

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ final class BuildpackCoordinates {
4242
private final String version;
4343

4444
private BuildpackCoordinates(String id, String version) {
45-
Assert.hasText(id, "ID must not be empty");
45+
Assert.hasText(id, "'id' must not be empty");
4646
this.id = id;
4747
this.version = version;
4848
}
@@ -123,7 +123,7 @@ private static BuildpackCoordinates fromToml(TomlParseResult toml, Path path) {
123123
* @return a new {@link BuildpackCoordinates} instance
124124
*/
125125
static BuildpackCoordinates fromBuildpackMetadata(BuildpackMetadata buildpackMetadata) {
126-
Assert.notNull(buildpackMetadata, "BuildpackMetadata must not be null");
126+
Assert.notNull(buildpackMetadata, "'buildpackMetadata' must not be null");
127127
return new BuildpackCoordinates(buildpackMetadata.getId(), buildpackMetadata.getVersion());
128128
}
129129

0 commit comments

Comments
 (0)