@Test public void notificationActionWithDefaultTag() { new RequestCreator(picasso, URI_1, 0).into(mockRemoteViews(), 0, 0, mockNotification()); verify(picasso).enqueueAndSubmit(actionCaptor.capture()); assertThat(actionCaptor.getValue().getTag()).isEqualTo(actionCaptor.getValue()); }
@Test public void intoRemoteViewsNotificationQueuesNotificationAction() { new RequestCreator(picasso, URI_1, 0).into(mockRemoteViews(), 0, 0, mockNotification()); verify(picasso).enqueueAndSubmit(actionCaptor.capture()); assertThat(actionCaptor.getValue()).isInstanceOf(NotificationAction.class); }
@Test public void notificationActionWithDefaultPriority() { new RequestCreator(picasso, URI_1, 0).into(mockRemoteViews(), 0, 0, mockNotification()); verify(picasso).enqueueAndSubmit(actionCaptor.capture()); assertThat(actionCaptor.getValue().request.priority).isEqualTo(NORMAL); }
@Test public void notificationActionWithCustomPriority() { new RequestCreator(picasso, URI_1, 0).priority(HIGH) .into(mockRemoteViews(), 0, 0, mockNotification()); verify(picasso).enqueueAndSubmit(actionCaptor.capture()); assertThat(actionCaptor.getValue().request.priority).isEqualTo(HIGH); }
@Test public void notificationActionWithCustomTag() { new RequestCreator(picasso, URI_1, 0).tag("tag") .into(mockRemoteViews(), 0, 0, mockNotification()); verify(picasso).enqueueAndSubmit(actionCaptor.capture()); assertThat(actionCaptor.getValue().getTag()).isEqualTo("tag"); }
@Test public void intoRemoteViewsNotificationWithNullRemoteViewsThrows() { try { new RequestCreator(picasso, URI_1, 0).into(null, 0, 0, mockNotification()); fail("Calling into() with null RemoteViews should throw exception"); } catch (IllegalArgumentException ignored) { } }
@Test public void intoRemoteViewsNotificationWithPlaceholderDrawableThrows() { try { new RequestCreator(picasso, URI_1, 0).placeholder(new ColorDrawable(0)) .into(mockRemoteViews(), 0, 0, mockNotification()); fail("Calling into() with error drawable should throw exception"); } catch (IllegalArgumentException ignored) { } }
@Test public void intoRemoteViewsNotificationWithErrorDrawableThrows() { try { new RequestCreator(picasso, URI_1, 0).error(new ColorDrawable(0)) .into(mockRemoteViews(), 0, 0, mockNotification()); fail("Calling into() with error drawable should throw exception"); } catch (IllegalArgumentException ignored) { } }
@Test public void intoRemoteViewsNotificationWithFitThrows() { try { RemoteViews remoteViews = mockRemoteViews(); new RequestCreator(picasso, URI_1, 0).fit().into(remoteViews, 1, 1, mockNotification()); fail("Calling fit() into remote views should throw exception"); } catch (IllegalStateException ignored) { } }