Search in sources :

Example 1 with FeignException

use of feign.FeignException in project feign by OpenFeign.

the class DefaultErrorDecoderTest method testFeignExceptionIncludesStatus.

@Test
public void testFeignExceptionIncludesStatus() throws Throwable {
    Response response = Response.builder().status(400).reason("Bad request").headers(headers).build();
    Exception exception = errorDecoder.decode("Service#foo()", response);
    assertThat(exception).isInstanceOf(FeignException.class);
    assertThat(((FeignException) exception).status()).isEqualTo(400);
}
Also used : Response(feign.Response) FeignException(feign.FeignException) ExpectedException(org.junit.rules.ExpectedException) FeignException(feign.FeignException) Test(org.junit.Test)

Aggregations

FeignException (feign.FeignException)1 Response (feign.Response)1 Test (org.junit.Test)1 ExpectedException (org.junit.rules.ExpectedException)1