### Question:
MultiPointOutputStream { public void done(int blockIndex) throws IOException { noMoreStreamList.add(blockIndex); try { if (syncException != null) throw syncException; if (syncFuture != null && !syncFuture.isDone()) { final AtomicLong noSyncLength = noSyncLengthMap.get(blockIndex); if (noSyncLength != null && noSyncLength.get() > 0) { inspectStreamState(doneState); final boolean isNoMoreStream = doneState.isNoMoreStream; ensureSync(isNoMoreStream, blockIndex); } } else { if (syncFuture == null) { Util.d(TAG, "OutputStream done but no need to ensure sync, because the " + "sync job not run yet. task[" + task.getId() + "] block[" + blockIndex + "]"); } else { Util.d(TAG, "OutputStream done but no need to ensure sync, because the " + "syncFuture.isDone[" + syncFuture.isDone() + "] task[" + task.getId() + "] block[" + blockIndex + "]"); } } } finally { close(blockIndex); } } MultiPointOutputStream(@NonNull final DownloadTask task,
                           @NonNull BreakpointInfo info,
                           @NonNull DownloadStore store,
                           @Nullable Runnable syncRunnable);  MultiPointOutputStream(@NonNull DownloadTask task,
                                  @NonNull BreakpointInfo info,
                                  @NonNull DownloadStore store); synchronized void write(int blockIndex, byte[] bytes, int length); void cancelAsync(); synchronized void cancel(); void done(int blockIndex); void inspectComplete(int blockIndex); void setRequireStreamBlocks(List<Integer> requireStreamBlocks); void catchBlockConnectException(int blockIndex);  }### Answer:
@Test(expected = IOException.class) public void done_syncException() throws IOException { multiPointOutputStream.syncException = new IOException(); multiPointOutputStream.done(1); }