@Test public void testAddStudent() { String studentToAdd = "German"; viewModel.addStudent(studentToAdd); Mockito.verify(repository).addStudent(studentToAdd); }
void addStudent(@NonNull String student) { repository.addStudent(student); }
MainActivityViewModel extends ViewModel { void addStudent(@NonNull String student) { repository.addStudent(student); } }
MainActivityViewModel extends ViewModel { void addStudent(@NonNull String student) { repository.addStudent(student); } MainActivityViewModel(@NonNull Repository repository); }
MainActivityViewModel extends ViewModel { void addStudent(@NonNull String student) { repository.addStudent(student); } MainActivityViewModel(@NonNull Repository repository);  }
MainActivityViewModel extends ViewModel { void addStudent(@NonNull String student) { repository.addStudent(student); } MainActivityViewModel(@NonNull Repository repository);   }