@Test
public void shouldDumpInputStreamInMemoryWhenMoreThanOneDeserializerIsGiven() throws Exception {

    Deserializer mockDeserializer1 = mock(Deserializer.class);
    Deserializer mockDeserializer2 = mock(Deserializer.class);
    when(mockMethodConfig.getDeserializers()).thenReturn(new Deserializer[]{mockDeserializer1, mockDeserializer2});
    when(mockDeserializer1.deserialize(String.class, String.class, mockDumpStream, UTF8)).thenThrow(new Exception());
    when(mockDeserializer2.deserialize(String.class, String.class, mockDumpStream, UTF8)).thenReturn("hi");
    mockStatic(IOs.class);
    when(IOs.toByteArray(mockStream, true)).thenReturn(SOME_STRING_UTF8_BYTES);
    String actual = toTest.deserialize(mockResponse);
    assertEquals("hi", actual);
    verify(mockDumpStream).mark(0);
    verify(mockDumpStream).reset();
}