public void testAddRole()
throws Exception
{
SecurityService ss = TurbineSecurity.getService();
Role newbie = ss.getRoleInstance();
newbie.setName("newbie");
ss.addRole(newbie);
assertEquals("Role was not added", 3, ss.getAllRoles().size());
try
{
Role user = ss.getRoleByName("User");
ss.addRole(user);
fail("Existing Role could be added!");
}
catch (Exception e)
{
assertEquals("Wrong Exception thrown: " + e.getClass().getName(), EntityExistsException.class, e.getClass());
}
try
{
Role empty = ss.getRoleInstance();
ss.addRole(empty);
fail("Role with empty Rolename could be added!");
}
catch (Exception e)