### Question:
AbstractResponseDecoder implements ResponseDecoder { @SuppressWarnings("unchecked") @Override public <T> T decode(Response response, Class<T> type) { try { if (byte[].class.equals(type)) { return (T) response.toByteArray(); } else if (InputStream.class.isAssignableFrom(type)) { return (T) response.body(); } if (response == null || response.body() == null) { return null; } return this.decodeInternal(response, type); } catch (Exception ex) { throw new FeignException("Error decoding the Response", ex, this.getClass().getName() + "#decode"); } }  @SuppressWarnings("unchecked") @Override T decode(Response response, Class<T> type);  }### Answer:
@Test void skipDecode_whenByteArray() throws Exception{ this.decoder.decode(this.response, byte[].class); verify(response, times(1)).toByteArray(); }
@Test void skipDecode_whenInputStream() { this.decoder.decode(this.response, FileInputStream.class); verify(response, times(1)).body(); }
@Test void skipDecode_whenResponseIsNull() { Object result = this.decoder.decode(null, Object.class); assertThat(result).isNull(); }
@Test void skipDecode_whenResponseBodyIsNull() { Object result = this.decoder.decode(this.response, Object.class); assertThat(result).isNull(); }
@Test void allOthers_Decode() { when(this.response.body()).thenReturn(new ByteArrayInputStream("results".getBytes( StandardCharsets.UTF_8))); String result = this.decoder.decode(this.response, String.class); assertThat(result).isEqualTo("result"); }
@Test void error_throwsFeignException() { when(this.response.body()).thenThrow(new RuntimeException("Input Stream Closed.")); assertThrows(FeignException.class, () -> decoder.decode(response, String.class)); }