AddEditTaskPresenter implements AddEditTaskContract.Presenter { @Override public void createTask(String title, String description) { Task newTask = new Task(title, description); if (newTask.isEmpty()) { mAddTaskView.showEmptyTaskError(); } else { mUseCaseHandler.execute(mSaveTask, new SaveTask.RequestValues(newTask), new UseCase.UseCaseCallback<SaveTask.ResponseValue>() { @Override public void onSuccess(SaveTask.ResponseValue response) { mAddTaskView.showTasksList(); } @Override public void onError(Error error) { showSaveError(); } }); } } AddEditTaskPresenter(@NonNull UseCaseHandler useCaseHandler, @Nullable String taskId,
            @NonNull AddEditTaskContract.View addTaskView, @NonNull GetTask getTask,
            @NonNull SaveTask saveTask); @Override void start(); @Override void createTask(String title, String description); @Override void updateTask(String title, String description); @Override void populateTask();  }
@Test public void saveNewTaskToRepository_showsSuccessMessageUi() { mAddEditTaskPresenter = givenEditTaskPresenter("1"); mAddEditTaskPresenter.createTask("New Task Title", "Some Task Description"); verify(mTasksRepository).saveTask(any(Task.class)); verify(mAddEditTaskView).showTasksList(); }