@Test
public void testPutDefaultAdmins() {

    TopLevelDomain sportsDomain = createTopLevelDomainObject("sports",
            "Test domain for sports", "testOrg", adminUser);
    try {
        zms.deleteTopLevelDomain(mockDomRsrcCtx, sportsDomain.getName(), auditRef);
    } catch (ResourceException ignored) {
    }
    zms.postTopLevelDomain(mockDomRsrcCtx, auditRef, sportsDomain);
    List<String> adminList = new ArrayList<>();
    DefaultAdmins admins = new DefaultAdmins();
    // negative test, pass an empty list
    admins.setAdmins(adminList);
    zms.putDefaultAdmins(mockDomRsrcCtx, "sports", auditRef, admins);
    Role role = zms.getRole(mockDomRsrcCtx, "sports", "admin", false, false, false);
    assertNotNull(role);
    assertEquals(role.getName(), "sports:role.admin");
    List<RoleMember> members = role.getRoleMembers();
    assertNotNull(members);
    assertEquals(members.size(), 1);
    assertEquals(members.get(0).getMemberName(), adminUser);
    
    // positive test
    adminList.add("user.sports_admin");
    adminList.add("sports.fantasy");
    adminList.add("user.joeschmoe");
    adminList.add("user.johndoe");
    admins.setAdmins(adminList);
    zms.putDefaultAdmins(mockDomRsrcCtx, "sports", auditRef, admins);
    role = zms.getRole(mockDomRsrcCtx, "sports", "admin", false, false, false);
    assertNotNull(role);
    assertEquals(role.getName(), "sports:role.admin");
    members = role.getRoleMembers();
    assertNotNull(members);
    assertEquals(members.size(), 5);
    // add user.testadminuser to the list for verification since it should be
    // there when the domain was added
    adminList.add(adminUser);
    for (String admin : adminList) {
        boolean found = false;
        for (RoleMember memberFromRole : members) {
            if (memberFromRole.getMemberName().equalsIgnoreCase(admin)) {
                found = true;
                break;
            }
        }
        assertTrue(found);
    }
    zms.deleteTopLevelDomain(mockDomRsrcCtx, sportsDomain.getName(), auditRef);
}