### Question:
BreakpointLocalCheck { public boolean isOutputStreamSupportResume() { final boolean supportSeek = OkDownload.with().outputStreamFactory().supportSeek(); if (supportSeek) return true; if (info.getBlockCount() != 1) return false; if (OkDownload.with().processFileStrategy().isPreAllocateLength(task)) return false; return true; } BreakpointLocalCheck(@NonNull DownloadTask task, @NonNull BreakpointInfo info,
                                long responseInstanceLength); boolean isDirty(); @NonNull ResumeFailedCause getCauseOrThrow(); boolean isInfoRightToResume(); boolean isOutputStreamSupportResume(); boolean isFileExistToResume(); void check(); @Override String toString();  }### Answer:
@Test public void isOutputStreamSupportResume_support() throws IOException { mockOkDownload(); final DownloadOutputStream.Factory factory = OkDownload.with().outputStreamFactory(); when(factory.supportSeek()).thenReturn(true); assertThat(check.isOutputStreamSupportResume()).isTrue(); when(factory.supportSeek()).thenReturn(false); when(info.getBlockCount()).thenReturn(1); final ProcessFileStrategy strategy = OkDownload.with().processFileStrategy(); when(strategy.isPreAllocateLength(task)).thenReturn(false); assertThat(check.isOutputStreamSupportResume()).isTrue(); }
@Test public void isOutputStreamSupportResume_notSupport() throws IOException { mockOkDownload(); final DownloadOutputStream.Factory factory = OkDownload.with().outputStreamFactory(); when(factory.supportSeek()).thenReturn(false); when(info.getBlockCount()).thenReturn(2); assertThat(check.isOutputStreamSupportResume()).isFalse(); when(info.getBlockCount()).thenReturn(1); final ProcessFileStrategy strategy = OkDownload.with().processFileStrategy(); doReturn(true).when(strategy).isPreAllocateLength(task); assertThat(check.isOutputStreamSupportResume()).isFalse(); }