use of reactivefeign.testcase.IcecreamServiceApi in project feign-reactive by kptfh.
the class DefaultMethodTest method shouldWrapExceptionWithFlux.
@Test
public void shouldWrapExceptionWithFlux() throws JsonProcessingException {
IceCreamOrder orderGenerated = new OrderGenerator().generate(1);
IcecreamServiceApi client = ReactiveFeign.<IcecreamServiceApi>builder().webClient(WebClient.create()).target(IcecreamServiceApi.class, "http://localhost:" + wireMockRule.port());
IceCreamOrder errorOrder = client.throwExceptionFlux().onErrorReturn(throwable -> throwable.equals(IcecreamServiceApi.RUNTIME_EXCEPTION), orderGenerated).blockFirst();
assertThat(errorOrder).isEqualToComparingFieldByField(orderGenerated);
}
use of reactivefeign.testcase.IcecreamServiceApi in project feign-reactive by kptfh.
the class DefaultMethodTest method shouldWrapExceptionWithMono.
@Test
public void shouldWrapExceptionWithMono() throws JsonProcessingException {
IceCreamOrder orderGenerated = new OrderGenerator().generate(1);
IcecreamServiceApi client = ReactiveFeign.<IcecreamServiceApi>builder().webClient(WebClient.create()).target(IcecreamServiceApi.class, "http://localhost:" + wireMockRule.port());
IceCreamOrder errorOrder = client.throwExceptionMono().onErrorReturn(throwable -> throwable.equals(IcecreamServiceApi.RUNTIME_EXCEPTION), orderGenerated).block();
assertThat(errorOrder).isEqualToComparingFieldByField(orderGenerated);
}
use of reactivefeign.testcase.IcecreamServiceApi in project feign-reactive by kptfh.
the class ReactiveHttpOptionsTest method testCompression.
@Test
public void testCompression() {
ReactiveOptions options = new ReactiveOptions.Builder().setConnectTimeoutMillis(5000).setReadTimeoutMillis(5000).setTryUseCompression(true).build();
IcecreamServiceApi client = ReactiveFeign.<IcecreamServiceApi>builder().webClient(webClient).options(options).target(IcecreamServiceApi.class, targetUrl);
testClient(client);
}
use of reactivefeign.testcase.IcecreamServiceApi in project feign-reactive by kptfh.
the class DefaultMethodTest method shouldOverrideEquals.
@Test
public void shouldOverrideEquals() {
IcecreamServiceApi client = builder(new ReactiveOptions.Builder().setConnectTimeoutMillis(300).setReadTimeoutMillis(100).build()).target(IcecreamServiceApi.class, "http://localhost:" + wireMockRule.port());
IcecreamServiceApi clientWithSameTarget = builder().target(IcecreamServiceApi.class, "http://localhost:" + wireMockRule.port());
Assertions.assertThat(client).isEqualTo(clientWithSameTarget);
IcecreamServiceApi clientWithOtherPort = builder().target(IcecreamServiceApi.class, "http://localhost:" + (wireMockRule.port() + 1));
Assertions.assertThat(client).isNotEqualTo(clientWithOtherPort);
OtherApi clientWithOtherInterface = builder(OtherApi.class).target(OtherApi.class, "http://localhost:" + wireMockRule.port());
Assertions.assertThat(client).isNotEqualTo(clientWithOtherInterface);
}
use of reactivefeign.testcase.IcecreamServiceApi in project feign-reactive by kptfh.
the class DefaultMethodTest method shouldNotWrapException.
@Test(expected = RuntimeException.class)
public void shouldNotWrapException() {
IceCreamOrder orderGenerated = new OrderGenerator().generate(1);
IcecreamServiceApi client = builder().target(IcecreamServiceApi.class, "http://localhost:" + wireMockRule.port());
client.throwsException().onErrorReturn(throwable -> throwable.equals(IcecreamServiceApi.RUNTIME_EXCEPTION), orderGenerated).block();
}
Aggregations