@Test
public void getWithCacheMiss() throws Exception {

    when(mImageCache.getBitmap(anyString())).thenReturn(null);
    ImageLoader.ImageListener listener = mock(ImageLoader.ImageListener.class);
    // Ask for the image to be loaded.
    mImageLoader.get("http://foo", listener);
    // Second pass to test deduping logic.
    mImageLoader.get("http://foo", listener);
    // Response callback should be called both times.
    verify(listener, times(2)).onResponse(any(ImageLoader.ImageContainer.class), eq(true));
    // But request should be enqueued only once.
    verify(mRequestQueue, times(1)).add(Mockito.<Request<?>>any());
}