1 package de.juplo.kafka.chat.backend;
3 import org.junit.jupiter.api.DisplayName;
4 import org.junit.jupiter.api.Test;
5 import org.springframework.beans.factory.annotation.Autowired;
6 import org.springframework.boot.test.web.server.LocalServerPort;
7 import org.springframework.http.MediaType;
8 import org.springframework.test.web.reactive.server.WebTestClient;
9 import org.testcontainers.shaded.org.awaitility.Awaitility;
11 import java.time.Duration;
14 public abstract class AbstractConfigurationIT
19 WebTestClient webTestClient;
22 @DisplayName("The app starts, the data is restored and accessible")
23 void testAppStartsDataIsRestoredAndAccessible()
25 String chatRoomId = "5c73531c-6fc4-426c-adcb-afc5c140a0f7";
29 .atMost(Duration.ofSeconds(15))
35 "http://localhost:{port}/actuator/health",
38 .expectStatus().isOk()
39 .expectBody().jsonPath("$.status").isEqualTo("UP");
43 "http://localhost:{port}/list",
45 .accept(MediaType.APPLICATION_JSON)
47 .expectStatus().isOk()
49 .jsonPath("$.length()").isEqualTo(1)
50 .jsonPath("$[0].name").isEqualTo("FOO");
53 .uri("http://localhost:{port}/{chatRoomId}",
56 .accept(MediaType.APPLICATION_JSON)
58 .expectStatus().isOk()
59 .expectBody().jsonPath("$.name").isEqualTo("FOO");
63 "http://localhost:{port}/{chatRoomId}/ute/1",
66 .accept(MediaType.APPLICATION_JSON)
68 .expectStatus().isOk()
69 .expectBody().jsonPath("$.text").isEqualTo("Ich bin Ute...");
73 "http://localhost:{port}/{chatRoomId}/peter/1",
76 .accept(MediaType.APPLICATION_JSON)
78 .expectStatus().isOk()
79 .expectBody().jsonPath("$.text").isEqualTo("Hallo, ich heiße Peter!");