@Test
public void testLoads_doesNotSaveSource() throws IOException {

    MirageRequest request = mock(MirageRequest.class);
    UrlFactory factory = mock(UrlFactory.class);
    InputStream inputStream = mock(InputStream.class);
    when(factory.getStream(any(Uri.class))).thenReturn(inputStream);
    when(request.urlFactory()).thenReturn(factory);
    when(request.uri()).thenReturn(Uri.parse("http://www.sample.com/"));

    DiskCache diskCache = mock(DiskCache.class);
    MemoryCache<String, Bitmap> memCache = mock(MemoryCache.class);
    when(request.diskCache()).thenReturn(diskCache);
    when(request.memoryCache()).thenReturn(memCache);

    SavingStreamProvider provider = new SavingStreamProvider(request) {
        @Override
        protected InputStream stream() throws IOException {
            ByteArrayOutputStream bos = new ByteArrayOutputStream();
            Bitmap bitmap = Bitmap.createBitmap(400, 600, Bitmap.Config.ARGB_8888);
            bitmap.compress(Bitmap.CompressFormat.PNG, 0 /*ignored for PNG*/, bos);
            byte[] bitmapdata = bos.toByteArray();
            ByteArrayInputStream bs = new ByteArrayInputStream(bitmapdata);
            return bs;
        }
    };
    when(request.provider()).thenReturn(provider);

    Bitmap bitmap = provider.load();
    Assert.assertNotNull(bitmap);

    verify(diskCache, times(0)).put(anyString(), any(DiskCache.Writer.class));
}