@Test public void performNetworkStateChangeFlushesFailedHunters() { PicassoExecutorService service = mock(PicassoExecutorService.class); NetworkInfo info = mockNetworkInfo(true); Dispatcher dispatcher = createDispatcher(service); Action failedAction1 = mockAction(URI_KEY_1, URI_1); Action failedAction2 = mockAction(URI_KEY_2, URI_2); dispatcher.failedActions.put(URI_KEY_1, failedAction1); dispatcher.failedActions.put(URI_KEY_2, failedAction2); dispatcher.performNetworkStateChange(info); verify(service, times(2)).submit(any(BitmapHunter.class)); assertThat(dispatcher.failedActions).isEmpty(); }
void performNetworkStateChange(NetworkInfo info) { if (service instanceof PicassoExecutorService) { ((PicassoExecutorService) service).adjustThreadCount(info); } if (info != null && info.isConnected()) { flushFailedActions(); } }
Dispatcher { void performNetworkStateChange(NetworkInfo info) { if (service instanceof PicassoExecutorService) { ((PicassoExecutorService) service).adjustThreadCount(info); } if (info != null && info.isConnected()) { flushFailedActions(); } } }
Dispatcher { void performNetworkStateChange(NetworkInfo info) { if (service instanceof PicassoExecutorService) { ((PicassoExecutorService) service).adjustThreadCount(info); } if (info != null && info.isConnected()) { flushFailedActions(); } } Dispatcher(Context context, ExecutorService service, Handler mainThreadHandler,
      Downloader downloader, Cache cache, Stats stats); }
Dispatcher { void performNetworkStateChange(NetworkInfo info) { if (service instanceof PicassoExecutorService) { ((PicassoExecutorService) service).adjustThreadCount(info); } if (info != null && info.isConnected()) { flushFailedActions(); } } Dispatcher(Context context, ExecutorService service, Handler mainThreadHandler,
      Downloader downloader, Cache cache, Stats stats);  }
Dispatcher { void performNetworkStateChange(NetworkInfo info) { if (service instanceof PicassoExecutorService) { ((PicassoExecutorService) service).adjustThreadCount(info); } if (info != null && info.isConnected()) { flushFailedActions(); } } Dispatcher(Context context, ExecutorService service, Handler mainThreadHandler,
      Downloader downloader, Cache cache, Stats stats);   }