use of reactivefeign.testcase.IcecreamServiceApi in project feign-reactive by kptfh.
the class ConnectionTimeoutTest method shouldFailOnConnectionTimeout.
// TODO investigate why doesn't work on codecov.io but works locally
@Ignore
@Test
public void shouldFailOnConnectionTimeout() {
expectedException.expectCause(Matchers.any(ConnectException.class));
IcecreamServiceApi client = builder(new ReactiveOptions.Builder().setConnectTimeoutMillis(300).setReadTimeoutMillis(100).build()).target(IcecreamServiceApi.class, "http://localhost:" + port);
client.findOrder(1).block();
}
use of reactivefeign.testcase.IcecreamServiceApi in project feign-reactive by kptfh.
the class DefaultMethodTest method shouldOverrideHashcode.
@Test
public void shouldOverrideHashcode() {
IcecreamServiceApi client = builder().target(IcecreamServiceApi.class, "http://localhost:" + wireMockRule.port());
IcecreamServiceApi otherClientWithSameTarget = builder().target(IcecreamServiceApi.class, "http://localhost:" + wireMockRule.port());
Assertions.assertThat(client.hashCode()).isEqualTo(otherClientWithSameTarget.hashCode());
}
use of reactivefeign.testcase.IcecreamServiceApi in project feign-reactive by kptfh.
the class DefaultMethodTest method shouldProcessDefaultMethodOnProxy.
@Test
public void shouldProcessDefaultMethodOnProxy() throws JsonProcessingException {
IceCreamOrder orderGenerated = new OrderGenerator().generate(1);
String orderStr = TestUtils.MAPPER.writeValueAsString(orderGenerated);
wireMockRule.stubFor(get(urlEqualTo("/icecream/orders/1")).withHeader("Accept", equalTo("application/json")).willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(orderStr)));
IcecreamServiceApi client = builder().target(IcecreamServiceApi.class, "http://localhost:" + wireMockRule.port());
StepVerifier.create(client.findFirstOrder()).expectNextMatches(equalsComparingFieldByFieldRecursively(orderGenerated)).verifyComplete();
}
use of reactivefeign.testcase.IcecreamServiceApi in project feign-reactive by kptfh.
the class NotFoundTest method shouldReturnEmptyMono.
@Test
public void shouldReturnEmptyMono() {
String orderUrl = "/icecream/orders/2";
wireMockRule.stubFor(get(urlEqualTo(orderUrl)).withHeader("Accept", equalTo("application/json")).willReturn(aResponse().withStatus(HttpStatus.SC_NOT_FOUND)));
IcecreamServiceApi client = builder().decode404().target(IcecreamServiceApi.class, "http://localhost:" + wireMockRule.port());
StepVerifier.create(client.findOrder(2)).expectNextCount(0).verifyComplete();
}
use of reactivefeign.testcase.IcecreamServiceApi in project feign-reactive by kptfh.
the class RetryingTest method shouldSuccessOnRetriesWoRetryAfter.
@Test
public void shouldSuccessOnRetriesWoRetryAfter() throws JsonProcessingException {
IceCreamOrder orderGenerated = new OrderGenerator().generate(1);
String orderStr = TestUtils.MAPPER.writeValueAsString(orderGenerated);
mockResponseAfterSeveralAttempts(wireMockRule, 2, "testRetrying_success", "/icecream/orders/1", aResponse().withStatus(SC_SERVICE_UNAVAILABLE), aResponse().withStatus(SC_OK).withHeader("Content-Type", "application/json").withBody(orderStr));
IcecreamServiceApi client = builder().retryWhen(ReactiveRetryers.retryWithBackoff(3, 0)).target(IcecreamServiceApi.class, "http://localhost:" + wireMockRule.port());
StepVerifier.create(client.findOrder(1)).expectNextMatches(equalsComparingFieldByFieldRecursively(orderGenerated)).verifyComplete();
}
Aggregations