use of feign.ResponseMapper in project feign by OpenFeign.
the class ReactiveFeignIntegrationTest method testResponseMappers.
@Test
public void testResponseMappers() throws Exception {
this.webServer.enqueue(new MockResponse().setBody("1.0"));
ResponseMapper responseMapper = mock(ResponseMapper.class);
Decoder decoder = mock(Decoder.class);
given(responseMapper.map(any(Response.class), any(Type.class))).willAnswer(AdditionalAnswers.returnsFirstArg());
given(decoder.decode(any(Response.class), any(Type.class))).willReturn("1.0");
TestReactorService service = ReactorFeign.builder().mapAndDecode(responseMapper, decoder).target(TestReactorService.class, this.getServerUrl());
StepVerifier.create(service.version()).expectNext("1.0").expectComplete().verify();
verify(responseMapper, times(1)).map(any(Response.class), any(Type.class));
verify(decoder, times(1)).decode(any(Response.class), any(Type.class));
}
Aggregations