@Test
public void testCreateAuth() throws Exception
{

    //Default to Community-Admin Rights (but not full Admin rights)
    new NonStrictExpectations(authorizeService.getClass())
    {{
        // Allow parent Community ADD perms (needed for addSubCommunity functionality)
        authorizeService.authorizeAction((Context) any, (Community) any,
                Constants.ADD); result = null;
        // Allow current Community ADD perms (needed to just create community)
        authorizeService.authorizeActionBoolean((Context) any, (Community) any,
                Constants.ADD); result = true;
        // Disallow full Admin perms
        authorizeService.isAdmin((Context) any); result = false;
    }};
    // test that a Community Admin can create a Community with parent (Sub-Community)
    Community sub = communityService.create(c, context);
    //the item created by default has no name set
    assertThat("testCreate 2", sub, notNullValue());
    assertThat("testCreate 3", sub.getName(), equalTo(""));
    assertTrue("testCreate 4", communityService.getAllParents(context, sub).size() == 1);
    assertThat("testCreate 5", communityService.getAllParents(context, sub).get(0), equalTo(c));
}