@Test public void getAllUserRolesMappingTest() { List<UserRolesMappingResponse> userRolesDetails = new ArrayList<UserRolesMappingResponse>(); userRolesDetails.add(getUserRolesMappingDetails()); Page<UserRolesMapping> userRoleMappings = getUserRolesMapping(); when(userRolesMappingRepository.findAllUserRolesMappingDetails(StringUtils.EMPTY, new PageRequest(0, 1))).thenReturn(userRoleMappings); assertThat(userRolesMappingService.getAllUserRolesMapping(StringUtils.EMPTY, 0, 1).getContent().size(), is(1)); }
@Override public Page<UserRolesMappingResponse> getAllUserRolesMapping(String searchTerm, int page, int size) { Page<UserRolesMapping> userRoleMappings = userRolesMappingRepository.findAllUserRolesMappingDetails(searchTerm, new PageRequest(page, size)); List<UserRolesMappingResponse> allUserRoleMappingsList = userRoleMappings.getContent().parallelStream().map(fetchUserRolesMappingDetials).collect(Collectors.toList()); Page<UserRolesMappingResponse> allUserRoleMappings = new PageImpl<UserRolesMappingResponse>(allUserRoleMappingsList, new PageRequest(page, size), userRoleMappings.getTotalElements()); return allUserRoleMappings; }
UserRolesMappingServiceImpl implements UserRolesMappingService { @Override public Page<UserRolesMappingResponse> getAllUserRolesMapping(String searchTerm, int page, int size) { Page<UserRolesMapping> userRoleMappings = userRolesMappingRepository.findAllUserRolesMappingDetails(searchTerm, new PageRequest(page, size)); List<UserRolesMappingResponse> allUserRoleMappingsList = userRoleMappings.getContent().parallelStream().map(fetchUserRolesMappingDetials).collect(Collectors.toList()); Page<UserRolesMappingResponse> allUserRoleMappings = new PageImpl<UserRolesMappingResponse>(allUserRoleMappingsList, new PageRequest(page, size), userRoleMappings.getTotalElements()); return allUserRoleMappings; } }
UserRolesMappingServiceImpl implements UserRolesMappingService { @Override public Page<UserRolesMappingResponse> getAllUserRolesMapping(String searchTerm, int page, int size) { Page<UserRolesMapping> userRoleMappings = userRolesMappingRepository.findAllUserRolesMappingDetails(searchTerm, new PageRequest(page, size)); List<UserRolesMappingResponse> allUserRoleMappingsList = userRoleMappings.getContent().parallelStream().map(fetchUserRolesMappingDetials).collect(Collectors.toList()); Page<UserRolesMappingResponse> allUserRoleMappings = new PageImpl<UserRolesMappingResponse>(allUserRoleMappingsList, new PageRequest(page, size), userRoleMappings.getTotalElements()); return allUserRoleMappings; }  }
UserRolesMappingServiceImpl implements UserRolesMappingService { @Override public Page<UserRolesMappingResponse> getAllUserRolesMapping(String searchTerm, int page, int size) { Page<UserRolesMapping> userRoleMappings = userRolesMappingRepository.findAllUserRolesMappingDetails(searchTerm, new PageRequest(page, size)); List<UserRolesMappingResponse> allUserRoleMappingsList = userRoleMappings.getContent().parallelStream().map(fetchUserRolesMappingDetials).collect(Collectors.toList()); Page<UserRolesMappingResponse> allUserRoleMappings = new PageImpl<UserRolesMappingResponse>(allUserRoleMappingsList, new PageRequest(page, size), userRoleMappings.getTotalElements()); return allUserRoleMappings; }  @Override String allocateUserRole(final UserRoleConfigRequest userRoleConfigRequest, final String allocator); @Override Page<UserRolesMappingResponse> getAllUserRolesMapping(String searchTerm, int page, int size); }
UserRolesMappingServiceImpl implements UserRolesMappingService { @Override public Page<UserRolesMappingResponse> getAllUserRolesMapping(String searchTerm, int page, int size) { Page<UserRolesMapping> userRoleMappings = userRolesMappingRepository.findAllUserRolesMappingDetails(searchTerm, new PageRequest(page, size)); List<UserRolesMappingResponse> allUserRoleMappingsList = userRoleMappings.getContent().parallelStream().map(fetchUserRolesMappingDetials).collect(Collectors.toList()); Page<UserRolesMappingResponse> allUserRoleMappings = new PageImpl<UserRolesMappingResponse>(allUserRoleMappingsList, new PageRequest(page, size), userRoleMappings.getTotalElements()); return allUserRoleMappings; }  @Override String allocateUserRole(final UserRoleConfigRequest userRoleConfigRequest, final String allocator); @Override Page<UserRolesMappingResponse> getAllUserRolesMapping(String searchTerm, int page, int size);  }