### Question:
BreakpointRemoteCheck { public void check() throws IOException { final DownloadStrategy downloadStrategy = OkDownload.with().downloadStrategy(); ConnectTrial connectTrial = createConnectTrial(); connectTrial.executeTrial(); final boolean isAcceptRange = connectTrial.isAcceptRange(); final boolean isChunked = connectTrial.isChunked(); final long instanceLength = connectTrial.getInstanceLength(); final String responseEtag = connectTrial.getResponseEtag(); final String responseFilename = connectTrial.getResponseFilename(); final int responseCode = connectTrial.getResponseCode(); downloadStrategy.validFilenameFromResponse(responseFilename, task, info); info.setChunked(isChunked); info.setEtag(responseEtag); if (OkDownload.with().downloadDispatcher().isFileConflictAfterRun(task)) { throw FileBusyAfterRunException.SIGNAL; } final ResumeFailedCause resumeFailedCause = downloadStrategy .getPreconditionFailedCause(responseCode, info.getTotalOffset() != 0, info, responseEtag); this.resumable = resumeFailedCause == null; this.failedCause = resumeFailedCause; this.instanceLength = instanceLength; this.acceptRange = isAcceptRange; if (!isTrialSpecialPass(responseCode, instanceLength, resumable) && downloadStrategy.isServerCanceled(responseCode, info.getTotalOffset() != 0)) { throw new ServerCanceledException(responseCode, info.getTotalOffset()); } } BreakpointRemoteCheck(@NonNull DownloadTask task,
                                 @NonNull BreakpointInfo info); @Override String toString(); @Nullable ResumeFailedCause getCause(); @NonNull ResumeFailedCause getCauseOrThrow(); boolean isResumable(); boolean isAcceptRange(); long getInstanceLength(); void check();  }### Answer:
@Test public void check_assembleBasicData() throws IOException { mockOkDownload(); check.check(); final DownloadStrategy strategy = OkDownload.with().downloadStrategy(); verify(strategy).validFilenameFromResponse(eq(responseFilename), eq(task), eq(info)); verify(info).setChunked(eq(connectTrial.isChunked())); verify(info).setEtag(eq(responseEtag)); }
@Test(expected = FileBusyAfterRunException.class) public void check_fileConflictAfterRun() throws IOException { mockOkDownload(); when(OkDownload.with().downloadDispatcher().isFileConflictAfterRun(eq(task))) .thenReturn(true); check.check(); }
@Test(expected = ServerCanceledException.class) public void check_serverCanceled() throws IOException { mockOkDownload(); when(OkDownload.with().downloadStrategy() .isServerCanceled(0, false)) .thenReturn(true); check.check(); }