Skip to content

Commit 7bb337a

Browse files
committed
Polish tests
1 parent 4ea3c75 commit 7bb337a

File tree

21 files changed

+58
-59
lines changed

21 files changed

+58
-59
lines changed

ci/images/releasescripts/src/test/java/io/spring/concourse/releasescripts/sonatype/SonatypeServiceTests.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2021 the original author or authors.
2+
* Copyright 2012-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -132,7 +132,7 @@ void publishWithSuccessfulClose() throws IOException {
132132
.andRespond(withSuccess());
133133
this.service.publish(getReleaseInfo(), artifactsRoot);
134134
this.server.verify();
135-
assertThat(uploadRequestsMatcher.candidates).hasSize(0);
135+
assertThat(uploadRequestsMatcher.candidates).isEmpty();
136136
}
137137
}
138138

@@ -184,7 +184,7 @@ void publishWithCloseFailureDueToRuleViolations() throws IOException {
184184
.isThrownBy(() -> this.service.publish(getReleaseInfo(), artifactsRoot))
185185
.withMessage("Close failed");
186186
this.server.verify();
187-
assertThat(uploadRequestsMatcher.candidates).hasSize(0);
187+
assertThat(uploadRequestsMatcher.candidates).isEmpty();
188188
}
189189
}
190190

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/ReactiveCloudFoundrySecurityServiceTests.java

+3-5
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,11 @@ class ReactiveCloudFoundrySecurityServiceTests {
5151

5252
private MockWebServer server;
5353

54-
private WebClient.Builder builder;
55-
5654
@BeforeEach
5755
void setup() {
5856
this.server = new MockWebServer();
59-
this.builder = WebClient.builder().baseUrl(this.server.url("/").toString());
60-
this.securityService = new ReactiveCloudFoundrySecurityService(this.builder, CLOUD_CONTROLLER, false);
57+
WebClient.Builder builder = WebClient.builder().baseUrl(this.server.url("/").toString());
58+
this.securityService = new ReactiveCloudFoundrySecurityService(builder, CLOUD_CONTROLLER, false);
6159
}
6260

6361
@AfterEach
@@ -183,7 +181,7 @@ void fetchTokenKeysWhenNoKeysReturnedFromUAA() throws Exception {
183181
response.setHeader("Content-Type", "application/json");
184182
});
185183
StepVerifier.create(this.securityService.fetchTokenKeys())
186-
.consumeNextWith((tokenKeys) -> assertThat(tokenKeys).hasSize(0))
184+
.consumeNextWith((tokenKeys) -> assertThat(tokenKeys).isEmpty())
187185
.expectComplete()
188186
.verify();
189187
expectRequest((request) -> assertThat(request.getPath()).isEqualTo("/my-cloud-controller.com/info"));

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/batch/BatchDataSourceScriptDatabaseInitializerTests.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import org.springframework.boot.jdbc.DatabaseDriver;
3434
import org.springframework.boot.sql.init.DatabaseInitializationSettings;
3535
import org.springframework.core.io.DefaultResourceLoader;
36+
import org.springframework.core.io.Resource;
3637
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
3738
import org.springframework.test.util.ReflectionTestUtils;
3839

@@ -76,7 +77,7 @@ void batchSchemaCanBeLocated(DatabaseDriver driver) throws SQLException {
7677
DatabaseInitializationSettings settings = BatchDataSourceScriptDatabaseInitializer.getSettings(dataSource,
7778
properties.getJdbc());
7879
List<String> schemaLocations = settings.getSchemaLocations();
79-
assertThat(schemaLocations)
80+
assertThat(schemaLocations).isNotEmpty()
8081
.allSatisfy((location) -> assertThat(resourceLoader.getResource(location).exists()).isTrue());
8182
}
8283

