### Question:
Listener4Assist implements ListenerAssist { public void infoReady(DownloadTask task, BreakpointInfo info, boolean fromBreakpoint) { final Listener4Model model = modelHandler.addAndGetModel(task, info); if (assistExtend != null && assistExtend .dispatchInfoReady(task, info, fromBreakpoint, model)) { return; } if (callback != null) callback.infoReady(task, info, fromBreakpoint, model); } Listener4Assist(ListenerModelHandler<T> handler);  Listener4Assist(ListenerModelHandler.ModelCreator<T> creator); void setCallback(@NonNull Listener4Callback callback); void setAssistExtend(@NonNull AssistExtend assistExtend); AssistExtend getAssistExtend(); void infoReady(DownloadTask task, BreakpointInfo info, boolean fromBreakpoint); void fetchProgress(DownloadTask task, int blockIndex, long increaseBytes); void fetchEnd(DownloadTask task, int blockIndex); synchronized void taskEnd(DownloadTask task, EndCause cause,
                                     @Nullable Exception realCause); @Override boolean isAlwaysRecoverAssistModel(); @Override void setAlwaysRecoverAssistModel(boolean isAlwaysRecoverAssistModel); @Override void setAlwaysRecoverAssistModelIfNotSet(boolean isAlwaysRecoverAssistModel);  }### Answer:
@Test public void infoReady_dispatch() { when(assistExtend.dispatchInfoReady(eq(task), eq(info), eq(true), any(Listener4Assist.Listener4Model.class))) .thenReturn(true); assist.infoReady(task, info, true); verify(assist.callback, never()).infoReady(eq(task), eq(info), eq(true), any(Listener4Assist.Listener4Model.class)); verify(handler).addAndGetModel(eq(task), eq(info)); }
@Test public void infoReady_noDispatch() { when(handler.addAndGetModel(task, info)).thenReturn(model); when(assistExtend.dispatchInfoReady(eq(task), eq(info), eq(true), any(Listener4Assist.Listener4Model.class))) .thenReturn(false); assist.infoReady(task, info, true); verify(assist.callback).infoReady(eq(task), eq(info), eq(true), eq(model)); verify(handler).addAndGetModel(eq(task), eq(info)); }