+ "503 SERVICE_UNAVAILABLE \"Cause: " +
+ Integer.toString(status.value()) +
+ " MESSAGE\";");
+ })
+ .verify();
+ }
+
+ @Test
+ @DisplayName("Internal error while fetching data from remote-server")
+ void testOtherErrors()
+ {
+ Mono<String> mono = Mono.error(new RuntimeException("Boom!"));
+ when(service.getRemoteText("foo")).thenReturn(mono);
+
+ Mono<String> result = controller.fetch("foo");
+
+ StepVerifier
+ .create(result)
+ .expectErrorSatisfies((t) ->
+ {
+ assertThat(t).isInstanceOf(ResponseStatusException.class);
+ ResponseStatusException e = (ResponseStatusException)t;
+ assertThat(e.getStatus()).isEqualTo(HttpStatus.INTERNAL_SERVER_ERROR);
+ assertThat(t.getMessage()).startsWith("500 INTERNAL_SERVER_ERROR \"Cause: Boom!\";");