use of io.github.resilience4j.feign.test.TestService 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")));
}
use of io.github.resilience4j.feign.test.TestService in project resilience4j by resilience4j.
the class Resilience4jFeignFallbackFactoryTest method should_successfully_get_a_response.
@Test
public void should_successfully_get_a_response() {
setupStub(200);
TestService testService = buildTestService(e -> "my fallback");
String result = testService.greeting();
assertThat(result).isEqualTo("Hello, world!");
verify(1, getRequestedFor(urlPathEqualTo("/greeting")));
}
use of io.github.resilience4j.feign.test.TestService in project resilience4j by resilience4j.
the class Resilience4jFeignFallbackFactoryTest method should_lazily_fail_on_invalid_fallback.
@Test
public void should_lazily_fail_on_invalid_fallback() {
TestService testService = buildTestService(e -> "my fallback");
Throwable throwable = catchThrowable(testService::greeting);
assertThat(throwable).isNotNull().hasMessageContaining("Cannot use the fallback [class java.lang.String] for [interface io.github.resilience4j.feign.test.TestService]");
}
Aggregations