### Question:
ResourcesService extends BaseService { public Map<String, Object> queryResourceListPaging(User loginUser, int direcotryId, ResourceType type, String searchVal, Integer pageNo, Integer pageSize) { HashMap<String, Object> result = new HashMap<>(); Page<Resource> page = new Page(pageNo, pageSize); int userId = loginUser.getId(); if (isAdmin(loginUser)) { userId= 0; } if (direcotryId != -1) { Resource directory = resourcesMapper.selectById(direcotryId); if (directory == null) { putMsg(result, Status.RESOURCE_NOT_EXIST); return result; } } IPage<Resource> resourceIPage = resourcesMapper.queryResourcePaging(page, userId,direcotryId, type.ordinal(), searchVal); PageInfo pageInfo = new PageInfo<Resource>(pageNo, pageSize); pageInfo.setTotalCount((int)resourceIPage.getTotal()); pageInfo.setLists(resourceIPage.getRecords()); result.put(Constants.DATA_LIST, pageInfo); putMsg(result,Status.SUCCESS); return result; }  @Transactional(rollbackFor = RuntimeException.class) Result createDirectory(User loginUser,
                                 String name,
                                 String description,
                                 ResourceType type,
                                 int pid,
                                 String currentDir); @Transactional(rollbackFor = RuntimeException.class) Result createResource(User loginUser,
                                 String name,
                                 String desc,
                                 ResourceType type,
                                 MultipartFile file,
                                 int pid,
                                 String currentDir); @Transactional(rollbackFor = RuntimeException.class) Result updateResource(User loginUser,
                                 int resourceId,
                                 String name,
                                 String desc,
                                 ResourceType type); Map<String, Object> queryResourceListPaging(User loginUser, int direcotryId, ResourceType type, String searchVal, Integer pageNo, Integer pageSize); Map<String, Object> queryResourceList(User loginUser, ResourceType type); Map<String, Object> queryResourceJarList(User loginUser, ResourceType type); @Transactional(rollbackFor = Exception.class) Result delete(User loginUser, int resourceId); Result verifyResourceName(String fullName, ResourceType type,User loginUser); Result queryResource(String fullName,Integer id,ResourceType type); Result readResource(int resourceId, int skipLineNum, int limit); @Transactional(rollbackFor = RuntimeException.class) Result onlineCreateResource(User loginUser, ResourceType type, String fileName, String fileSuffix, String desc, String content,int pid,String currentDirectory); @Transactional(rollbackFor = RuntimeException.class) Result updateResourceContent(int resourceId, String content); org.springframework.core.io.Resource downloadResource(int resourceId); Map<String, Object> authorizeResourceTree(User loginUser, Integer userId); Map<String, Object> unauthorizedFile(User loginUser, Integer userId); Map<String, Object> unauthorizedUDFFunction(User loginUser, Integer userId); Map<String, Object> authorizedUDFFunction(User loginUser, Integer userId); Map<String, Object> authorizedFile(User loginUser, Integer userId);  }### Answer:
@Test public void testQueryResourceListPaging(){ User loginUser = new User(); loginUser.setUserType(UserType.ADMIN_USER); IPage<Resource> resourcePage = new Page<>(1,10); resourcePage.setTotal(1); resourcePage.setRecords(getResourceList()); Mockito.when(resourcesMapper.queryResourcePaging(Mockito.any(Page.class), Mockito.eq(0),Mockito.eq(-1), Mockito.eq(0), Mockito.eq("test"))).thenReturn(resourcePage); Map<String, Object> result = resourcesService.queryResourceListPaging(loginUser,-1,ResourceType.FILE,"test",1,10); logger.info(result.toString()); Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS)); PageInfo pageInfo = (PageInfo) result.get(Constants.DATA_LIST); Assert.assertTrue(CollectionUtils.isNotEmpty(pageInfo.getLists())); }