### Question:
DownloadSerialQueue extends DownloadListener2 implements Runnable { public synchronized DownloadTask[] shutdown() { shutedDown = true; if (runningTask != null) runningTask.cancel(); final DownloadTask[] tasks = new DownloadTask[taskList.size()]; taskList.toArray(tasks); taskList.clear(); return tasks; } DownloadSerialQueue();   DownloadSerialQueue(DownloadListener listener, ArrayList<DownloadTask> taskList);  DownloadSerialQueue(DownloadListener listener); void setListener(DownloadListener listener); synchronized void enqueue(DownloadTask task); synchronized void pause(); synchronized void resume(); int getWorkingTaskId(); int getWaitingTaskCount(); synchronized DownloadTask[] shutdown(); @Override void run(); @Override void taskStart(@NonNull DownloadTask task); @Override synchronized void taskEnd(@NonNull DownloadTask task, @NonNull EndCause cause,
                                     @Nullable Exception realCause);  }### Answer:
@Test public void shutdown() { taskList.add(task1); serialQueue.runningTask = task2; final DownloadTask[] tasks = serialQueue.shutdown(); verify(task2).cancel(); assertThat(serialQueue.shutedDown).isTrue(); assertThat(tasks).containsExactly(task1); }