From 786482f3457e9ef966b7847c605d176fc6915884 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Sun, 10 Apr 2022 16:02:07 +0200 Subject: [PATCH] Tests: Test-Reihenfolge definiert, da das Topic nicht geleert wird --- src/test/java/de/juplo/kafka/ApplicationTests.java | 6 ++++++ 1 file changed, 6 insertions(+) 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 -> -- 2.20.1