### Question:
GroupAssociationController extends BaseController { @RequestMapping(method = RequestMethod.PUT, value = "/resource/associations") public @ResponseBody Map<String, List<Map<String, Object>>> getAvailableAssociations( @RequestParam(RequestParameterKeys.RESOURCE_IDS) String[] resourceAppdefEntityIds, HttpSession session) { AppdefEntityID[] appdefEntityIds = new AppdefEntityID[resourceAppdefEntityIds.length]; for (int x = 0; x < resourceAppdefEntityIds.length; x++) { appdefEntityIds[x] = new AppdefEntityID(resourceAppdefEntityIds[x]); } WebUser webUser = getWebUser(session); PageList<AppdefGroupValue> availableGroups; Map<String, List<Map<String, Object>>> result = new LinkedHashMap<String, List<Map<String, Object>>>(); try { availableGroups = getAppdefBoss().findAllGroupsMemberExclusive( webUser.getSessionId(), PageControl.PAGE_ALL, appdefEntityIds); List<Map<String, Object>> groups = new ArrayList<Map<String, Object>>(); for (AppdefGroupValue group : availableGroups) { Map<String, Object> groupInfo = new HashMap<String, Object>(); groupInfo.put("id", group.getId()); groupInfo.put("name", group.getName()); groupInfo.put("description", group.getDescription()); groups.add(groupInfo); } result.put("groups", groups); } catch (PermissionException e) { log.debug("User doesn't have the permission to perform this operation", e); } catch (SessionException e) { log.debug("There's a problem with the user's session", e); } catch (Exception e) { log.debug(e); } return result; } @Autowired  GroupAssociationController(AppdefBoss appdefBoss, AuthzBoss authzBoss); @RequestMapping(method = RequestMethod.PUT, value = "/resource/associations") @ResponseBody Map<String, List<Map<String, Object>>> getAvailableAssociations(
			@RequestParam(RequestParameterKeys.RESOURCE_IDS) String[] resourceAppdefEntityIds,
			HttpSession session); @RequestMapping(method = RequestMethod.POST, value = "/resource/association") String createAssociation(
			@RequestParam(RequestParameterKeys.GROUP_ID) Integer[] groupIds,
			@RequestParam(RequestParameterKeys.RESOURCE_IDS) String[] resourceAppdefEntityIds,
			HttpSession session); @RequestMapping(method = RequestMethod.GET, value = "/resource/association/{groupId}") @ResponseBody Map<String, String> getAssociation();  }### Answer:
@Test public void testGetAvailableAssociations() throws PermissionException, SessionException { Map<String, Object> inputOutput = constructInputStringArrayAndOutputAppdefEntityIdArrayMap(10); expect( mockAppdefBoss.findAllGroupsMemberExclusive(eq(SESSION_ID .intValue()), isA(PageControl.class), isA(AppdefEntityID[].class))).andReturn((PageList<AppdefGroupValue>) inputOutput.get("output")); replay(mockAppdefBoss); Map<String, List<Map<String, Object>>> result = controller .getAvailableAssociations( (String[]) inputOutput.get("input"), mockSession); verify(mockAppdefBoss); assertTrue("Result should not be empty", !result.isEmpty()); assertTrue("Result should contain a key called 'groups'", result .containsKey("groups")); }