@Test public void whenTransformRequestReturnsNullThrows() { try { when(transformer.transformRequest(any(Request.class))).thenReturn(null); picasso.transformRequest(new Request.Builder(URI_1).build()); fail("Returning null from transformRequest() should throw"); } catch (IllegalStateException expected) { } }
Request transformRequest(Request request) { Request transformed = requestTransformer.transformRequest(request); if (transformed == null) { throw new IllegalStateException("Request transformer " + requestTransformer.getClass().getCanonicalName() + " returned null for " + request); } return transformed; }
Picasso { Request transformRequest(Request request) { Request transformed = requestTransformer.transformRequest(request); if (transformed == null) { throw new IllegalStateException("Request transformer " + requestTransformer.getClass().getCanonicalName() + " returned null for " + request); } return transformed; } }
Picasso { Request transformRequest(Request request) { Request transformed = requestTransformer.transformRequest(request); if (transformed == null) { throw new IllegalStateException("Request transformer " + requestTransformer.getClass().getCanonicalName() + " returned null for " + request); } return transformed; } Picasso(Context context, Dispatcher dispatcher, Cache cache, Listener listener,
      RequestTransformer requestTransformer, List<RequestHandler> extraRequestHandlers, Stats stats,
      Bitmap.Config defaultBitmapConfig, boolean indicatorsEnabled, boolean loggingEnabled); }
Picasso { Request transformRequest(Request request) { Request transformed = requestTransformer.transformRequest(request); if (transformed == null) { throw new IllegalStateException("Request transformer " + requestTransformer.getClass().getCanonicalName() + " returned null for " + request); } return transformed; } Picasso(Context context, Dispatcher dispatcher, Cache cache, Listener listener,
      RequestTransformer requestTransformer, List<RequestHandler> extraRequestHandlers, Stats stats,
      Bitmap.Config defaultBitmapConfig, boolean indicatorsEnabled, boolean loggingEnabled); void cancelRequest(@NonNull ImageView view); void cancelRequest(@NonNull Target target); void cancelRequest(@NonNull RemoteViews remoteViews, @IdRes int viewId); void cancelTag(@NonNull Object tag); void pauseTag(@NonNull Object tag); void resumeTag(@NonNull Object tag); RequestCreator load(@Nullable Uri uri); RequestCreator load(@Nullable String path); RequestCreator load(@NonNull File file); RequestCreator load(@DrawableRes int resourceId); void invalidate(@Nullable Uri uri); void invalidate(@Nullable String path); void invalidate(@NonNull File file); @SuppressWarnings("UnusedDeclaration") void setIndicatorsEnabled(boolean enabled); @SuppressWarnings("UnusedDeclaration") boolean areIndicatorsEnabled(); @SuppressWarnings("UnusedDeclaration") // Public API. void setLoggingEnabled(boolean enabled); boolean isLoggingEnabled(); @SuppressWarnings("UnusedDeclaration") StatsSnapshot getSnapshot(); void shutdown(); static Picasso with(@NonNull Context context); static void setSingletonInstance(@NonNull Picasso picasso); }
Picasso { Request transformRequest(Request request) { Request transformed = requestTransformer.transformRequest(request); if (transformed == null) { throw new IllegalStateException("Request transformer " + requestTransformer.getClass().getCanonicalName() + " returned null for " + request); } return transformed; } Picasso(Context context, Dispatcher dispatcher, Cache cache, Listener listener,
      RequestTransformer requestTransformer, List<RequestHandler> extraRequestHandlers, Stats stats,
      Bitmap.Config defaultBitmapConfig, boolean indicatorsEnabled, boolean loggingEnabled); void cancelRequest(@NonNull ImageView view); void cancelRequest(@NonNull Target target); void cancelRequest(@NonNull RemoteViews remoteViews, @IdRes int viewId); void cancelTag(@NonNull Object tag); void pauseTag(@NonNull Object tag); void resumeTag(@NonNull Object tag); RequestCreator load(@Nullable Uri uri); RequestCreator load(@Nullable String path); RequestCreator load(@NonNull File file); RequestCreator load(@DrawableRes int resourceId); void invalidate(@Nullable Uri uri); void invalidate(@Nullable String path); void invalidate(@NonNull File file); @SuppressWarnings("UnusedDeclaration") void setIndicatorsEnabled(boolean enabled); @SuppressWarnings("UnusedDeclaration") boolean areIndicatorsEnabled(); @SuppressWarnings("UnusedDeclaration") // Public API. void setLoggingEnabled(boolean enabled); boolean isLoggingEnabled(); @SuppressWarnings("UnusedDeclaration") StatsSnapshot getSnapshot(); void shutdown(); static Picasso with(@NonNull Context context); static void setSingletonInstance(@NonNull Picasso picasso);  }