### Question:
TransactionalTopicFetchService extends AbstractTransactionalEntityService<Topic, TopicDao> implements TopicFetchService, PluginTopicFetchService { @Override public Page<Topic> getRecentTopics(String page) { int pageSize = userService.getCurrentUser().getPageSize(); PageRequest pageRequest = new PageRequest(page, pageSize); DateTime date24HoursAgo = new DateTime().minusDays(1); return this.getDao().getTopicsUpdatedSince(date24HoursAgo, pageRequest, userService.getCurrentUser()); } TransactionalTopicFetchService(TopicDao dao, ComponentService componentService, UserService userService, TopicSearchDao searchDao); @Override Topic get(Long id); @Override Page<Topic> getRecentTopics(String page); @Override Page<Topic> getUnansweredTopics(String page); @Override Topic getTopicSilently(Long id); @Override Page<Topic> getTopics(Branch branch, String page); @Override Page<Topic> searchByTitleAndContent(String phrase, String page); @Override void rebuildSearchIndex(); @PreAuthorize("hasPermission(#branchId, 'BRANCH', 'BranchPermission.VIEW_TOPICS')") @Override void checkViewTopicPermission(Long branchId);  }### Answer:
@Test public void testGetAllTopicsPastLastDay() throws NotFoundException { String pageNumber = "1"; int pageSize = 20; List<Topic> expectedList = Collections.nCopies(2, new Topic(user, "title")); Page<Topic> expectedPage = new PageImpl<>(expectedList); when(topicDao.getTopicsUpdatedSince(Matchers.<DateTime>any(), Matchers.<PageRequest>any(),eq(user))) .thenReturn(expectedPage); user.setPageSize(pageSize); when(userService.getCurrentUser()).thenReturn(user); Page<Topic> actualPage = topicFetchService.getRecentTopics(pageNumber); assertNotNull(actualPage); assertEquals(expectedPage, actualPage); verify(topicDao).getTopicsUpdatedSince(Matchers.<DateTime>any(), Matchers.<PageRequest>any(), eq(user)); }