Browse Source

Fix incomplete AssertJ assertions

Closes gh-30743
pull/30746/head
Johnny Lim 3 years ago committed by Sam Brannen
parent
commit
6c816c55d1
  1. 2
      spring-context/src/test/java/org/springframework/jmx/export/MBeanExporterTests.java
  2. 4
      spring-test/src/test/java/org/springframework/test/context/junit/jupiter/event/JUnitJupiterApplicationEventsIntegrationTests.java
  3. 4
      spring-test/src/test/java/org/springframework/test/context/junit4/event/JUnit4ApplicationEventsAsyncIntegrationTests.java
  4. 4
      spring-test/src/test/java/org/springframework/test/context/testng/event/TestNGApplicationEventsAsyncIntegrationTests.java

2
spring-context/src/test/java/org/springframework/jmx/export/MBeanExporterTests.java

@ -102,7 +102,7 @@ public class MBeanExporterTests extends AbstractMBeanServerTests {
exporter.setNotificationListenerMappings(listeners); exporter.setNotificationListenerMappings(listeners);
assertThatExceptionOfType(MBeanExportException.class).as("NotificationListener on a non-existent MBean").isThrownBy(() -> assertThatExceptionOfType(MBeanExportException.class).as("NotificationListener on a non-existent MBean").isThrownBy(() ->
start(exporter)) start(exporter))
.satisfies(ex -> assertThat(ex.contains(InstanceNotFoundException.class))); .satisfies(ex -> assertThat(ex.contains(InstanceNotFoundException.class)).isTrue());
} }
@Test @Test

4
spring-test/src/test/java/org/springframework/test/context/junit/jupiter/event/JUnitJupiterApplicationEventsIntegrationTests.java

@ -264,10 +264,10 @@ class JUnitJupiterApplicationEventsIntegrationTests {
context.publishEvent(new CustomEvent("sync")); context.publishEvent(new CustomEvent("sync"));
Awaitility.await().atMost(Durations.ONE_SECOND) Awaitility.await().atMost(Durations.ONE_SECOND)
.untilAsserted(() -> assertThat(assertThat(this.applicationEvents.stream(CustomEvent.class)) .untilAsserted(() -> assertThat(this.applicationEvents.stream(CustomEvent.class))
.singleElement() .singleElement()
.extracting(CustomEvent::getMessage, InstanceOfAssertFactories.STRING) .extracting(CustomEvent::getMessage, InstanceOfAssertFactories.STRING)
.isEqualTo("sync"))); .isEqualTo("sync"));
} }
} }

4
spring-test/src/test/java/org/springframework/test/context/junit4/event/JUnit4ApplicationEventsAsyncIntegrationTests.java

@ -71,10 +71,10 @@ public class JUnit4ApplicationEventsAsyncIntegrationTests {
context.publishEvent(new CustomEvent("sync")); context.publishEvent(new CustomEvent("sync"));
Awaitility.await().atMost(Durations.ONE_SECOND) Awaitility.await().atMost(Durations.ONE_SECOND)
.untilAsserted(() -> assertThat(assertThat(this.applicationEvents.stream(CustomEvent.class)) .untilAsserted(() -> assertThat(this.applicationEvents.stream(CustomEvent.class))
.singleElement() .singleElement()
.extracting(CustomEvent::getMessage, InstanceOfAssertFactories.STRING) .extracting(CustomEvent::getMessage, InstanceOfAssertFactories.STRING)
.isEqualTo("sync"))); .isEqualTo("sync"));
} }

4
spring-test/src/test/java/org/springframework/test/context/testng/event/TestNGApplicationEventsAsyncIntegrationTests.java

@ -65,10 +65,10 @@ class TestNGApplicationEventsAsyncIntegrationTests extends AbstractTestNGSpringC
context.publishEvent(new CustomEvent("asyncConsumption")); context.publishEvent(new CustomEvent("asyncConsumption"));
Awaitility.await().atMost(Durations.ONE_SECOND) Awaitility.await().atMost(Durations.ONE_SECOND)
.untilAsserted(() -> assertThat(assertThat(this.applicationEvents.stream(CustomEvent.class)) .untilAsserted(() -> assertThat(this.applicationEvents.stream(CustomEvent.class))
.singleElement() .singleElement()
.extracting(CustomEvent::getMessage, InstanceOfAssertFactories.STRING) .extracting(CustomEvent::getMessage, InstanceOfAssertFactories.STRING)
.isEqualTo("asyncConsumption"))); .isEqualTo("asyncConsumption"));
} }

Loading…
Cancel
Save