@Test public void invalidErrorImage() { try { new RequestCreator().error(0); fail("Resource ID of zero should throw exception."); } catch (IllegalArgumentException ignored) { } try { new RequestCreator().error(null); fail("Null drawable should throw exception."); } catch (IllegalArgumentException ignored) { } try { new RequestCreator().error(1).error(new ColorDrawable(0)); fail("Two placeholders should throw exception."); } catch (IllegalStateException ignored) { } try { new RequestCreator().error(new ColorDrawable(0)).error(1); fail("Two placeholders should throw exception."); } catch (IllegalStateException ignored) { } }
public RequestCreator error(@DrawableRes int errorResId) { if (errorResId == 0) { throw new IllegalArgumentException("Error image resource invalid."); } if (errorDrawable != null) { throw new IllegalStateException("Error image already set."); } this.errorResId = errorResId; return this; }
RequestCreator { public RequestCreator error(@DrawableRes int errorResId) { if (errorResId == 0) { throw new IllegalArgumentException("Error image resource invalid."); } if (errorDrawable != null) { throw new IllegalStateException("Error image already set."); } this.errorResId = errorResId; return this; } }
RequestCreator { public RequestCreator error(@DrawableRes int errorResId) { if (errorResId == 0) { throw new IllegalArgumentException("Error image resource invalid."); } if (errorDrawable != null) { throw new IllegalStateException("Error image already set."); } this.errorResId = errorResId; return this; } RequestCreator(Picasso picasso, Uri uri, int resourceId); @VisibleForTesting  RequestCreator(); }
RequestCreator { public RequestCreator error(@DrawableRes int errorResId) { if (errorResId == 0) { throw new IllegalArgumentException("Error image resource invalid."); } if (errorDrawable != null) { throw new IllegalStateException("Error image already set."); } this.errorResId = errorResId; return this; } RequestCreator(Picasso picasso, Uri uri, int resourceId); @VisibleForTesting  RequestCreator(); RequestCreator noPlaceholder(); RequestCreator placeholder(@DrawableRes int placeholderResId); RequestCreator placeholder(@NonNull Drawable placeholderDrawable); RequestCreator error(@DrawableRes int errorResId); RequestCreator error(@NonNull Drawable errorDrawable); RequestCreator tag(@NonNull Object tag); RequestCreator fit(); RequestCreator resizeDimen(int targetWidthResId, int targetHeightResId); RequestCreator resize(int targetWidth, int targetHeight); RequestCreator centerCrop(); RequestCreator centerCrop(int alignGravity); RequestCreator centerInside(); RequestCreator onlyScaleDown(); RequestCreator rotate(float degrees); RequestCreator rotate(float degrees, float pivotX, float pivotY); RequestCreator config(@NonNull Bitmap.Config config); RequestCreator stableKey(@NonNull String stableKey); RequestCreator priority(@NonNull Priority priority); RequestCreator transform(@NonNull Transformation transformation); RequestCreator transform(@NonNull List<? extends Transformation> transformations); RequestCreator memoryPolicy(@NonNull MemoryPolicy policy,
      @NonNull MemoryPolicy... additional); RequestCreator networkPolicy(@NonNull NetworkPolicy policy,
      @NonNull NetworkPolicy... additional); RequestCreator purgeable(); RequestCreator noFade(); Bitmap get(); void fetch(); void fetch(@Nullable Callback callback); void into(@NonNull Target target); void into(@NonNull RemoteViews remoteViews, @IdRes int viewId, int notificationId,
      @NonNull Notification notification); void into(@NonNull RemoteViews remoteViews, @IdRes int viewId, int notificationId,
      @NonNull Notification notification, @Nullable String notificationTag); void into(@NonNull RemoteViews remoteViews, @IdRes int viewId, int notificationId,
      @NonNull Notification notification, @Nullable String notificationTag, Callback callback); void into(@NonNull RemoteViews remoteViews, @IdRes int viewId,
      @NonNull int[] appWidgetIds); void into(@NonNull RemoteViews remoteViews, @IdRes int viewId, @NonNull int[] appWidgetIds,
      Callback callback); void into(ImageView target); void into(ImageView target, Callback callback); }
RequestCreator { public RequestCreator error(@DrawableRes int errorResId) { if (errorResId == 0) { throw new IllegalArgumentException("Error image resource invalid."); } if (errorDrawable != null) { throw new IllegalStateException("Error image already set."); } this.errorResId = errorResId; return this; } RequestCreator(Picasso picasso, Uri uri, int resourceId); @VisibleForTesting  RequestCreator(); RequestCreator noPlaceholder(); RequestCreator placeholder(@DrawableRes int placeholderResId); RequestCreator placeholder(@NonNull Drawable placeholderDrawable); RequestCreator error(@DrawableRes int errorResId); RequestCreator error(@NonNull Drawable errorDrawable); RequestCreator tag(@NonNull Object tag); RequestCreator fit(); RequestCreator resizeDimen(int targetWidthResId, int targetHeightResId); RequestCreator resize(int targetWidth, int targetHeight); RequestCreator centerCrop(); RequestCreator centerCrop(int alignGravity); RequestCreator centerInside(); RequestCreator onlyScaleDown(); RequestCreator rotate(float degrees); RequestCreator rotate(float degrees, float pivotX, float pivotY); RequestCreator config(@NonNull Bitmap.Config config); RequestCreator stableKey(@NonNull String stableKey); RequestCreator priority(@NonNull Priority priority); RequestCreator transform(@NonNull Transformation transformation); RequestCreator transform(@NonNull List<? extends Transformation> transformations); RequestCreator memoryPolicy(@NonNull MemoryPolicy policy,
      @NonNull MemoryPolicy... additional); RequestCreator networkPolicy(@NonNull NetworkPolicy policy,
      @NonNull NetworkPolicy... additional); RequestCreator purgeable(); RequestCreator noFade(); Bitmap get(); void fetch(); void fetch(@Nullable Callback callback); void into(@NonNull Target target); void into(@NonNull RemoteViews remoteViews, @IdRes int viewId, int notificationId,
      @NonNull Notification notification); void into(@NonNull RemoteViews remoteViews, @IdRes int viewId, int notificationId,
      @NonNull Notification notification, @Nullable String notificationTag); void into(@NonNull RemoteViews remoteViews, @IdRes int viewId, int notificationId,
      @NonNull Notification notification, @Nullable String notificationTag, Callback callback); void into(@NonNull RemoteViews remoteViews, @IdRes int viewId,
      @NonNull int[] appWidgetIds); void into(@NonNull RemoteViews remoteViews, @IdRes int viewId, @NonNull int[] appWidgetIds,
      Callback callback); void into(ImageView target); void into(ImageView target, Callback callback);  }