UserREST { @PUT @Path("/{userId}/roles") @Produces({ "application/xml", "application/json" }) @PreAuthorize("@rangerPreAuthSecurityHandler.isAPIAccessible(\"" + RangerAPIList.SET_USER_ROLES + "\")") public VXResponse setUserRoles(@PathParam("userId") Long userId, VXStringList roleList) { userManager.checkAccess(userId); userManager.setUserRoles(userId, roleList.getVXStrings()); VXResponse response = new VXResponse(); response.setStatusCode(VXResponse.STATUS_SUCCESS); return response; }  @GET @Produces({ "application/xml", "application/json" }) @PreAuthorize("@rangerPreAuthSecurityHandler.isAPIAccessible(\"" + RangerAPIList.SEARCH_USERS + "\")") VXPortalUserList searchUsers(@Context HttpServletRequest request); @GET @Path("{userId}") @Produces({ "application/xml", "application/json" }) @PreAuthorize("@rangerPreAuthSecurityHandler.isAPIAccessible(\"" + RangerAPIList.GET_USER_PROFILE_FOR_USER + "\")") VXPortalUser getUserProfileForUser(@PathParam("userId") Long userId); @POST @Consumes({ "application/json", "application/xml" }) @Produces({ "application/xml", "application/json" }) @PreAuthorize("@rangerPreAuthSecurityHandler.isAPIAccessible(\"" + RangerAPIList.CREATE + "\")") VXPortalUser create(VXPortalUser userProfile,
			@Context HttpServletRequest servletRequest); @POST @Path("/default") @Consumes({ "application/json", "application/xml" }) @Produces({ "application/xml", "application/json" }) @PreAuthorize("@rangerPreAuthSecurityHandler.isAPIAccessible(\"" + RangerAPIList.CREATE_DEFAULT_ACCOUNT_USER + "\")") VXPortalUser createDefaultAccountUser(VXPortalUser userProfile,
			@Context HttpServletRequest servletRequest); @PUT @Consumes({ "application/json", "application/xml" }) @Produces({ "application/xml", "application/json" }) @RangerAnnotationRestAPI(updates_classes = "VUserProfile") @PreAuthorize("@rangerPreAuthSecurityHandler.isAPIAccessible(\"" + RangerAPIList.UPDATE + "\")") VXPortalUser update(VXPortalUser userProfile,
			@Context HttpServletRequest servletRequest); @PUT @Path("/{userId}/roles") @Produces({ "application/xml", "application/json" }) @PreAuthorize("@rangerPreAuthSecurityHandler.isAPIAccessible(\"" + RangerAPIList.SET_USER_ROLES + "\")") VXResponse setUserRoles(@PathParam("userId") Long userId,
			VXStringList roleList); @POST @Path("{userId}/deactivate") @Produces({ "application/xml", "application/json" }) @PreAuthorize("@rangerPreAuthSecurityHandler.isAPIAccessible(\"" + RangerAPIList.DEACTIVATE_USER + "\")") @RangerAnnotationClassName(class_name = VXPortalUser.class) VXPortalUser deactivateUser(@PathParam("userId") Long userId); @GET @Path("/profile") @Produces({ "application/xml", "application/json" }) VXPortalUser getUserProfile(@Context HttpServletRequest request); @GET @Path("/firstnames") @Produces({ "application/xml", "application/json" }) String suggestUserFirstName(@QueryParam("letters") String letters,
			@Context HttpServletRequest req); @POST @Path("{userId}/passwordchange") @Produces({ "application/xml", "application/json" }) VXResponse changePassword(@PathParam("userId") Long userId,
			VXPasswordChange changePassword); @POST @Path("{userId}/emailchange") @Produces({ "application/xml", "application/json" }) VXPortalUser changeEmailAddress(@PathParam("userId") Long userId,
			VXPasswordChange changeEmail);  }
@Test public void test10SetUserRoles() { Long userId = 10L; VXResponse responseExp = new VXResponse(); VXStringList roleList = new VXStringList(); Mockito.doNothing().when(userManager).checkAccess(userId); Mockito.doNothing().when(userManager).setUserRoles(userId, roleList.getVXStrings()); VXResponse responseAct = userREST.setUserRoles(userId, roleList); Assert.assertNotNull(responseAct); Assert.assertEquals(responseExp.getStatusCode(), responseAct.getStatusCode()); Mockito.verify(userManager).checkAccess(userId); Mockito.verify(userManager).setUserRoles(userId, roleList.getVXStrings()); }