@Test
  void decodingExceptionGetWrappedInDismiss404Mode() throws Exception {
    server.enqueue(new MockResponse().setResponseCode(404));

    TestInterface api =
        new TestInterfaceBuilder()
            .dismiss404()
            .decoder(
                (response, type) -> {
                  assertEquals(404, response.status());
                  throw new NoSuchElementException();
                })
            .target("http://localhost:" + server.getPort());
    DecodeException exception = assertThrows(DecodeException.class, () -> api.post());
    assertThat(exception).hasCauseInstanceOf(NoSuchElementException.class);
  }
when you must parse a 2xx status to determine if the operation succeeded or not.
core/src/test/java/feign/FeignTest.java