### Question:
BreakpointInfo { public boolean isSameFrom(DownloadTask task) { if (!parentFile.equals(task.getParentFile())) { return false; } if (!url.equals(task.getUrl())) return false; final String otherFilename = task.getFilename(); if (otherFilename != null && otherFilename.equals(filenameHolder.get())) return true; if (taskOnlyProvidedParentPath) { if (!task.isFilenameFromResponse()) return false; return otherFilename == null || otherFilename.equals(filenameHolder.get()); } return false; } BreakpointInfo(int id, @NonNull String url, @NonNull File parentFile,
                          @Nullable String filename);   BreakpointInfo(int id, @NonNull String url, @NonNull File parentFile,
                   @Nullable String filename, boolean taskOnlyProvidedParentPath); int getId(); void setChunked(boolean chunked); void addBlock(BlockInfo blockInfo); boolean isChunked(); boolean isLastBlock(int blockIndex); boolean isSingleBlock(); BlockInfo getBlock(int blockIndex); void resetInfo(); void resetBlockInfos(); int getBlockCount(); void setEtag(String etag); long getTotalOffset(); long getTotalLength(); @Nullable String getEtag(); String getUrl(); @Nullable String getFilename(); DownloadStrategy.FilenameHolder getFilenameHolder(); @Nullable File getFile(); BreakpointInfo copy(); BreakpointInfo copyWithReplaceId(int replaceId); void reuseBlocks(BreakpointInfo info); BreakpointInfo copyWithReplaceIdAndUrl(int replaceId, String newUrl); boolean isSameFrom(DownloadTask task); @Override String toString();  }### Answer:
@Test public void isSameFrom() { BreakpointInfo info = new BreakpointInfo(1, "url", new File("p-path"), "filename"); DownloadTask task = mock(DownloadTask.class); when(task.getUrl()).thenReturn("url"); when(task.getParentFile()).thenReturn(new File("p-path")); assertThat(info.isSameFrom(task)).isFalse(); when(task.getFilename()).thenReturn("filename"); assertThat(info.isSameFrom(task)).isTrue(); when(task.isFilenameFromResponse()).thenReturn(true); assertThat(info.isSameFrom(task)).isTrue(); info = new BreakpointInfo(1, "url", new File("p-path"), null); assertThat(info.isSameFrom(task)).isFalse(); when(task.isFilenameFromResponse()).thenReturn(false); assertThat(info.isSameFrom(task)).isFalse(); when(task.getFilename()).thenReturn(null); when(task.isFilenameFromResponse()).thenReturn(true); assertThat(info.isSameFrom(task)).isTrue(); when(task.getUrl()).thenReturn("not-same-url"); assertThat(info.isSameFrom(task)).isFalse(); }