log.debug("expected exception: " + e.getMessage());
}
}
public void testAddUserRole() throws Exception {
User user = dao.getUser(new Integer(1));
assertEquals(1, user.getRoles().size());
Role role = rdao.getRoleByName(Constants.ADMIN_ROLE);
user.addRole(role);
dao.saveUser(user);
assertEquals(2, user.getRoles().size());
//add the same role twice - should result in no additional role
user.addRole(role);
dao.saveUser(user);
assertEquals("more than 2 roles", 2, user.getRoles().size());
user.getRoles().remove(role);
dao.saveUser(user);
assertEquals(1, user.getRoles().size());
}