@Test
public void testExecutePutMembership() {

    String domainName = "mgradddom1";
    String roleName = "role1";
    
    TopLevelDomain dom1 = createTopLevelDomainObject(domainName,
            "Test Domain1", "testOrg", adminUser);
    zms.postTopLevelDomain(mockDomRsrcCtx, auditRef, dom1);
    TopLevelDomain dom2 = createTopLevelDomainObject("coretech",
            "Test Domain2", "testOrg", adminUser);
    zms.postTopLevelDomain(mockDomRsrcCtx, auditRef, dom2);
    
    SubDomain subDom2 = createSubDomainObject("storage", "coretech",
            "Test Domain2", "testOrg", adminUser);
    zms.postSubDomain(mockDomRsrcCtx, "coretech", auditRef, subDom2);
    
    Role role1 = createRoleObject(domainName, roleName, null,
            "user.joe", "user.jane");
    zms.putRole(mockDomRsrcCtx, domainName, roleName, auditRef, role1);
    
    zms.dbService.executePutMembership(mockDomRsrcCtx, domainName, roleName,
            new RoleMember().setMemberName("user.doe"), auditRef, "putMembership");
    
    zms.dbService.executePutMembership(mockDomRsrcCtx, domainName, roleName,
            new RoleMember().setMemberName("coretech.storage"), auditRef, "putMembership");
    Role role = zms.getRole(mockDomRsrcCtx, domainName, roleName, false, false, false);
    assertNotNull(role);
    List<RoleMember> members = role.getRoleMembers();
    assertNotNull(members);
    assertEquals(members.size(), 4);
    List<String> checkList = new ArrayList<>();
    checkList.add("user.joe");
    checkList.add("user.jane");
    checkList.add("user.doe");
    checkList.add("coretech.storage");
    checkRoleMember(checkList, members);
    
    zms.deleteSubDomain(mockDomRsrcCtx, "coretech", "storage", auditRef);
    zms.deleteTopLevelDomain(mockDomRsrcCtx, "coretech", auditRef);
    zms.deleteTopLevelDomain(mockDomRsrcCtx, domainName, auditRef);
}