@Test
public void test05UpdateXUser() {

	setup();
	XXUserPermissionDao xUserPermissionDao = Mockito.mock(XXUserPermissionDao.class);
	Collection<String> existingRoleList = new ArrayList<String>();
	existingRoleList.add(RangerConstants.ROLE_USER);
	Collection<String> reqRoleList = new ArrayList<String>();
	reqRoleList.add(RangerConstants.ROLE_SYS_ADMIN);
	Collection<Long> groupIdList = new ArrayList<Long>();
	groupIdList.add(userId);
	VXUser vxUser = vxUser();
	vxUser.setUserRoleList(reqRoleList);
	vxUser.setUserSource(RangerCommonEnums.USER_EXTERNAL);
	vxUser.setGroupIdList(groupIdList);
	vxUser.setFirstName("user12");
	vxUser.setLastName("test12");
	Mockito.when(xUserService.updateResource(vxUser)).thenReturn(vxUser);
	XXModuleDefDao xModuleDefDao = Mockito.mock(XXModuleDefDao.class);
	VXPortalUser vXPortalUser = userProfile();
	vXPortalUser.setUserRoleList(existingRoleList);
	Mockito.when(userMgr.getUserProfileByLoginId(vxUser.getName())).thenReturn(vXPortalUser);
	Mockito.when(daoManager.getXXUserPermission()).thenReturn(xUserPermissionDao);
	List<XXUserPermission> xUserPermissionsList = new ArrayList<XXUserPermission>();
	XXUserPermission xUserPermissionObj = new XXUserPermission();
	xUserPermissionObj.setAddedByUserId(userId);
	xUserPermissionObj.setCreateTime(new Date());
	xUserPermissionObj.setId(userId);
	xUserPermissionObj.setIsAllowed(1);
	xUserPermissionObj.setModuleId(1L);
	xUserPermissionObj.setUpdatedByUserId(userId);
	xUserPermissionObj.setUpdateTime(new Date());
	xUserPermissionObj.setUserId(userId);
	xUserPermissionsList.add(xUserPermissionObj);
	List<XXModuleDef> xXModuleDefs = xxModuleDefs();
	Mockito.when(xUserPermissionDao.findByUserPermissionId(vXPortalUser.getId())).thenReturn(xUserPermissionsList);
	Mockito.when(daoManager.getXXModuleDef()).thenReturn(xModuleDefDao);
	Mockito.when(xModuleDefDao.getAll()).thenReturn(xXModuleDefs);
	XXUser xXUser = xxUser(vxUser);
	XXUserDao xxUserDao = Mockito.mock(XXUserDao.class);
	Mockito.when(daoManager.getXXUser()).thenReturn(xxUserDao);
	Mockito.when(xxUserDao.findByPortalUserId(vXPortalUser.getId())).thenReturn(xXUser);
	VXGroupUserList vxGroupUserList = vxGroupUserList();
	Mockito.when(xGroupUserService.searchXGroupUsers((SearchCriteria) Mockito.any())).thenReturn(vxGroupUserList);
	UserSessionBase userSession = Mockito.mock(UserSessionBase.class);
	Set<UserSessionBase> userSessions = new HashSet<UserSessionBase>();
	userSessions.add(userSession);
	VXUserPermission vXUserPermission = vxUserPermission();
	Mockito.when(xUserPermissionService.createResource((VXUserPermission) Mockito.any())).thenReturn(vXUserPermission);
	Mockito.when(sessionMgr.getActiveUserSessionsForPortalUserId(userId)).thenReturn(userSessions);
	VXUser dbvxUser = xUserMgr.updateXUser(vxUser);
	Assert.assertNotNull(dbvxUser);
	Assert.assertEquals(dbvxUser.getId(), vxUser.getId());
	Assert.assertEquals(dbvxUser.getDescription(), vxUser.getDescription());
	Assert.assertEquals(dbvxUser.getName(), vxUser.getName());
	Mockito.verify(xUserService).updateResource(vxUser);
}