@Test
  void responseInterceptor500Error() throws Exception {
    String body = "One moment, please.";
    server.enqueue(new MockResponse().setResponseCode(503).setBody(body));

    TestInterface api =
        new TestInterfaceBuilder()
            .responseInterceptor(new ErrorInterceptor())
            .target("http://localhost:" + server.getPort());
    assertThat(api.post())
        .as("ResponseInterceptor did not extract the response body")
        .isEqualTo(body);
  }
when you must parse a 2xx status to determine if the operation succeeded or not.
core/src/test/java/feign/FeignTest.java