Fix incomplete AssertJ assertions

Closes gh-30743
This commit is contained in:
Johnny Lim 2023-06-25 00:46:08 +09:00 committed by Sam Brannen
parent 209e02cf29
commit 6c816c55d1
4 changed files with 7 additions and 7 deletions

View File

@ -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

View File

@ -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"));
} }
} }

View File

@ -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"));
} }

View File

@ -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"));
} }