+
+ @DisplayName("Remote-Server answers with 404: Not Found")
+ @Test()
+ void testResponseNotFound()
+ {
+ when(service.getRemoteText("foo")).thenReturn(Mono.error(exception(404)));
+ webClient
+ .get()
+ .uri("/?path=foo")
+ .header("Accept", MediaType.TEXT_PLAIN_VALUE)
+ .exchange()
+ .expectStatus().isNotFound()
+ .expectBody()
+ .jsonPath("status").isEqualTo(404)
+ .jsonPath("error").isEqualTo("Not Found")
+ .jsonPath("path").isEqualTo("/")
+ .jsonPath("timestamp").exists();
+ }
+
+
+ WebClientResponseException exception(int status)
+ {
+ return WebClientResponseException.create(status, "MESSAGE", null, null, null);
+ }