@Test public void getModules() { when(academyRepository.getAllModulesByCourse(courseId)).thenReturn(DataDummy.generateDummyModules(courseId)); List<ModuleEntity> moduleEntities = viewModel.getModules(); verify(academyRepository).getAllModulesByCourse(courseId); assertNotNull(moduleEntities); assertEquals(7, moduleEntities.size()); }
public LiveData<List<ModuleEntity>> getModules() { return academyRepository.getAllModulesByCourse(courseId); }
DetailCourseViewModel extends ViewModel { public LiveData<List<ModuleEntity>> getModules() { return academyRepository.getAllModulesByCourse(courseId); } }
DetailCourseViewModel extends ViewModel { public LiveData<List<ModuleEntity>> getModules() { return academyRepository.getAllModulesByCourse(courseId); } DetailCourseViewModel(AcademyRepository mAcademyRepository); }
DetailCourseViewModel extends ViewModel { public LiveData<List<ModuleEntity>> getModules() { return academyRepository.getAllModulesByCourse(courseId); } DetailCourseViewModel(AcademyRepository mAcademyRepository); void setSelectedCourse(String courseId); LiveData<CourseEntity> getCourse(); LiveData<List<ModuleEntity>> getModules(); }
DetailCourseViewModel extends ViewModel { public LiveData<List<ModuleEntity>> getModules() { return academyRepository.getAllModulesByCourse(courseId); } DetailCourseViewModel(AcademyRepository mAcademyRepository); void setSelectedCourse(String courseId); LiveData<CourseEntity> getCourse(); LiveData<List<ModuleEntity>> getModules();  }