@Test public void invokesOnBitmapFailedIfTargetIsNotNullWithErrorResourceId() throws Exception { Drawable errorDrawable = mock(Drawable.class); Target target = mockTarget(); Context context = mock(Context.class); Picasso picasso = new Picasso(context, mock(Dispatcher.class), Cache.NONE, null, IDENTITY, null, mock(Stats.class), ARGB_8888, false, false); Resources res = mock(Resources.class); TargetAction request = new TargetAction(picasso, target, null, 0, 0, null, URI_KEY_1, 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); }
@Override void error(Exception e) { Target target = getTarget(); if (target != null) { if (errorResId != 0) { target.onBitmapFailed(e, picasso.context.getResources().getDrawable(errorResId)); } else { target.onBitmapFailed(e, errorDrawable); } } }
TargetAction extends Action<Target> { @Override void error(Exception e) { Target target = getTarget(); if (target != null) { if (errorResId != 0) { target.onBitmapFailed(e, picasso.context.getResources().getDrawable(errorResId)); } else { target.onBitmapFailed(e, errorDrawable); } } } }
TargetAction extends Action<Target> { @Override void error(Exception e) { Target target = getTarget(); if (target != null) { if (errorResId != 0) { target.onBitmapFailed(e, picasso.context.getResources().getDrawable(errorResId)); } else { target.onBitmapFailed(e, errorDrawable); } } } TargetAction(Picasso picasso, Target target, Request data, int memoryPolicy, int networkPolicy,
      Drawable errorDrawable, String key, Object tag, int errorResId); }
TargetAction extends Action<Target> { @Override void error(Exception e) { Target target = getTarget(); if (target != null) { if (errorResId != 0) { target.onBitmapFailed(e, picasso.context.getResources().getDrawable(errorResId)); } else { target.onBitmapFailed(e, errorDrawable); } } } TargetAction(Picasso picasso, Target target, Request data, int memoryPolicy, int networkPolicy,
      Drawable errorDrawable, String key, Object tag, int errorResId);  }
TargetAction extends Action<Target> { @Override void error(Exception e) { Target target = getTarget(); if (target != null) { if (errorResId != 0) { target.onBitmapFailed(e, picasso.context.getResources().getDrawable(errorResId)); } else { target.onBitmapFailed(e, errorDrawable); } } } TargetAction(Picasso picasso, Target target, Request data, int memoryPolicy, int networkPolicy,
      Drawable errorDrawable, String key, Object tag, int errorResId);   }