### Question:
GetUsersByGroupAPIController { @RequestMapping(method = RequestMethod.GET, value = "/by-group/{group}", produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody public String info(Authentication auth, @PathVariable String group, @RequestParam(value = "status", required = false) String userStatus) throws MuleException { group = new String(Base64.getUrlDecoder().decode(group.getBytes())); log.debug("Getting users for group [{}]", group); return groupService.getUserMembersForGroup(group, Optional.ofNullable(userStatus), auth); }  @RequestMapping(method = RequestMethod.GET, value = "/by-group/{group}", produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody String info(Authentication auth, @PathVariable String group,
            @RequestParam(value = "status", required = false) String userStatus); void setGroupService(GroupService groupService);  }### Answer:
@Test public void getValidUserMembersForGroupTest() throws Exception { String response = "response"; String group = "Group1"; String status = "VALID"; expect(mockAuthentication.getName()).andReturn("USER"); expect(mockGroupService.getUserMembersForGroup(group, Optional.of(status), mockAuthentication)).andReturn(response); replayAll(); MvcResult result = mockMvc .perform(get("/api/latest/users/by-group/{group}", Base64.getUrlEncoder().encodeToString(group.getBytes())) .param("status", "VALID") .accept(MediaType.parseMediaType("application/json;charset=UTF-8")) .principal(mockAuthentication) .contentType(MediaType.APPLICATION_JSON)) .andReturn(); log.info("results: [{}]", result.getResponse().getContentAsString()); verifyAll(); assertEquals(HttpStatus.SC_OK, result.getResponse().getStatus()); }
@Test public void getUserMembersForGroupTest() throws Exception { String response = "response"; String group = "Group 1"; expect(mockAuthentication.getName()).andReturn("USER"); expect(mockGroupService.getUserMembersForGroup(group, Optional.empty(), mockAuthentication)).andReturn(response); replayAll(); MvcResult result = mockMvc .perform(get("/api/latest/users/by-group/{group}", Base64.getUrlEncoder().encodeToString(group.getBytes())) .accept(MediaType.parseMediaType("application/json;charset=UTF-8")) .principal(mockAuthentication) .contentType(MediaType.APPLICATION_JSON)) .andReturn(); log.info("results: [{}]", result.getResponse().getContentAsString()); verifyAll(); assertEquals(HttpStatus.SC_OK, result.getResponse().getStatus()); }