- @LocalServerPort
- private int port;
- @Autowired
- private WebTestClient webTestClient;
-
- @Test
- @DisplayName("The app starts, the data is restored and accessible")
- void test()
- {
- Awaitility
- .await()
- .atMost(Duration.ofSeconds(15))
- .untilAsserted(() ->
- {
- webTestClient
- .get()
- .uri("http://localhost:{port}/actuator/health", port)
- .exchange()
- .expectStatus().isOk()
- .expectBody().jsonPath("$.status").isEqualTo("UP");
- webTestClient
- .get()
- .uri("http://localhost:{port}/4ace69b7-a79f-481b-ad0d-d756d60b66ec", port)
- .accept(MediaType.APPLICATION_JSON)
- .exchange()
- .expectStatus().isOk()
- .expectBody().jsonPath("$.name").isEqualTo("FOO");
- webTestClient
- .get()
- .uri("http://localhost:{port}/4ace69b7-a79f-481b-ad0d-d756d60b66ec/ute/1", port)
- .accept(MediaType.APPLICATION_JSON)
- .exchange()
- .expectStatus().isOk()
- .expectBody().jsonPath("$.text").isEqualTo("Ich bin Ute...");
- webTestClient
- .get()
- .uri("http://localhost:{port}/4ace69b7-a79f-481b-ad0d-d756d60b66ec/peter/1", port)
- .accept(MediaType.APPLICATION_JSON)
- .exchange()
- .expectStatus().isOk()
- .expectBody().jsonPath("$.text").isEqualTo("Hallo, ich heiße Peter!");
- });
- }
-