TasksViewModel extends BaseViewModel<TasksViewModel.State> { protected void onActiveTaskItemClick(Task task) { manageSubscription(mTaskService.active(task.getId()) .compose(Transformer.applyComputationScheduler()) .subscribe(aVoid -> setState(State.ACTIVE_TASK), Throwable::printStackTrace), UnsubscribeLifeCycle.DESTROY); } TasksViewModel(); @Override void onCreate(); List<Task> getTasks(); void reloadData();  }
@Test public void testOnActiveTaskItemClick() throws Exception { Task task = new Task("title", "description"); doReturn(Observable.just(null)).when(mTasksViewModel.mTaskService).active(anyString()); mTasksViewModel.onActiveTaskItemClick(task); verify(mTasksViewModel, times(1)).setState(eq(TasksViewModel.State.ACTIVE_TASK)); }