@Test
public void testIsAllowedPutMembershipAccess(){

    TopLevelDomain dom1 = createTopLevelDomainObject("testdomain1",
            "Role Test Domain1", "testOrg", "user.user1");
    zms.postTopLevelDomain(mockDomRsrcCtx, auditRef, dom1);
    Role role1 = createRoleObject("testdomain1", "testrole1", null,"user.user1", "user.jane");
    zms.putRole(mockDomRsrcCtx, "testdomain1", "testrole1", auditRef, role1);
    AthenzDomain domain = zms.getAthenzDomain("testdomain1", false);
    Role role = zms.getRoleFromDomain("testrole1", domain);
    assertTrue(zms.isAllowedPutMembershipAccess(mockDomRestRsrcCtx.principal(), domain, role.getName()));
    Authority principalAuthority = new com.yahoo.athenz.common.server.debug.DebugPrincipalAuthority();
    String unsignedCreds = "v=U1;d=user;n=john";
    final Principal rsrcPrince = SimplePrincipal.create("user", "john", unsignedCreds + ";s=signature",0, principalAuthority);
    assertNotNull(rsrcPrince);
    ((SimplePrincipal) rsrcPrince).setUnsignedCreds(unsignedCreds);
    assertFalse(zms.isAllowedPutMembershipAccess(rsrcPrince, domain, role.getName()));// some random user does not have access
    zms.deleteTopLevelDomain(mockDomRsrcCtx, "testdomain1", auditRef);
}