@Test public void completeTask_ShowsTaskMarkedComplete() { Task task = new Task("Details Requested", "For this task"); mTasksPresenter.completeTask(task); verify(mTasksRepository).completeTask(eq(task.getId())); verify(mTasksView).showTaskMarkedComplete(); }
@Override public void completeTask(@NonNull Task completedTask) { checkNotNull(completedTask, "completedTask cannot be null!"); mUseCaseHandler.execute(mCompleteTask, new CompleteTask.RequestValues( completedTask.getId()), new UseCase.UseCaseCallback<CompleteTask.ResponseValue>() { @Override public void onSuccess(CompleteTask.ResponseValue response) { mTasksView.showTaskMarkedComplete(); loadTasks(false, false); } @Override public void onError(Error error) { mTasksView.showLoadingTasksError(); } }); }
TasksPresenter implements TasksContract.Presenter { @Override public void completeTask(@NonNull Task completedTask) { checkNotNull(completedTask, "completedTask cannot be null!"); mUseCaseHandler.execute(mCompleteTask, new CompleteTask.RequestValues( completedTask.getId()), new UseCase.UseCaseCallback<CompleteTask.ResponseValue>() { @Override public void onSuccess(CompleteTask.ResponseValue response) { mTasksView.showTaskMarkedComplete(); loadTasks(false, false); } @Override public void onError(Error error) { mTasksView.showLoadingTasksError(); } }); } }
TasksPresenter implements TasksContract.Presenter { @Override public void completeTask(@NonNull Task completedTask) { checkNotNull(completedTask, "completedTask cannot be null!"); mUseCaseHandler.execute(mCompleteTask, new CompleteTask.RequestValues( completedTask.getId()), new UseCase.UseCaseCallback<CompleteTask.ResponseValue>() { @Override public void onSuccess(CompleteTask.ResponseValue response) { mTasksView.showTaskMarkedComplete(); loadTasks(false, false); } @Override public void onError(Error error) { mTasksView.showLoadingTasksError(); } }); } TasksPresenter(@NonNull UseCaseHandler useCaseHandler,
            @NonNull TasksContract.View tasksView, @NonNull GetTasks getTasks,
            @NonNull CompleteTask completeTask, @NonNull ActivateTask activateTask,
            @NonNull ClearCompleteTasks clearCompleteTasks); }
TasksPresenter implements TasksContract.Presenter { @Override public void completeTask(@NonNull Task completedTask) { checkNotNull(completedTask, "completedTask cannot be null!"); mUseCaseHandler.execute(mCompleteTask, new CompleteTask.RequestValues( completedTask.getId()), new UseCase.UseCaseCallback<CompleteTask.ResponseValue>() { @Override public void onSuccess(CompleteTask.ResponseValue response) { mTasksView.showTaskMarkedComplete(); loadTasks(false, false); } @Override public void onError(Error error) { mTasksView.showLoadingTasksError(); } }); } TasksPresenter(@NonNull UseCaseHandler useCaseHandler,
            @NonNull TasksContract.View tasksView, @NonNull GetTasks getTasks,
            @NonNull CompleteTask completeTask, @NonNull ActivateTask activateTask,
            @NonNull ClearCompleteTasks clearCompleteTasks); @Override void start(); @Override void result(int requestCode, int resultCode); @Override void loadTasks(boolean forceUpdate); @Override void addNewTask(); @Override void openTaskDetails(@NonNull Task requestedTask); @Override void completeTask(@NonNull Task completedTask); @Override void activateTask(@NonNull Task activeTask); @Override void clearCompletedTasks(); @Override void setFiltering(TasksFilterType requestType); @Override TasksFilterType getFiltering(); }
TasksPresenter implements TasksContract.Presenter { @Override public void completeTask(@NonNull Task completedTask) { checkNotNull(completedTask, "completedTask cannot be null!"); mUseCaseHandler.execute(mCompleteTask, new CompleteTask.RequestValues( completedTask.getId()), new UseCase.UseCaseCallback<CompleteTask.ResponseValue>() { @Override public void onSuccess(CompleteTask.ResponseValue response) { mTasksView.showTaskMarkedComplete(); loadTasks(false, false); } @Override public void onError(Error error) { mTasksView.showLoadingTasksError(); } }); } TasksPresenter(@NonNull UseCaseHandler useCaseHandler,
            @NonNull TasksContract.View tasksView, @NonNull GetTasks getTasks,
            @NonNull CompleteTask completeTask, @NonNull ActivateTask activateTask,
            @NonNull ClearCompleteTasks clearCompleteTasks); @Override void start(); @Override void result(int requestCode, int resultCode); @Override void loadTasks(boolean forceUpdate); @Override void addNewTask(); @Override void openTaskDetails(@NonNull Task requestedTask); @Override void completeTask(@NonNull Task completedTask); @Override void activateTask(@NonNull Task activeTask); @Override void clearCompletedTasks(); @Override void setFiltering(TasksFilterType requestType); @Override TasksFilterType getFiltering();  }