### Question:
MultiPointOutputStream { public synchronized void write(int blockIndex, byte[] bytes, int length) throws IOException { if (canceled) return; outputStream(blockIndex).write(bytes, 0, length); allNoSyncLength.addAndGet(length); noSyncLengthMap.get(blockIndex).addAndGet(length); inspectAndPersist(); } 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 public void write() throws IOException { doReturn(stream0).when(multiPointOutputStream).outputStream(anyInt()); doNothing().when(multiPointOutputStream).inspectAndPersist(); multiPointOutputStream.noSyncLengthMap.put(1, new AtomicLong()); multiPointOutputStream.noSyncLengthMap.put(2, new AtomicLong()); multiPointOutputStream.write(2, bytes, 16); verify(stream0).write(eq(bytes), eq(0), eq(16)); assertThat(multiPointOutputStream.allNoSyncLength.get()).isEqualTo(16); assertThat(multiPointOutputStream.noSyncLengthMap.get(1).get()).isEqualTo(0); assertThat(multiPointOutputStream.noSyncLengthMap.get(2).get()).isEqualTo(16); verify(multiPointOutputStream).inspectAndPersist(); }