### Question:
AcademyViewModel extends ViewModel { public LiveData<Resource<PagedList<CourseEntity>>> getCourses() { return academyRepository.getAllCourses(); } AcademyViewModel(AcademyRepository mAcademyRepository); LiveData<Resource<PagedList<CourseEntity>>> getCourses();  }### Answer:
@Test public void getCourses() { Resource<List<CourseEntity>> dummyCourses = Resource.success(DataDummy.generateDummyCourses()); MutableLiveData<Resource<List<CourseEntity>>> courses = new MutableLiveData<>(); courses.setValue(dummyCourses); when(academyRepository.getAllCourses()).thenReturn(courses); List<CourseEntity> courseEntities = viewModel.getCourses().getValue().data; verify(academyRepository).getAllCourses(); assertNotNull(courseEntities); assertEquals(5, courseEntities.size()); viewModel.getCourses().observeForever(observer); verify(observer).onChanged(dummyCourses); }