@Test
public void shouldDeserializeInputStreamUsingGenericTypeAndObjectMapper() throws IOException {

    ObjectMapper mockObjectMapper = mock(ObjectMapper.class);
    JavaType mockJavaType = mock(JavaType.class);
    Object mockResult = mock(Object.class);
    Type mockType = mock(Type.class);
    InputStream mockInputStream = toInputStream("hello");
    Charset charset = Charset.forName("UTF-8");
    mockStatic(JacksonFactory.class);
    mockStatic(TypeFactory.class);
    when(JacksonFactory.createObjectMapper(any(CRestConfig.class), any(Class.class))).thenReturn(mockObjectMapper);
    when(TypeFactory.type(any(Type.class))).thenReturn(mockJavaType);
    when(mockObjectMapper.readValue(any(InputStreamReader.class), any(JavaType.class))).thenReturn(mockResult);
    Object actual = new JacksonDeserializer(crestConfig).deserialize(null, mockType, mockInputStream, charset);
    ArgumentCaptor<InputStreamReader> inputStreamReader = ArgumentCaptor.forClass(InputStreamReader.class);
    assertEquals(mockResult, actual);
    verify(mockObjectMapper).readValue(inputStreamReader.capture(), eq(mockJavaType));
    InputStreamReader actualInputStream = inputStreamReader.getValue();
    assertEquals("UTF8", actualInputStream.getEncoding());
    assertEquals("hello", IOs.toString(actualInputStream));
    verifyStatic();
    JacksonFactory.createObjectMapper(crestConfig, JacksonDeserializer.class);
    TypeFactory.type(mockType);
}