### Question:
DownloadDispatcher { public static void setMaxParallelRunningCount(int maxParallelRunningCount) { DownloadDispatcher dispatcher = OkDownload.with().downloadDispatcher(); if (dispatcher.getClass() != DownloadDispatcher.class) { throw new IllegalStateException( "The current dispatcher is " + dispatcher + " not DownloadDispatcher exactly!"); } maxParallelRunningCount = Math.max(1, maxParallelRunningCount); dispatcher.maxParallelRunningCount = maxParallelRunningCount; } 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 setMaxParallelRunningCount() { doReturn(mock(MockDownloadDispatcher.class)).when(OkDownload.with()).downloadDispatcher(); thrown.expect(IllegalStateException.class); DownloadDispatcher.setMaxParallelRunningCount(1); doReturn(dispatcher).when(OkDownload.with()).breakpointStore(); DownloadDispatcher.setMaxParallelRunningCount(0); assertThat(dispatcher.maxParallelRunningCount).isEqualTo(1); DownloadDispatcher.setMaxParallelRunningCount(2); assertThat(dispatcher.maxParallelRunningCount).isEqualTo(2); }