### Question:
DownloadDispatcher { public synchronized boolean isFileConflictAfterRun(@NonNull DownloadTask task) { Util.d(TAG, "is file conflict after run: " + task.getId()); final File file = task.getFile(); if (file == null) return false; for (DownloadCall syncCall : runningSyncCalls) { if (syncCall.isCanceled() || syncCall.task == task) continue; final File otherFile = syncCall.task.getFile(); if (otherFile != null && file.equals(otherFile)) { return true; } } for (DownloadCall asyncCall : runningAsyncCalls) { if (asyncCall.isCanceled() || asyncCall.task == task) continue; final File otherFile = asyncCall.task.getFile(); if (otherFile != null && file.equals(otherFile)) { return true; } } return false; } DownloadDispatcher();   DownloadDispatcher(List<DownloadCall> readyAsyncCalls,
                       List<DownloadCall> runningAsyncCalls,
                       List<DownloadCall> runningSyncCalls,
                       List<DownloadCall> finishingCalls); void setDownloadStore(@NonNull DownloadStore store); void enqueue(DownloadTask[] tasks); void enqueue(DownloadTask task); void execute(DownloadTask task); @SuppressWarnings("PMD.ForLoopsMustUseBraces") void cancelAll(); void cancel(IdentifiedTask[] tasks); boolean cancel(IdentifiedTask task); boolean cancel(int id); @Nullable synchronized DownloadTask findSameTask(DownloadTask task); synchronized boolean isRunning(DownloadTask task); synchronized boolean isPending(DownloadTask task); synchronized void flyingCanceled(DownloadCall call); synchronized void finish(DownloadCall call); synchronized boolean isFileConflictAfterRun(@NonNull DownloadTask task); static void setMaxParallelRunningCount(int maxParallelRunningCount);  }### Answer:
@Test public void isFileConflictAfterRun() { final DownloadTask mockAsyncTask = mockTask(); final DownloadTask samePathTask = mockTask(); doReturn(mockAsyncTask.getFile()).when(samePathTask).getFile(); DownloadCall call = spy(DownloadCall.create(mockAsyncTask, true, store)); runningAsyncCalls.add(call); boolean isConflict = dispatcher.isFileConflictAfterRun(samePathTask); assertThat(isConflict).isTrue(); when(call.isCanceled()).thenReturn(true); isConflict = dispatcher.isFileConflictAfterRun(samePathTask); assertThat(isConflict).isFalse(); when(call.isCanceled()).thenReturn(false); final DownloadTask mockSyncTask = mockTask(); doReturn(mockSyncTask.getFile()).when(samePathTask).getFile(); runningSyncCalls.add(DownloadCall.create(mockSyncTask, false, store)); isConflict = dispatcher.isFileConflictAfterRun(samePathTask); assertThat(isConflict).isTrue(); final DownloadTask noSamePathTask = mockTask(); isConflict = dispatcher.isFileConflictAfterRun(noSamePathTask); assertThat(isConflict).isFalse(); }