Testfall für Consumer (vorerst?) entfernt
[demos/kafka/training] / src / test / java / de / juplo / kafka / ApplicationIT.java
1 package de.juplo.kafka;
2
3 import org.junit.jupiter.api.Test;
4 import org.springframework.beans.factory.annotation.Autowired;
5 import org.springframework.boot.test.context.SpringBootTest;
6 import org.springframework.boot.test.web.client.TestRestTemplate;
7 import org.springframework.boot.test.web.server.LocalServerPort;
8 import org.springframework.kafka.test.context.EmbeddedKafka;
9
10 import static de.juplo.kafka.ApplicationIT.TOPIC;
11
12
13 @SpringBootTest(
14     webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
15     properties = {
16         "sumup.requests.bootstrap-server=${spring.embedded.kafka.brokers}",
17         "sumup.requests.topic=" + TOPIC,
18         "spring.mongodb.embedded.version=4.4.13" })
19 @EmbeddedKafka(topics = TOPIC)
20 public class ApplicationIT
21 {
22   public static final String TOPIC = "FOO";
23
24   @LocalServerPort
25   private int port;
26
27   @Autowired
28   private TestRestTemplate restTemplate;
29
30
31
32   @Test
33   public void testApplicationStartup()
34   {
35     restTemplate.getForObject(
36         "http://localhost:" + port + "/actuator/health",
37         String.class
38         )
39         .contains("UP");
40   }
41 }