### Question:
ProcessFileStrategy { public void discardProcess(@NonNull DownloadTask task) throws IOException { final File file = task.getFile(); if (file == null) return; if (file.exists() && !file.delete()) { throw new IOException("Delete file failed!"); } }  @NonNull MultiPointOutputStream createProcessStream(@NonNull DownloadTask task,
                                                               @NonNull BreakpointInfo info,
                                                               @NonNull DownloadStore store); void completeProcessStream(@NonNull MultiPointOutputStream processOutputStream,
                                      @NonNull DownloadTask task); void discardProcess(@NonNull DownloadTask task); @NonNull FileLock getFileLock(); boolean isPreAllocateLength(@NonNull DownloadTask task);  }### Answer:
@Test public void discardProcess() throws IOException { final File existFile = new File("./exist-path"); existFile.createNewFile(); when(task.getFile()).thenReturn(existFile); strategy.discardProcess(task); assertThat(existFile.exists()).isFalse(); }
@Test(expected = IOException.class) public void discardProcess_deleteFailed() throws IOException { final File file = mock(File.class); when(task.getFile()).thenReturn(file); when(file.exists()).thenReturn(true); when(file.delete()).thenReturn(false); strategy.discardProcess(task); }