@Test
public void testValidatePrincipalNotRoleIdentity() {

    SimplePrincipal principal = (SimplePrincipal) SimplePrincipal.create("sports", "api",
            "creds", 0, new PrincipalAuthority());
    // no errors with regular principal
    zts.validatePrincipalNotRoleIdentity(principal, "testCaller");
    // set roles and check for exception
    principal.setRoles(Collections.singletonList("role1"));
    try {
        zts.validatePrincipalNotRoleIdentity(principal, "testCaller");
        fail();
    } catch (ResourceException ex) {
        assertEquals(403, ex.getCode());
    }
}