@Test public void getCourses() { when(academyRepository.getAllCourses()).thenReturn(DataDummy.generateDummyCourses()); List<CourseEntity> courseEntities = viewModel.getCourses(); verify(academyRepository).getAllCourses(); assertNotNull(courseEntities); assertEquals(5, courseEntities.size()); }
public LiveData<List<CourseEntity>> getCourses() { return academyRepository.getAllCourses(); }
AcademyViewModel extends ViewModel { public LiveData<List<CourseEntity>> getCourses() { return academyRepository.getAllCourses(); } }
AcademyViewModel extends ViewModel { public LiveData<List<CourseEntity>> getCourses() { return academyRepository.getAllCourses(); } AcademyViewModel(AcademyRepository mAcademyRepository); }
AcademyViewModel extends ViewModel { public LiveData<List<CourseEntity>> getCourses() { return academyRepository.getAllCourses(); } AcademyViewModel(AcademyRepository mAcademyRepository); LiveData<List<CourseEntity>> getCourses(); }
AcademyViewModel extends ViewModel { public LiveData<List<CourseEntity>> getCourses() { return academyRepository.getAllCourses(); } AcademyViewModel(AcademyRepository mAcademyRepository); LiveData<List<CourseEntity>> getCourses();  }