Shows exception handling isn't required to coerce 204 to null or empty
()
| 91 | |
| 92 | /** Shows exception handling isn't required to coerce 204 to null or empty */ |
| 93 | @Test |
| 94 | void decode204() { |
| 95 | server.enqueue(new MockResponse().setResponseCode(204)); |
| 96 | server.enqueue(new MockResponse().setResponseCode(204)); |
| 97 | server.enqueue(new MockResponse().setResponseCode(204)); |
| 98 | server.enqueue(new MockResponse().setResponseCode(204)); |
| 99 | server.enqueue(new MockResponse().setResponseCode(204)); |
| 100 | server.enqueue(new MockResponse().setResponseCode(400)); |
| 101 | |
| 102 | String url = "http://localhost:" + server.getPort(); |
| 103 | TestInterface api = Feign.builder().target(TestInterface.class, url); |
| 104 | |
| 105 | assertThat(api.getQueues("/")).isEmpty(); // empty, not null! |
| 106 | assertThat(api.decodedLazyPost().hasNext()).isFalse(); // empty, not null! |
| 107 | assertThat(api.optionalContent()).isEmpty(); // empty, not null! |
| 108 | assertThat(api.streamPost()).isEmpty(); // empty, not null! |
| 109 | assertThat(api.decodedPost()).isNull(); // null, not empty! |
| 110 | |
| 111 | try { // ensure other 400 codes are not impacted. |
| 112 | api.decodedPost(); |
| 113 | failBecauseExceptionWasNotThrown(FeignException.class); |
| 114 | } catch (FeignException e) { |
| 115 | assertThat(e.status()).isEqualTo(400); |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | @Test |
| 120 | void noFollowRedirect() { |
nothing calls this directly
no test coverage detected