Search in sources :

Example 1 with TestServiceFallbackThrowingException

use of io.github.resilience4j.feign.test.TestServiceFallbackThrowingException in project resilience4j by resilience4j.

the class Resilience4jFeignFallbackFactoryTest method should_go_to_fallback_and_rethrow_an_exception_thrown_in_fallback.

@Test
public void should_go_to_fallback_and_rethrow_an_exception_thrown_in_fallback() {
    setupStub(400);
    TestService testService = buildTestService(e -> new TestServiceFallbackThrowingException());
    Throwable result = catchThrowable(testService::greeting);
    assertThat(result).isNotNull().isInstanceOf(RuntimeException.class).hasMessageContaining("Exception in greeting fallback");
    verify(1, getRequestedFor(urlPathEqualTo("/greeting")));
}
Also used : TestService(io.github.resilience4j.feign.test.TestService) TestServiceFallbackThrowingException(io.github.resilience4j.feign.test.TestServiceFallbackThrowingException) Assertions.catchThrowable(org.assertj.core.api.Assertions.catchThrowable) Test(org.junit.Test)

Aggregations

TestService (io.github.resilience4j.feign.test.TestService)1 TestServiceFallbackThrowingException (io.github.resilience4j.feign.test.TestServiceFallbackThrowingException)1 Assertions.catchThrowable (org.assertj.core.api.Assertions.catchThrowable)1 Test (org.junit.Test)1