UserSearchCriteria criteria = new UserSearchCriteria(null, null, "MockUserManagerA");
Set<User> users = userManager.searchUsers(criteria);
Map<String, User> userMap = this.toUserMap(users);
User user = userMap.get("jcoder");
Assert.assertNotNull(user);
// A,B,C,1
Set<String> roleIds = this.toRoleIdSet(user.getRoles());
Assert.assertTrue(roleIds.contains("RoleA"));
Assert.assertTrue(roleIds.contains("RoleB"));
Assert.assertTrue(roleIds.contains("RoleC"));
Assert.assertTrue("roles: " + this.toRoleIdSet(user.getRoles()), roleIds.contains("Role1"));
Assert.assertEquals("roles: " + this.toRoleIdSet(user.getRoles()), 4, user.getRoles().size());
user = userMap.get("dknudsen");
Assert.assertNotNull(user);
Assert.assertEquals(1, user.getRoles().size());
// Role2
roleIds = this.toRoleIdSet(user.getRoles());
Assert.assertTrue(roleIds.contains("Role2"));
user = userMap.get("cdugas");
Assert.assertNotNull(user);
Assert.assertEquals(3, user.getRoles().size());
// A,B,1
roleIds = this.toRoleIdSet(user.getRoles());
Assert.assertTrue(roleIds.contains("RoleA"));
Assert.assertTrue(roleIds.contains("RoleB"));
Assert.assertTrue(roleIds.contains("Role1"));
user = userMap.get("pperalez");
Assert.assertNotNull(user);
Assert.assertEquals(0, user.getRoles().size());
}