use of com.squareup.picasso3.TestUtils.FakeAction in project picasso by square.
the class PicassoTest method completeDeliversToSingleAndMultiple.
@Test
public void completeDeliversToSingleAndMultiple() {
FakeAction action = mockAction(URI_KEY_1, URI_1, mockImageViewTarget());
FakeAction action2 = mockAction(URI_KEY_1, URI_1, mockImageViewTarget());
BitmapHunter hunter = mockHunter(new RequestHandler.Result.Bitmap(bitmap, MEMORY), action);
hunter.attach(action2);
hunter.run();
picasso.complete(hunter);
verifyActionComplete(action);
verifyActionComplete(action2);
}
use of com.squareup.picasso3.TestUtils.FakeAction in project picasso by square.
the class PicassoTest method completeSkipsIfNoActions.
@Test
public void completeSkipsIfNoActions() {
FakeAction action = mockAction(URI_KEY_1, URI_1, mockImageViewTarget());
BitmapHunter hunter = mockHunter(new RequestHandler.Result.Bitmap(bitmap, MEMORY), action);
hunter.detach(action);
hunter.run();
picasso.complete(hunter);
assertThat(hunter.getAction()).isNull();
assertThat(hunter.getActions()).isNull();
}
use of com.squareup.picasso3.TestUtils.FakeAction in project picasso by square.
the class PicassoTest method completeDeliversToSingle.
@Test
public void completeDeliversToSingle() {
FakeAction action = mockAction(URI_KEY_1, URI_1, mockImageViewTarget());
BitmapHunter hunter = mockHunter(new RequestHandler.Result.Bitmap(bitmap, MEMORY), action);
hunter.run();
picasso.complete(hunter);
verifyActionComplete(action);
}
use of com.squareup.picasso3.TestUtils.FakeAction in project picasso by square.
the class PicassoTest method completeInvokesSuccessOnAllSuccessfulRequests.
@Test
public void completeInvokesSuccessOnAllSuccessfulRequests() {
FakeAction action1 = mockAction(URI_KEY_1, URI_1, mockImageViewTarget());
BitmapHunter hunter = mockHunter(new RequestHandler.Result.Bitmap(bitmap, MEMORY), action1);
FakeAction action2 = mockAction(URI_KEY_1, URI_1, mockImageViewTarget());
hunter.attach(action2);
action2.cancelled = true;
hunter.run();
picasso.complete(hunter);
verifyActionComplete(action1);
assertThat(action2.completedResult).isNull();
}
use of com.squareup.picasso3.TestUtils.FakeAction in project picasso by square.
the class PicassoTest method completeInvokesErrorOnAllFailedRequests.
@Test
public void completeInvokesErrorOnAllFailedRequests() {
FakeAction action1 = mockAction(URI_KEY_1, URI_1, mockImageViewTarget());
Exception exception = mock(Exception.class);
BitmapHunter hunter = mockHunter(new RequestHandler.Result.Bitmap(bitmap, MEMORY), action1, exception);
FakeAction action2 = mockAction(URI_KEY_1, URI_1, mockImageViewTarget());
hunter.attach(action2);
action2.cancelled = true;
hunter.run();
picasso.complete(hunter);
assertThat(action1.errorException).hasCauseThat().isEqualTo(exception);
assertThat(action2.errorException).isNull();
verify(listener).onImageLoadFailed(picasso, URI_1, action1.errorException);
}
Aggregations