### Question:
DownloadTask extends IdentifiedTask implements Comparable<DownloadTask> { public void replaceListener(@NonNull DownloadListener listener) { this.listener = listener; } DownloadTask(String url, Uri uri, int priority, int readBufferSize, int flushBufferSize,
                        int syncBufferSize, int syncBufferIntervalMills,
                        boolean autoCallbackToUIThread, int minIntervalMillisCallbackProcess,
                        Map<String, List<String>> headerMapFields, @Nullable String filename,
                        boolean passIfAlreadyCompleted, boolean wifiRequired,
                        Boolean filenameFromResponse, @Nullable Integer connectionCount,
                        @Nullable Boolean isPreAllocateLength); boolean isFilenameFromResponse(); @Nullable Map<String, List<String>> getHeaderMapFields(); @Override int getId(); @Nullable String getFilename(); boolean isPassIfAlreadyCompleted(); boolean isWifiRequired(); DownloadStrategy.FilenameHolder getFilenameHolder(); Uri getUri(); @NonNull String getUrl(); void setRedirectLocation(@Nullable String redirectUrl); @Nullable String getRedirectLocation(); @Override @NonNull File getParentFile(); @Nullable File getFile(); int getReadBufferSize(); int getFlushBufferSize(); int getSyncBufferSize(); int getSyncBufferIntervalMills(); boolean isAutoCallbackToUIThread(); int getMinIntervalMillisCallbackProcess(); @Nullable Integer getSetConnectionCount(); @Nullable Boolean getSetPreAllocateLength(); int getConnectionCount(); Object getTag(int key); Object getTag(); @Nullable BreakpointInfo getInfo(); synchronized DownloadTask addTag(int key, Object value); synchronized void removeTag(int key); synchronized void removeTag(); void setTag(Object tag); void replaceListener(@NonNull DownloadListener listener); static void enqueue(DownloadTask[] tasks, DownloadListener listener); void enqueue(DownloadListener listener); void execute(DownloadListener listener); void cancel(); static void cancel(DownloadTask[] tasks); DownloadListener getListener(); int getPriority(); Builder toBuilder(String anotherUrl, Uri anotherUri); Builder toBuilder(); void setTags(DownloadTask oldTask); @Override int compareTo(@NonNull DownloadTask o); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); static MockTaskForCompare mockTaskForCompare(int id); @NonNull MockTaskForCompare mock(int id);  }### Answer:
@Test public void replaceListener() { DownloadTask task = new DownloadTask.Builder("https: new File(parentPath, filename)).build(); final DownloadListener listener = mock(DownloadListener.class); task.enqueue(listener); assertThat(task.getListener()).isEqualTo(listener); final DownloadListener another = mock(DownloadListener.class); task.replaceListener(another); assertThat(task.getListener()).isEqualTo(another); }