From: Kai Moritz Date: Sun, 10 Apr 2022 14:02:07 +0000 (+0200) Subject: Tests: Test-Reihenfolge definiert, da das Topic nicht geleert wird X-Git-Tag: deserialization-synchroner-test~4 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=786482f3457e9ef966b7847c605d176fc6915884;p=demos%2Fkafka%2Ftraining Tests: Test-Reihenfolge definiert, da das Topic nicht geleert wird --- diff --git a/src/test/java/de/juplo/kafka/ApplicationTests.java b/src/test/java/de/juplo/kafka/ApplicationTests.java index 21d1668..5e439d6 100644 --- a/src/test/java/de/juplo/kafka/ApplicationTests.java +++ b/src/test/java/de/juplo/kafka/ApplicationTests.java @@ -11,7 +11,10 @@ import org.apache.kafka.common.serialization.BytesSerializer; import org.apache.kafka.common.serialization.LongSerializer; import org.apache.kafka.common.serialization.StringSerializer; import org.apache.kafka.common.utils.Bytes; +import org.junit.jupiter.api.MethodOrderer; +import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestMethodOrder; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.ConfigDataApplicationContextInitializer; import org.springframework.boot.test.context.TestConfiguration; @@ -35,6 +38,7 @@ import static org.assertj.core.api.Assertions.assertThat; @SpringJUnitConfig(initializers = ConfigDataApplicationContextInitializer.class) +@TestMethodOrder(MethodOrderer.OrderAnnotation.class) @TestPropertySource( properties = { "consumer.bootstrap-server=${spring.embedded.kafka.brokers}", @@ -61,6 +65,7 @@ class ApplicationTests @Test + @Order(1) // << The poistion pill is not skipped. Hence, this test must run first void commitsCurrentOffsetsOnSuccess() { send100Messages(i -> new Bytes(longSerializer.serialize(TOPIC, i))); @@ -77,6 +82,7 @@ class ApplicationTests } @Test + @Order(2) void commitsNoOffsetsOnError() { send100Messages(counter ->