@Test
public void invokesOnBitmapFailedIfTargetIsNotNullWithErrorResourceId() {
Drawable errorDrawable = mock(Drawable.class);
BitmapTarget target = mockTarget();
Context context = mock(Context.class);
Dispatcher dispatcher = mock(Dispatcher.class);
PlatformLruCache cache = new PlatformLruCache(0);
Picasso picasso =
new Picasso(context, dispatcher, UNUSED_CALL_FACTORY, null, cache, null, NO_TRANSFORMERS,
NO_HANDLERS, mock(Stats.class), ARGB_8888, false, false);
Resources res = mock(Resources.class);
BitmapTargetAction request = new BitmapTargetAction(picasso, target, null, null, RESOURCE_ID_1);
when(context.getResources()).thenReturn(res);
when(res.getDrawable(RESOURCE_ID_1)).thenReturn(errorDrawable);
Exception e = new RuntimeException();
request.error(e);
verify(target).onBitmapFailed(e, errorDrawable);
}