### Question:
ListenerModelHandler implements
        ListenerAssist { @NonNull T removeOrCreate(@NonNull DownloadTask task, @Nullable BreakpointInfo info) { final int id = task.getId(); T model; synchronized (this) { if (singleTaskModel != null && singleTaskModel.getId() == id) { model = singleTaskModel; singleTaskModel = null; } else { model = modelList.get(id); modelList.remove(id); } } if (model == null) { model = creator.create(id); if (info != null) { model.onInfoValid(info); } } return model; } ListenerModelHandler(ModelCreator<T> creator); boolean isAlwaysRecoverAssistModel(); void setAlwaysRecoverAssistModel(boolean isAlwaysRecoverModel); @Override void setAlwaysRecoverAssistModelIfNotSet(boolean isAlwaysRecoverAssistModel);  }### Answer:
@Test public void removeOrCreate_withInfo() { handler.singleTaskModel = model; assertThat(handler.removeOrCreate(task, info)).isEqualTo(model); verify(creator, never()).create(anyInt()); verify(model, never()).onInfoValid(eq(info)); handler.singleTaskModel = null; handler.modelList.put(task.getId(), model); assertThat(handler.removeOrCreate(task, info)).isEqualTo(model); verify(creator, never()).create(anyInt()); verify(model, never()).onInfoValid(eq(info)); handler.modelList.clear(); assertThat(handler.removeOrCreate(task, info)).isEqualTo(model); verify(creator).create(anyInt()); verify(model).onInfoValid(eq(info)); }
@Test public void removeOrCreate_noInfo() { handler.modelList.clear(); assertThat(handler.removeOrCreate(task, null)).isEqualTo(model); verify(creator).create(anyInt()); verify(model, never()).onInfoValid(any(BreakpointInfo.class)); }