@Test public void getBookmark() { ArrayList<CourseEntity> dummyCourses = DataDummy.generateDummyCourses(); MutableLiveData<List<CourseEntity>> courses = new MutableLiveData<>(); courses.setValue(dummyCourses); when(academyRepository.getBookmarkedCourses()).thenReturn(courses); List<CourseEntity> courseEntities = viewModel.getBookmarks().getValue(); verify(academyRepository).getBookmarkedCourses(); assertNotNull(courseEntities); assertEquals(5, courseEntities.size()); viewModel.getBookmarks().observeForever(observer); verify(observer).onChanged(dummyCourses); }
public LiveData<List<CourseEntity>> getBookmarks() { return academyRepository.getBookmarkedCourses(); }
BookmarkViewModel extends ViewModel { public LiveData<List<CourseEntity>> getBookmarks() { return academyRepository.getBookmarkedCourses(); } }
BookmarkViewModel extends ViewModel { public LiveData<List<CourseEntity>> getBookmarks() { return academyRepository.getBookmarkedCourses(); } BookmarkViewModel(AcademyRepository mAcademyRepository); }
BookmarkViewModel extends ViewModel { public LiveData<List<CourseEntity>> getBookmarks() { return academyRepository.getBookmarkedCourses(); } BookmarkViewModel(AcademyRepository mAcademyRepository); LiveData<List<CourseEntity>> getBookmarks(); }
BookmarkViewModel extends ViewModel { public LiveData<List<CourseEntity>> getBookmarks() { return academyRepository.getBookmarkedCourses(); } BookmarkViewModel(AcademyRepository mAcademyRepository); LiveData<List<CourseEntity>> getBookmarks();  }