AcademyRepository implements AcademyDataSource { @Override public LiveData<PagedList<CourseEntity>> getBookmarkedCourses() { PagedList.Config config = new PagedList.Config.Builder() .setEnablePlaceholders(false) .setInitialLoadSizeHint(4) .setPageSize(4) .build(); return new LivePagedListBuilder<>(localDataSource.getBookmarkedCourses(), config).build(); } private  AcademyRepository(@NonNull RemoteDataSource remoteDataSource, @NonNull LocalDataSource localDataSource, AppExecutors appExecutors); static AcademyRepository getInstance(RemoteDataSource remoteData, LocalDataSource localDataSource, AppExecutors appExecutors); @Override LiveData<Resource<PagedList<CourseEntity>>> getAllCourses(); @Override LiveData<PagedList<CourseEntity>> getBookmarkedCourses(); @Override LiveData<Resource<CourseWithModule>> getCourseWithModules(final String courseId); @Override LiveData<Resource<List<ModuleEntity>>> getAllModulesByCourse(String courseId); @Override LiveData<Resource<ModuleEntity>> getContent(String moduleId); @Override void setCourseBookmark(CourseEntity course, boolean state); @Override void setReadModule(ModuleEntity module);  }
@Test public void getBookmarkedCourses() { MutableLiveData<List<CourseEntity>> dummyCourses = new MutableLiveData<>(); dummyCourses.setValue(DataDummy.generateDummyCourses()); when(local.getBookmarkedCourses()).thenReturn(dummyCourses); List<CourseEntity> courseEntities = LiveDataTestUtil.getValue(academyRepository.getBookmarkedCourses()); verify(local).getBookmarkedCourses(); assertNotNull(courseEntities); assertEquals(courseResponses.size(), courseEntities.size()); }