+ void exceptionFromAgentWhenGet_thenPostError() throws IOException {
+ String errorBody = "Unavailable";
+ WebClientResponseException webClientResponseException = new WebClientResponseException(
+ HttpStatus.SERVICE_UNAVAILABLE.value(), "", (HttpHeaders) null, errorBody.getBytes(), (Charset) null);
+ doReturn(Mono.error(webClientResponseException)).when(agentClient).getForEntity(anyString());
+ doReturn(Mono.just("OK")).when(dmaapClient).post(anyString(), anyString());
+
+ StepVerifier //
+ .create(testedObject.createTask(dmaapInputMessage(Operation.GET))) //
+ .expectSubscription() //
+ .verifyComplete(); //
+
+ ArgumentCaptor<String> captor = ArgumentCaptor.forClass(String.class);
+ verify(dmaapClient).post(anyString(), captor.capture());
+ String actualMessage = captor.getValue();
+ assertThat(actualMessage).contains(HttpStatus.SERVICE_UNAVAILABLE.toString()) //
+ .contains(errorBody);
+ }
+
+ @Test
+ void successfulPut() throws IOException {