InputStream.class);
Upcaster mockUpcaster12 = new StubUpcaster<InputStream>(intermediate1.getType(), intermediate2_stream,
InputStream.class);
ConverterFactory mockConverterFactory = mock(ConverterFactory.class);
ContentTypeConverter mockByteToStreamConverter = mock(ContentTypeConverter.class);
ContentTypeConverter mockStreamToByteConverter = mock(ContentTypeConverter.class);
when(mockConverterFactory.getConverter(byte[].class, InputStream.class)).thenReturn(mockByteToStreamConverter);
when(mockConverterFactory.getConverter(InputStream.class, byte[].class)).thenReturn(mockStreamToByteConverter);
when(mockByteToStreamConverter.expectedSourceType()).thenReturn(byte[].class);
when(mockStreamToByteConverter.targetType()).thenReturn(InputStream.class);
when(mockByteToStreamConverter.convert(isA(SerializedObject.class)))
.thenReturn(intermediate1_stream);
when(mockStreamToByteConverter.convert(intermediate2_stream))
.thenReturn(intermediate2_bytes);
UpcasterChain chain = createUpcasterChain(mockConverterFactory, mockUpcaster12);
List<SerializedObject> actualObjects = chain.upcast(object1, upcastingContext);