@@ -85,7 +86,7 @@ void batchHasExpectedBuiltInSchemas() throws IOException {
8586
PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
8687
List<String> schemaNames = Stream
8788
.of(resolver.getResources("classpath:org/springframework/batch/core/schema-*.sql"))
88-
.map((resource) -> resource.getFilename())
89+
.map(Resource::getFilename)
8990
.filter((resourceName) -> !resourceName.contains("-drop-"))
9091
.toList();
9192
assertThat(schemaNames).containsExactlyInAnyOrder("schema-derby.sql", "schema-sqlserver.sql",

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionEvaluationReportTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ private void prepareMatches(boolean m1, boolean m2, boolean m3) {
164164
void springBootConditionPopulatesReport() {
165165
ConditionEvaluationReport report = ConditionEvaluationReport
166166
.get(new AnnotationConfigApplicationContext(Config.class).getBeanFactory());
167-
assertThat(report.getConditionAndOutcomesBySource().size()).isNotZero();
167+
assertThat(report.getConditionAndOutcomesBySource()).isNotEmpty();
168168
}
169169

170170
@Test

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnMissingBeanTests.java

+9-9
Original file line numberDiff line numberDiff line change
@@ -155,23 +155,23 @@ void testOnMissingBeanConditionWithFactoryBean() {
155155
this.contextRunner
156156
.withUserConfiguration(FactoryBeanConfiguration.class, ConditionalOnFactoryBean.class,
157157
PropertyPlaceholderAutoConfiguration.class)
158-
.run((context) -> assertThat(context.getBean(ExampleBean.class).toString()).isEqualTo("fromFactory"));
158+
.run((context) -> assertThat(context.getBean(ExampleBean.class)).hasToString("fromFactory"));
159159
}
160160

161161
@Test
162162
void testOnMissingBeanConditionWithComponentScannedFactoryBean() {
163163
this.contextRunner
164164
.withUserConfiguration(ComponentScannedFactoryBeanBeanMethodConfiguration.class,
165165
ConditionalOnFactoryBean.class, PropertyPlaceholderAutoConfiguration.class)
166-
.run((context) -> assertThat(context.getBean(ScanBean.class).toString()).isEqualTo("fromFactory"));
166+
.run((context) -> assertThat(context.getBean(ScanBean.class)).hasToString("fromFactory"));
167167
}
168168

169169
@Test
170170
void testOnMissingBeanConditionWithComponentScannedFactoryBeanWithBeanMethodArguments() {
171171
this.contextRunner
172172
.withUserConfiguration(ComponentScannedFactoryBeanBeanMethodWithArgumentsConfiguration.class,
173173
ConditionalOnFactoryBean.class, PropertyPlaceholderAutoConfiguration.class)
174-
.run((context) -> assertThat(context.getBean(ScanBean.class).toString()).isEqualTo("fromFactory"));
174+
.run((context) -> assertThat(context.getBean(ScanBean.class)).hasToString("fromFactory"));
175175
}
176176

177177
@Test
@@ -180,15 +180,15 @@ void testOnMissingBeanConditionWithFactoryBeanWithBeanMethodArguments() {
180180
.withUserConfiguration(FactoryBeanWithBeanMethodArgumentsConfiguration.class,
181181
ConditionalOnFactoryBean.class, PropertyPlaceholderAutoConfiguration.class)
182182
.withPropertyValues("theValue=foo")
183-
.run((context) -> assertThat(context.getBean(ExampleBean.class).toString()).isEqualTo("fromFactory"));
183+
.run((context) -> assertThat(context.getBean(ExampleBean.class)).hasToString("fromFactory"));
184184
}
185185

186186
@Test
187187
void testOnMissingBeanConditionWithConcreteFactoryBean() {
188188
this.contextRunner
189189
.withUserConfiguration(ConcreteFactoryBeanConfiguration.class, ConditionalOnFactoryBean.class,
190190
PropertyPlaceholderAutoConfiguration.class)
191-
.run((context) -> assertThat(context.getBean(ExampleBean.class).toString()).isEqualTo("fromFactory"));
191+
.run((context) -> assertThat(context.getBean(ExampleBean.class)).hasToString("fromFactory"));
192192
}
193193

194194
@Test
@@ -205,31 +205,31 @@ void testOnMissingBeanConditionWithRegisteredFactoryBean() {
205205
this.contextRunner
206206
.withUserConfiguration(RegisteredFactoryBeanConfiguration.class, ConditionalOnFactoryBean.class,
207207
PropertyPlaceholderAutoConfiguration.class)
208-
.run((context) -> assertThat(context.getBean(ExampleBean.class).toString()).isEqualTo("fromFactory"));
208+
.run((context) -> assertThat(context.getBean(ExampleBean.class)).hasToString("fromFactory"));
209209
}
210210

211211
@Test
212212
void testOnMissingBeanConditionWithNonspecificFactoryBeanWithClassAttribute() {
213213
this.contextRunner
214214
.withUserConfiguration(NonspecificFactoryBeanClassAttributeConfiguration.class,
215215
ConditionalOnFactoryBean.class, PropertyPlaceholderAutoConfiguration.class)
216-
.run((context) -> assertThat(context.getBean(ExampleBean.class).toString()).isEqualTo("fromFactory"));
216+
.run((context) -> assertThat(context.getBean(ExampleBean.class)).hasToString("fromFactory"));
217217
}
218218

219219
@Test
220220
void testOnMissingBeanConditionWithNonspecificFactoryBeanWithStringAttribute() {
221221
this.contextRunner
222222
.withUserConfiguration(NonspecificFactoryBeanStringAttributeConfiguration.class,
223223
ConditionalOnFactoryBean.class, PropertyPlaceholderAutoConfiguration.class)
224-
.run((context) -> assertThat(context.getBean(ExampleBean.class).toString()).isEqualTo("fromFactory"));
224+
.run((context) -> assertThat(context.getBean(ExampleBean.class)).hasToString("fromFactory"));
225225
}
226226

227227
@Test
228228
void testOnMissingBeanConditionWithFactoryBeanInXml() {
229229
this.contextRunner
230230
.withUserConfiguration(FactoryBeanXmlConfiguration.class, ConditionalOnFactoryBean.class,
231231
PropertyPlaceholderAutoConfiguration.class)
232-
.run((context) -> assertThat(context.getBean(ExampleBean.class).toString()).isEqualTo("fromFactory"));
232+
.run((context) -> assertThat(context.getBean(ExampleBean.class)).hasToString("fromFactory"));
233233
}
234234

235235
@Test

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/info/ProjectInfoAutoConfigurationTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ void buildPropertiesCustomLocation() {
119119
@Test
120120
void buildPropertiesCustomInvalidLocation() {
121121
this.contextRunner.withPropertyValues("spring.info.build.location=classpath:/org/acme/no-build-info.properties")
122-
.run((context) -> assertThat(context.getBeansOfType(BuildProperties.class)).hasSize(0));
122+
.run((context) -> assertThat(context.getBeansOfType(BuildProperties.class)).isEmpty());
123123
}
124124

125125
@Test

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationCustomObjectMapperProviderTests.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ class JerseyAutoConfigurationCustomObjectMapperProviderTests {
6060
@Test
6161
void contextLoads() {
6262
ResponseEntity<String> response = this.restTemplate.getForEntity("/rest/message", String.class);
63-
assertThat(HttpStatus.OK).isEqualTo(response.getStatusCode());
64-
assertThat(response.getBody()).isEqualTo("{\"subject\":\"Jersey\"}");
63+
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK);
64+
assertThat("{\"subject\":\"Jersey\"}").isEqualTo(response.getBody());
6565
}
6666

6767
@MinimalWebConfiguration

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationObjectMapperProviderTests.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2022 the original author or authors.
2+
* Copyright 2012-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -62,7 +62,7 @@ class JerseyAutoConfigurationObjectMapperProviderTests {
6262
@Test
6363
void responseIsSerializedUsingAutoConfiguredObjectMapper() {
6464
ResponseEntity<String> response = this.restTemplate.getForEntity("/rest/message", String.class);
65-
assertThat(HttpStatus.OK).isEqualTo(response.getStatusCode());
65+
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK);
6666
assertThat(response.getBody()).isEqualTo("{\"subject\":\"Jersey\"}");
6767
}
6868

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQPropertiesTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ void setTrustedPackages() {
6262
ActiveMQConnectionFactory factory = createFactory(this.properties)
6363
.createConnectionFactory(ActiveMQConnectionFactory.class);
6464
assertThat(factory.isTrustAllPackages()).isFalse();
65-
assertThat(factory.getTrustedPackages().size()).isEqualTo(1);
65+
assertThat(factory.getTrustedPackages()).hasSize(1);
6666
assertThat(factory.getTrustedPackages().get(0)).isEqualTo("trusted.package");
6767
}
6868

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ void resourceHandlerMappingOverrideAll() {
235235
@Test
236236
void resourceHandlerMappingDisabled() {
237237
this.contextRunner.withPropertyValues("spring.web.resources.add-mappings:false")
238-
.run((context) -> assertThat(getResourceMappingLocations(context)).hasSize(0));
238+
.run((context) -> assertThat(getResourceMappingLocations(context)).isEmpty());
239239
}
240240

241241
@Test

spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/ChangeableUrlsTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class ChangeableUrlsTests {
4848
@Test
4949
void directoryUrl() throws Exception {
5050
URL url = makeUrl("myproject");
51-
assertThat(ChangeableUrls.fromUrls(url).size()).isOne();
51+
assertThat(ChangeableUrls.fromUrls(url)).hasSize(1);
5252
}
5353

5454
@Test

spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/RestartApplicationListenerTests.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2021 the original author or authors.
2+
* Copyright 2012-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -36,7 +36,6 @@
3636
import org.springframework.test.util.ReflectionTestUtils;
3737

3838
import static org.assertj.core.api.Assertions.assertThat;
39-
import static org.hamcrest.Matchers.nullValue;
4039
import static org.mockito.Mockito.mock;
4140

4241
/**
@@ -103,7 +102,7 @@ private void testInitialize(boolean failed) {
103102
SpringApplication application = new SpringApplication();
104103
ConfigurableApplicationContext context = mock(ConfigurableApplicationContext.class);
105104
listener.onApplicationEvent(new ApplicationStartingEvent(bootstrapContext, application, ARGS));
106-
assertThat(Restarter.getInstance()).isNotEqualTo(nullValue());
105+
assertThat(Restarter.getInstance()).isNotNull();
107106
assertThat(Restarter.getInstance().isFinished()).isFalse();
108107
listener.onApplicationEvent(new ApplicationPreparedEvent(application, ARGS, context));
109108
if (failed) {

spring-boot-project/spring-boot-docker-compose/src/test/java/org/springframework/boot/docker/compose/core/DockerComposeFileTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ void ofReturnsDockerComposeFile() throws Exception {
106106
FileCopyUtils.copy(new byte[0], file);
107107
DockerComposeFile composeFile = DockerComposeFile.of(file);
108108
assertThat(composeFile).isNotNull();
109-
assertThat(composeFile.toString()).isEqualTo(file.getCanonicalPath());
109+
assertThat(composeFile).hasToString(file.getCanonicalPath());
110110
}
111111

112112
@Test

spring-boot-project/spring-boot-docker-compose/src/test/java/org/springframework/boot/docker/compose/service/connection/cassandra/CassandraDockerComposeConnectionDetailsFactoryIntegrationTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class CassandraDockerComposeConnectionDetailsFactoryIntegrationTests extends Abs
4242
void runCreatesConnectionDetails() {
4343
CassandraConnectionDetails connectionDetails = run(CassandraConnectionDetails.class);
4444
List<Node> contactPoints = connectionDetails.getContactPoints();
45-
assertThat(contactPoints.size()).isEqualTo(1);
45+
assertThat(contactPoints).hasSize(1);
4646
Node node = contactPoints.get(0);
4747
assertThat(node.host()).isNotNull();
4848
assertThat(node.port()).isGreaterThan(0);

spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/docker/type/ImageArchiveManifestTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ void getLayersWithNoLayersReturnsEmptyList() throws Exception {
5252
String content = "[{\"Layers\": []}]";
5353
ImageArchiveManifest manifest = new ImageArchiveManifest(getObjectMapper().readTree(content));
5454
assertThat(manifest.getEntries()).hasSize(1);
55-
assertThat(manifest.getEntries().get(0).getLayers()).hasSize(0);
55+
assertThat(manifest.getEntries().get(0).getLayers()).isEmpty();
5656
}
5757

5858
@Test

spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/PropertyDescriptorResolverTests.java

+7-6
Original file line numberDiff line numberDiff line change
@@ -111,38 +111,39 @@ void propertiesWithLombokValueClass() {
111111
void propertiesWithDeducedConstructorBinding() {
112112
process(ImmutableDeducedConstructorBindingProperties.class,
113113
propertyNames((stream) -> assertThat(stream).containsExactly("theName", "flag")));
114-
process(ImmutableDeducedConstructorBindingProperties.class, properties((stream) -> assertThat(stream)
115-
.allMatch((predicate) -> predicate instanceof ConstructorParameterPropertyDescriptor)));
114+
process(ImmutableDeducedConstructorBindingProperties.class,
115+
properties((stream) -> assertThat(stream).isNotEmpty()
116+
.allMatch((predicate) -> predicate instanceof ConstructorParameterPropertyDescriptor)));
116117
}
117118

118119
@Test
119120
void propertiesWithConstructorWithConstructorBinding() {
120121
process(ImmutableSimpleProperties.class, propertyNames(
121122
(stream) -> assertThat(stream).containsExactly("theName", "flag", "comparator", "counter")));
122-
process(ImmutableSimpleProperties.class, properties((stream) -> assertThat(stream)
123+
process(ImmutableSimpleProperties.class, properties((stream) -> assertThat(stream).isNotEmpty()
123124
.allMatch((predicate) -> predicate instanceof ConstructorParameterPropertyDescriptor)));
124125
}
125126

126127
@Test
127128
void propertiesWithConstructorAndClassConstructorBinding() {
128129
process(ImmutableClassConstructorBindingProperties.class,
129130
propertyNames((stream) -> assertThat(stream).containsExactly("name", "description")));
130-
process(ImmutableClassConstructorBindingProperties.class, properties((stream) -> assertThat(stream)
131+
process(ImmutableClassConstructorBindingProperties.class, properties((stream) -> assertThat(stream).isNotEmpty()
131132
.allMatch((predicate) -> predicate instanceof ConstructorParameterPropertyDescriptor)));
132133
}
133134

134135
@Test
135136
void propertiesWithAutowiredConstructor() {
136137
process(AutowiredProperties.class, propertyNames((stream) -> assertThat(stream).containsExactly("theName")));
137-
process(AutowiredProperties.class, properties((stream) -> assertThat(stream)
138+
process(AutowiredProperties.class, properties((stream) -> assertThat(stream).isNotEmpty()
138139
.allMatch((predicate) -> predicate instanceof JavaBeanPropertyDescriptor)));
139140
}
140141

141142
@Test
142143
void propertiesWithMultiConstructor() {
143144
process(ImmutableMultiConstructorProperties.class,
144145
propertyNames((stream) -> assertThat(stream).containsExactly("name", "description")));
145-
process(ImmutableMultiConstructorProperties.class, properties((stream) -> assertThat(stream)
146+
process(ImmutableMultiConstructorProperties.class, properties((stream) -> assertThat(stream).isNotEmpty()
146147
.allMatch((predicate) -> predicate instanceof ConstructorParameterPropertyDescriptor)));
147148
}
148149

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/AbstractBootArchiveTests.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ void archiveShouldBeLayeredByDefault() throws IOException {
488488
void jarWhenLayersDisabledShouldNotContainLayersIndex() throws IOException {
489489
List<String> entryNames = getEntryNames(
490490
createLayeredJar((configuration) -> configuration.getEnabled().set(false)));
491-
assertThat(entryNames).doesNotContain(this.indexPath + "layers.idx");
491+
assertThat(entryNames).isNotEmpty().doesNotContain(this.indexPath + "layers.idx");
492492
}
493493

494494
@Test
@@ -605,7 +605,7 @@ void whenArchiveIsLayeredThenLayerToolsAreAddedToTheJar() throws IOException {
605605
void whenArchiveIsLayeredAndIncludeLayerToolsIsFalseThenLayerToolsAreNotAddedToTheJar() throws IOException {
606606
List<String> entryNames = getEntryNames(
607607
createLayeredJar((configuration) -> configuration.getIncludeLayerTools().set(false)));
608-
assertThat(entryNames)
608+
assertThat(entryNames).isNotEmpty()
609609
.doesNotContain(this.indexPath + "layers/dependencies/lib/spring-boot-jarmode-layertools.jar");
610610
}
611611

spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/jar/JarFileTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ void getName() {
220220
@Test
221221
void size() throws Exception {
222222
try (ZipFile zip = new ZipFile(this.rootJarFile)) {
223-
assertThat(this.jarFile.size()).isEqualTo(zip.size());
223+
assertThat(this.jarFile).hasSize(zip.size());
224224
}
225225
}
226226

spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataEnvironmentPostProcessorTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ void applyToAppliesPostProcessing() {
108108
TestConfigDataEnvironmentUpdateListener listener = new TestConfigDataEnvironmentUpdateListener();
109109
ConfigDataEnvironmentPostProcessor.applyTo(this.environment, null, null, Collections.singleton("dev"),
110110
listener);
111-
assertThat(this.environment.getPropertySources().size()).isGreaterThan(before);
111+
assertThat(this.environment.getPropertySources()).hasSizeGreaterThan(before);
112112
assertThat(this.environment.getActiveProfiles()).containsExactly("dev");
113113
assertThat(listener.getAddedPropertySources()).isNotEmpty();
114114
assertThat(listener.getProfiles().getActive()).containsExactly("dev");

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ void attachShouldAddAdapterAtBeginning() {
5454
sources.addLast(new MapPropertySource("config", Collections.singletonMap("server.port", "4568")));
5555
int size = sources.size();
5656
ConfigurationPropertySources.attach(environment);
57-
assertThat(sources.size()).isEqualTo(size + 1);
57+
assertThat(sources).hasSize(size + 1);
5858
PropertyResolver resolver = new PropertySourcesPropertyResolver(sources);
5959
assertThat(resolver.getProperty("server.port")).isEqualTo("1234");
6060
}

0 commit comments

Comments
 (0)