TaskDetailPresenter implements TaskDetailContract.Presenter { @Override public void editTask() { if (null == mTaskId || mTaskId.isEmpty()) { mTaskDetailView.showMissingTask(); return; } mTaskDetailView.showEditTask(mTaskId); } TaskDetailPresenter(@Nullable String taskId,
                               @NonNull TasksRepository tasksRepository,
                               @NonNull TaskDetailContract.View taskDetailView); @Override void start(); @Override void editTask(); @Override void deleteTask(); @Override void completeTask(); @Override void activateTask();  }
@Test public void activeTaskIsShownWhenEditing() { mTaskDetailPresenter = new TaskDetailPresenter( ACTIVE_TASK.getId(), mTasksRepository, mTaskDetailView); mTaskDetailPresenter.editTask(); verify(mTaskDetailView).showEditTask(ACTIVE_TASK.getId()); }
@Test public void invalidTaskIsNotShownWhenEditing() { mTaskDetailPresenter = new TaskDetailPresenter( INVALID_TASK_ID, mTasksRepository, mTaskDetailView); mTaskDetailPresenter.editTask(); verify(mTaskDetailView, never()).showEditTask(INVALID_TASK_ID); verify(mTaskDetailView).showMissingTask(); }