### Question:
ListenerModelHandler implements
        ListenerAssist { @NonNull T addAndGetModel(@NonNull DownloadTask task, @Nullable BreakpointInfo info) { T model = creator.create(task.getId()); synchronized (this) { if (singleTaskModel == null) { singleTaskModel = model; } else { modelList.put(task.getId(), model); } 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 addAndGetModel_provideInfo() { final ListenerModelHandler.ListenerModel model = handler.addAndGetModel(task, info); assertThat(model).isEqualTo(this.model); verify(creator).create(anyInt()); assertThat(handler.singleTaskModel).isEqualTo(model); assertThat(handler.modelList.size()).isZero(); verify(model).onInfoValid(eq(info)); handler.addAndGetModel(task, info); assertThat(handler.modelList.size()).isOne(); }
@Test public void addAndGetModel_noInfo() { final ListenerModelHandler.ListenerModel model = handler.addAndGetModel(task, null); assertThat(model).isEqualTo(this.model); verify(creator).create(anyInt()); assertThat(handler.singleTaskModel).isEqualTo(model); assertThat(handler.modelList.size()).isZero(); verify(model, never()).onInfoValid(eq(info)); }