示例#1
0
 @Test
 public void invokesErrorIfTargetIsNotNullWithErrorResourceId() throws Exception {
   ImageView target = mockImageViewTarget();
   Callback callback = mockCallback();
   Picasso mock = mock(Picasso.class);
   ImageViewAction request =
       new ImageViewAction(
           mock, target, null, false, false, RESOURCE_ID_1, null, null, null, callback);
   request.error();
   verify(target).setImageResource(RESOURCE_ID_1);
   verify(callback).onError();
 }
示例#2
0
 @Test
 public void returnsIfTargetIsNullOnError() throws Exception {
   Picasso picasso = mock(Picasso.class);
   ImageView target = mockImageViewTarget();
   Callback callback = mockCallback();
   ImageViewAction request =
       new ImageViewAction(
           picasso, target, null, false, false, 0, null, URI_KEY_1, null, callback);
   request.target.clear();
   request.error();
   verifyZeroInteractions(target);
   verifyZeroInteractions(callback);
 }
示例#3
0
 @Test
 public void invokesErrorIfTargetIsNotNullWithErrorDrawable() throws Exception {
   Drawable errorDrawable = mock(Drawable.class);
   ImageView target = mockImageViewTarget();
   Callback callback = mockCallback();
   Picasso mock = mock(Picasso.class);
   ImageViewAction request =
       new ImageViewAction(
           mock, target, null, false, false, 0, errorDrawable, URI_KEY_1, null, callback);
   request.error();
   verify(target).setImageDrawable(errorDrawable);
   verify(callback).onError();
 }