use of feign in project feign by OpenFeign.
the class HystrixBuilderTest method errorInFallbackHasExpectedBehavior.
@Test
public void errorInFallbackHasExpectedBehavior() {
thrown.expect(HystrixRuntimeException.class);
thrown.expectMessage("GitHub#contributors(String,String) failed and fallback failed.");
thrown.expectCause(// as opposed to RuntimeException (from the fallback)
isA(FeignException.class));
server.enqueue(new MockResponse().setResponseCode(500));
final GitHub fallback = (owner, repo) -> {
throw new RuntimeException("oops");
};
final GitHub api = target(GitHub.class, "http://localhost:" + server.getPort(), fallback);
api.contributors("Netflix", "feign");
}
Aggregations