Skip to content

Commit 2682b38

Browse files
committed
Merge pull request #25499 from dreis2211
* pr/25499: Fix some assertions Closes gh-25499
2 parents ae630e0 + 89a44f3 commit 2682b38

File tree

7 files changed

+14
-15
lines changed

7 files changed

+14
-15
lines changed

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/neo4j/Neo4jAutoConfigurationTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2020 the original author or authors.
2+
* Copyright 2012-2021 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.
@@ -284,7 +284,7 @@ void securityWitHostnameVerificationEnabled() {
284284
@Test
285285
void securityWithCustomCertificates(@TempDir File directory) throws IOException {
286286
File certFile = new File(directory, "neo4j-driver.cert");
287-
assertThat(certFile.createNewFile());
287+
assertThat(certFile.createNewFile()).isTrue();
288288

289289
Neo4jProperties properties = new Neo4jProperties();
290290
properties.getSecurity().setTrustStrategy(TrustStrategy.TRUST_CUSTOM_CA_SIGNED_CERTIFICATES);

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/buildinfo/BuildInfoIntegrationTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2020 the original author or authors.
2+
* Copyright 2012-2021 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.
@@ -80,7 +80,7 @@ void notUpToDateWhenExecutedTwiceAsTimeChanges() {
8080
Properties second = buildInfoProperties();
8181
String secondBuildTime = second.getProperty("build.time");
8282
assertThat(secondBuildTime).isNotNull();
83-
assertThat(Instant.parse(firstBuildTime).isBefore(Instant.parse(secondBuildTime)));
83+
assertThat(Instant.parse(firstBuildTime)).isBefore(Instant.parse(secondBuildTime));
8484
}
8585

8686
@TestTemplate

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2020 the original author or authors.
2+
* Copyright 2012-2021 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.
@@ -61,7 +61,7 @@ public class BootBuildImageRegistryIntegrationTests {
6161

6262
@BeforeEach
6363
void setUp() {
64-
assertThat(registry.isRunning());
64+
assertThat(registry.isRunning()).isTrue();
6565
this.registryAddress = registry.getHost() + ":" + registry.getFirstMappedPort();
6666
}
6767

spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/java/org/springframework/boot/maven/AbstractArchiveIntegrationTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ static final class JarAssert extends AbstractAssert<JarAssert, File> {
6464

6565
private JarAssert(File actual) {
6666
super(actual, JarAssert.class);
67-
assertThat(actual.exists());
67+
assertThat(actual).exists();
6868
}
6969

7070
JarAssert doesNotHaveEntryWithName(String name) {

spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/java/org/springframework/boot/maven/BuildImageRegistryIntegrationTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2020 the original author or authors.
2+
* Copyright 2012-2021 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.
@@ -55,7 +55,7 @@ public class BuildImageRegistryIntegrationTests extends AbstractArchiveIntegrati
5555

5656
@BeforeEach
5757
void setUp() {
58-
assertThat(registry.isRunning());
58+
assertThat(registry.isRunning()).isTrue();
5959
this.dockerClient = registry.getDockerClient();
6060
this.registryAddress = registry.getHost() + ":" + registry.getFirstMappedPort();
6161
}

spring-boot-project/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2020 the original author or authors.
2+
* Copyright 2012-2021 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.
@@ -1228,10 +1228,10 @@ void addBootstrapper() {
12281228
application.addListeners(listener);
12291229
application.run();
12301230
ApplicationStartingEvent startingEvent = listener.getEvent(ApplicationStartingEvent.class);
1231-
assertThat(startingEvent.getBootstrapContext().get(String.class));
1231+
assertThat(startingEvent.getBootstrapContext().get(String.class)).isEqualTo("boot");
12321232
ApplicationEnvironmentPreparedEvent environmentPreparedEvent = listener
12331233
.getEvent(ApplicationEnvironmentPreparedEvent.class);
1234-
assertThat(environmentPreparedEvent.getBootstrapContext().get(String.class));
1234+
assertThat(environmentPreparedEvent.getBootstrapContext().get(String.class)).isEqualTo("boot");
12351235
}
12361236

12371237
@Test

spring-boot-project/spring-boot/src/test/java/org/springframework/boot/rsocket/netty/NettyRSocketServerFactoryTests.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2020 the original author or authors.
2+
* Copyright 2012-2021 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.
@@ -54,7 +54,6 @@
5454
import org.springframework.util.SocketUtils;
5555

5656
import static org.assertj.core.api.Assertions.assertThat;
57-
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
5857
import static org.mockito.ArgumentMatchers.any;
5958
import static org.mockito.BDDMockito.will;
6059
import static org.mockito.Mockito.inOrder;
@@ -203,7 +202,7 @@ void tcpTransportSslRejectsInsecureClient() {
203202
String payload = "test payload";
204203
Mono<String> responseMono = this.requester.route("test").data(payload).retrieveMono(String.class);
205204
StepVerifier.create(responseMono)
206-
.verifyErrorSatisfies((ex) -> assertThatExceptionOfType(ClosedChannelException.class));
205+
.verifyErrorSatisfies((ex) -> assertThat(ex).isInstanceOf(ClosedChannelException.class));
207206
}
208207

209208
private RSocketRequester createRSocketTcpClient() {

0 commit comments

Comments
 (0)