@Test public void intoRemoteViewsWidgetQueuesAppWidgetAction() { new RequestCreator(picasso, URI_1, 0).into(mockRemoteViews(), 0, new int[] { 1, 2, 3 }); verify(picasso).enqueueAndSubmit(actionCaptor.capture()); assertThat(actionCaptor.getValue()).isInstanceOf(AppWidgetAction.class); }
@Test public void appWidgetActionWithDefaultPriority() { new RequestCreator(picasso, URI_1, 0).into(mockRemoteViews(), 0, new int[] { 1, 2, 3 }); verify(picasso).enqueueAndSubmit(actionCaptor.capture()); assertThat(actionCaptor.getValue().request.priority).isEqualTo(NORMAL); }
@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 appWidgetActionWithDefaultTag() { new RequestCreator(picasso, URI_1, 0).into(mockRemoteViews(), 0, new int[] { 1, 2, 3 }); verify(picasso).enqueueAndSubmit(actionCaptor.capture()); assertThat(actionCaptor.getValue().getTag()).isEqualTo(actionCaptor.getValue()); }
@Test public void appWidgetActionWithCustomPriority() { new RequestCreator(picasso, URI_1, 0).priority(HIGH) .into(mockRemoteViews(), 0, new int[]{1, 2, 3}); verify(picasso).enqueueAndSubmit(actionCaptor.capture()); assertThat(actionCaptor.getValue().request.priority).isEqualTo(HIGH); }
@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 appWidgetActionWithCustomTag() { new RequestCreator(picasso, URI_1, 0).tag("tag") .into(mockRemoteViews(), 0, new int[] { 1, 2, 3 }); verify(picasso).enqueueAndSubmit(actionCaptor.capture()); assertThat(actionCaptor.getValue().getTag()).isEqualTo("tag"); }
@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 intoRemoteViewsWidgetWithPlaceholderDrawableThrows() { try { new RequestCreator(picasso, URI_1, 0).placeholder(new ColorDrawable(0)) .into(mockRemoteViews(), 0, new int[] { 1, 2, 3 }); fail("Calling into() with placeholder drawable should throw exception"); } catch (IllegalArgumentException ignored) { } }
@Test public void intoRemoteViewsWidgetWithErrorDrawableThrows() { try { new RequestCreator(picasso, URI_1, 0).error(new ColorDrawable(0)) .into(mockRemoteViews(), 0, new int[] { 1, 2, 3 }); fail("Calling into() with error drawable should throw exception"); } catch (IllegalArgumentException ignored) { } }
@Test public void intoRemoteViewsWidgetWithNullAppWidgetIdsThrows() { try { new RequestCreator(picasso, URI_1, 0).into(mockRemoteViews(), 0, null); fail("Calling into() with null appWidgetIds should throw exception"); } catch (IllegalArgumentException ignored) { } }
@Test public void intoRemoteViewsNotificationWithNullNotificationThrows() { try { new RequestCreator(picasso, URI_1, 0).into(mockRemoteViews(), 0, 0, (Notification) null); fail("Calling into() with null Notification 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 intoRemoteViewsWidgetWithFitThrows() { try { RemoteViews remoteViews = mockRemoteViews(); new RequestCreator(picasso, URI_1, 0).fit().into(remoteViews, 1, new int[] { 1, 2, 3 }); fail("Calling fit() into remote views should throw exception"); } catch (IllegalStateException 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) { } }