ImageLoader { public ImageContainer get(String requestUrl, final ImageListener listener) { return get(requestUrl, listener, 0, 0); } ImageLoader(RequestQueue queue, ImageCache imageCache); static ImageListener getImageListener(
            final ImageView view, final int defaultImageResId, final int errorImageResId); boolean isCached(String requestUrl, int maxWidth, int maxHeight); @MainThread boolean isCached(String requestUrl, int maxWidth, int maxHeight, ScaleType scaleType); ImageContainer get(String requestUrl, final ImageListener listener); ImageContainer get(
            String requestUrl, ImageListener imageListener, int maxWidth, int maxHeight); @MainThread ImageContainer get(
            String requestUrl,
            ImageListener imageListener,
            int maxWidth,
            int maxHeight,
            ScaleType scaleType); void setBatchedResponseDelay(int newBatchedResponseDelayMs);  }
@Test public void getWithCacheHit() throws Exception { Bitmap bitmap = Bitmap.createBitmap(1, 1, null); ImageLoader.ImageListener listener = mock(ImageLoader.ImageListener.class); when(mImageCache.getBitmap(anyString())).thenReturn(bitmap); ImageLoader.ImageContainer ic = mImageLoader.get("http: Assert.assertSame(bitmap, ic.getBitmap()); verify(listener).onResponse(ic, true); }
@Test public void getWithCacheMiss() throws Exception { when(mImageCache.getBitmap(anyString())).thenReturn(null); ImageLoader.ImageListener listener = mock(ImageLoader.ImageListener.class); mImageLoader.get("http: mImageLoader.get("http: verify(listener, times(2)).onResponse(any(ImageLoader.ImageContainer.class), eq(true)); verify(mRequestQueue, times(1)).add(Mockito.<Request<?>>any()); }