TasksViewModel extends BaseViewModel<TasksViewModel.State> { protected void onTaskCreate(Task task) { mTasks.add(task); setState(State.CREATED_TASK, Constants.Key.INDEX, mTasks.size() - 1); } TasksViewModel(); @Override void onCreate(); List<Task> getTasks(); void reloadData();  }
@Test public void testOnTaskCreate() throws Exception { Task task = new Task("title", "description"); List<Task> tasks = mTasksViewModel.getTasks(); mTasksViewModel.onTaskCreate(task); verify(mTasksViewModel, times(1)).setState(eq(TasksViewModel.State.CREATED_TASK), eq(Constants.Key.INDEX), eq(tasks.size() - 1)); }