From: Kai Moritz Date: Thu, 14 Nov 2024 19:46:10 +0000 (+0100) Subject: `ApplicationIT` zurück in `ApplicationTests` umbenannt -- MOVE X-Git-Tag: spring/spring-consumer--kafkalistener--BRANCH-ENDE~5 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=4dfdee7688d8017620d4f8230910cc98b79e30e8;p=demos%2Fkafka%2Ftraining `ApplicationIT` zurück in `ApplicationTests` umbenannt -- MOVE --- diff --git a/src/test/java/de/juplo/kafka/ApplicationIT.java b/src/test/java/de/juplo/kafka/ApplicationIT.java deleted file mode 100644 index 1baca99..0000000 --- a/src/test/java/de/juplo/kafka/ApplicationIT.java +++ /dev/null @@ -1,40 +0,0 @@ -package de.juplo.kafka; - -import org.junit.jupiter.api.Test; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.web.client.TestRestTemplate; -import org.springframework.boot.test.web.server.LocalServerPort; -import org.springframework.kafka.test.context.EmbeddedKafka; - -import static de.juplo.kafka.ApplicationIT.TOPIC; - - -@SpringBootTest( - webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, - properties = { - "spring.kafka.bootstrap-servers=${spring.embedded.kafka.brokers}", - "simple.consumer.topic=" + TOPIC }) -@EmbeddedKafka(topics = TOPIC) -public class ApplicationIT -{ - public static final String TOPIC = "FOO"; - - @LocalServerPort - private int port; - - @Autowired - private TestRestTemplate restTemplate; - - - - @Test - public void testApplicationStartup() - { - restTemplate.getForObject( - "http://localhost:" + port + "/actuator/health", - String.class - ) - .contains("UP"); - } -} diff --git a/src/test/java/de/juplo/kafka/ApplicationTests.java b/src/test/java/de/juplo/kafka/ApplicationTests.java new file mode 100644 index 0000000..1baca99 --- /dev/null +++ b/src/test/java/de/juplo/kafka/ApplicationTests.java @@ -0,0 +1,40 @@ +package de.juplo.kafka; + +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.boot.test.web.server.LocalServerPort; +import org.springframework.kafka.test.context.EmbeddedKafka; + +import static de.juplo.kafka.ApplicationIT.TOPIC; + + +@SpringBootTest( + webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, + properties = { + "spring.kafka.bootstrap-servers=${spring.embedded.kafka.brokers}", + "simple.consumer.topic=" + TOPIC }) +@EmbeddedKafka(topics = TOPIC) +public class ApplicationIT +{ + public static final String TOPIC = "FOO"; + + @LocalServerPort + private int port; + + @Autowired + private TestRestTemplate restTemplate; + + + + @Test + public void testApplicationStartup() + { + restTemplate.getForObject( + "http://localhost:" + port + "/actuator/health", + String.class + ) + .contains("UP"); + } +}