@Test public void performResumeTagIsIdempotent() { dispatcher.performResumeTag("tag"); verify(mainThreadHandler, never()).sendMessage(any(Message.class)); }
void performResumeTag(Object tag) { if (!pausedTags.remove(tag)) { return; } List<Action> batch = null; for (Iterator<Action> i = pausedActions.values().iterator(); i.hasNext();) { Action action = i.next(); if (action.getTag().equals(tag)) { if (batch == null) { batch = new ArrayList<>(); } batch.add(action); i.remove(); } } if (batch != null) { mainThreadHandler.sendMessage(mainThreadHandler.obtainMessage(REQUEST_BATCH_RESUME, batch)); } }
Dispatcher { void performResumeTag(Object tag) { if (!pausedTags.remove(tag)) { return; } List<Action> batch = null; for (Iterator<Action> i = pausedActions.values().iterator(); i.hasNext();) { Action action = i.next(); if (action.getTag().equals(tag)) { if (batch == null) { batch = new ArrayList<>(); } batch.add(action); i.remove(); } } if (batch != null) { mainThreadHandler.sendMessage(mainThreadHandler.obtainMessage(REQUEST_BATCH_RESUME, batch)); } } }
Dispatcher { void performResumeTag(Object tag) { if (!pausedTags.remove(tag)) { return; } List<Action> batch = null; for (Iterator<Action> i = pausedActions.values().iterator(); i.hasNext();) { Action action = i.next(); if (action.getTag().equals(tag)) { if (batch == null) { batch = new ArrayList<>(); } batch.add(action); i.remove(); } } if (batch != null) { mainThreadHandler.sendMessage(mainThreadHandler.obtainMessage(REQUEST_BATCH_RESUME, batch)); } } Dispatcher(Context context, ExecutorService service, Handler mainThreadHandler,
      Downloader downloader, Cache cache, Stats stats); }
Dispatcher { void performResumeTag(Object tag) { if (!pausedTags.remove(tag)) { return; } List<Action> batch = null; for (Iterator<Action> i = pausedActions.values().iterator(); i.hasNext();) { Action action = i.next(); if (action.getTag().equals(tag)) { if (batch == null) { batch = new ArrayList<>(); } batch.add(action); i.remove(); } } if (batch != null) { mainThreadHandler.sendMessage(mainThreadHandler.obtainMessage(REQUEST_BATCH_RESUME, batch)); } } Dispatcher(Context context, ExecutorService service, Handler mainThreadHandler,
      Downloader downloader, Cache cache, Stats stats);  }
Dispatcher { void performResumeTag(Object tag) { if (!pausedTags.remove(tag)) { return; } List<Action> batch = null; for (Iterator<Action> i = pausedActions.values().iterator(); i.hasNext();) { Action action = i.next(); if (action.getTag().equals(tag)) { if (batch == null) { batch = new ArrayList<>(); } batch.add(action); i.remove(); } } if (batch != null) { mainThreadHandler.sendMessage(mainThreadHandler.obtainMessage(REQUEST_BATCH_RESUME, batch)); } } Dispatcher(Context context, ExecutorService service, Handler mainThreadHandler,
      Downloader downloader, Cache cache, Stats stats);   }