@Test
public void testDrawableFactory() {

    ImageView imageView = new ImageView(RuntimeEnvironment.application);
    ImageViewTarget target = new ImageViewTarget(imageView);
    DrawableFactory factory = Mockito.mock(DrawableFactory.class);
    Mockito.when(
                factory.createDrawable((Context) Mockito.any(), (Bitmap) Mockito.any()))
            .thenReturn(new ColorDrawable(Color.RED));
    target.drawableFactory(factory);
    Drawable d = target.createDrawable(RuntimeEnvironment.application,
            Bitmap.createBitmap(200, 200, Bitmap.Config.ARGB_8888));
    Assert.assertNotNull(d);
    Mockito.verify(factory, Mockito.times(1)).createDrawable((Context) Mockito.any(),
            (Bitmap) Mockito.any());
}