X-Git-Url: http://juplo.de/gitweb/?a=blobdiff_plain;f=src%2Ftest%2Fjava%2Fde%2Fjuplo%2Fkafka%2FApplicationTests.java;fp=src%2Ftest%2Fjava%2Fde%2Fjuplo%2Fkafka%2FApplicationTests.java;h=40dc149e519a7f95709d7a7966dddf5b8de722df;hb=ac56a4e914c4a7d687c8c85b2608f0e397372d56;hp=92074fffbbe12df59266f038af1be8424e27c645;hpb=1206d7938f995eed3353d2bd3e26241f30b88e44;p=demos%2Fkafka%2Ftraining diff --git a/src/test/java/de/juplo/kafka/ApplicationTests.java b/src/test/java/de/juplo/kafka/ApplicationTests.java index 92074ff..40dc149 100644 --- a/src/test/java/de/juplo/kafka/ApplicationTests.java +++ b/src/test/java/de/juplo/kafka/ApplicationTests.java @@ -31,10 +31,8 @@ import java.util.stream.IntStream; import static de.juplo.kafka.ApplicationTests.PARTITIONS; import static de.juplo.kafka.ApplicationTests.TOPIC; -import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.*; import static org.awaitility.Awaitility.*; -import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; -import static org.junit.jupiter.api.Assertions.assertThrows; @SpringJUnitConfig(initializers = ConfigDataApplicationContextInitializer.class) @@ -93,10 +91,9 @@ class ApplicationTests compareToCommitedOffsets(newOffsets); }); - assertThrows( - IllegalStateException.class, - () -> endlessConsumer.exitStatus(), - "Consumer should still be running"); + assertThatExceptionOfType(IllegalStateException.class) + .isThrownBy(() -> endlessConsumer.exitStatus()) + .describedAs("Consumer should still be running"); } @Test @@ -126,9 +123,9 @@ class ApplicationTests .describedAs("Received not all sent events") .isLessThan(100); - assertDoesNotThrow( - () -> endlessConsumer.exitStatus(), - "Consumer should not be running"); + assertThatNoException() + .describedAs("Consumer should not be running") + .isThrownBy(() -> endlessConsumer.exitStatus()); assertThat(endlessConsumer.exitStatus()) .describedAs("Consumer should have exited abnormally") .containsInstanceOf(RecordDeserializationException.class);