### Question:
MultiPointOutputStream { void inspectStreamState(StreamsState state) { state.newNoMoreStreamBlockList.clear(); @SuppressWarnings("unchecked") final List<Integer> clonedList = (List<Integer>) noMoreStreamList.clone(); final Set<Integer> uniqueBlockList = new HashSet<>(clonedList); final int noMoreStreamBlockCount = uniqueBlockList.size(); if (noMoreStreamBlockCount != requireStreamBlocks.size()) { Util.d(TAG, "task[" + task.getId() + "] current need fetching block count " + requireStreamBlocks.size() + " is not equal to no more stream block count " + noMoreStreamBlockCount); state.isNoMoreStream = false; } else { Util.d(TAG, "task[" + task.getId() + "] current need fetching block count " + requireStreamBlocks.size() + " is equal to no more stream block count " + noMoreStreamBlockCount); state.isNoMoreStream = true; } final SparseArray<DownloadOutputStream> streamMap = outputStreamMap.clone(); final int size = streamMap.size(); for (int i = 0; i < size; i++) { final int blockIndex = streamMap.keyAt(i); if (noMoreStreamList.contains(blockIndex) && !state.noMoreStreamBlockList.contains(blockIndex)) { state.noMoreStreamBlockList.add(blockIndex); state.newNoMoreStreamBlockList.add(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 public void inspectStreamState() { final MultiPointOutputStream.StreamsState state = new MultiPointOutputStream.StreamsState(); multiPointOutputStream.outputStreamMap.put(0, stream0); multiPointOutputStream.outputStreamMap.put(0, stream0); multiPointOutputStream.outputStreamMap.put(1, stream0); multiPointOutputStream.outputStreamMap.put(1, stream0); multiPointOutputStream.requireStreamBlocks = new ArrayList<Integer>() {{ add(0); add(1); }}; multiPointOutputStream.inspectStreamState(state); assertThat(state.isNoMoreStream).isFalse(); assertThat(state.noMoreStreamBlockList).isEmpty(); assertThat(state.newNoMoreStreamBlockList).isEmpty(); multiPointOutputStream.noMoreStreamList.add(1); multiPointOutputStream.inspectStreamState(state); assertThat(state.isNoMoreStream).isFalse(); assertThat(state.noMoreStreamBlockList).containsExactly(1); assertThat(state.newNoMoreStreamBlockList).containsExactly(1); multiPointOutputStream.noMoreStreamList.add(0); multiPointOutputStream.inspectStreamState(state); assertThat(state.isNoMoreStream).isTrue(); assertThat(state.noMoreStreamBlockList).containsExactly(1, 0); assertThat(state.newNoMoreStreamBlockList).containsExactly(0); multiPointOutputStream.inspectStreamState(state); assertThat(state.isNoMoreStream).isTrue(); assertThat(state.noMoreStreamBlockList).containsExactly(1, 0); assertThat(state.newNoMoreStreamBlockList).isEmpty(); }