@Test
public void testGroupMember() {

    Schema schema = ZMSSchema.instance();
    Validator validator = new Validator(schema);
    GroupMember rm = new GroupMember()
            .setGroupName("group1")
            .setMemberName("user.test1")
            .setDomainName("domain1")
            .setExpiration(Timestamp.fromMillis(123456789123L))
            .setAuditRef("audit-ref")
            .setActive(false)
            .setApproved(true)
            .setRequestTime(Timestamp.fromMillis(123456789124L))
            .setLastNotifiedTime(Timestamp.fromMillis(123456789125L))
            .setRequestPrincipal("user.admin")
            .setReviewLastNotifiedTime(Timestamp.fromMillis(123456789127L))
            .setSystemDisabled(1)
            .setPrincipalType(1);
    assertTrue(rm.equals(rm));
    Result result = validator.validate(rm, "GroupMember");
    assertTrue(result.valid);
    assertEquals(rm.getGroupName(), "group1");
    assertEquals(rm.getMemberName(), "user.test1");
    assertEquals(rm.getDomainName(), "domain1");
    assertEquals(rm.getExpiration().millis(), 123456789123L);
    assertEquals(rm.getAuditRef(), "audit-ref");
    assertFalse(rm.getActive());
    assertTrue(rm.getApproved());
    assertEquals(rm.getRequestTime().millis(), 123456789124L);
    assertEquals(rm.getLastNotifiedTime().millis(), 123456789125L);
    assertEquals(rm.getRequestPrincipal(), "user.admin");
    assertEquals(rm.getReviewLastNotifiedTime().millis(), 123456789127L);
    assertEquals(rm.getSystemDisabled(), Integer.valueOf(1));
    assertEquals(rm.getPrincipalType(), Integer.valueOf(1));
    GroupMember rm2 = new GroupMember()
            .setGroupName("group1")
            .setMemberName("user.test1")
            .setDomainName("domain1")
            .setExpiration(Timestamp.fromMillis(123456789123L))
            .setAuditRef("audit-ref")
            .setActive(false)
            .setApproved(true)
            .setRequestTime(Timestamp.fromMillis(123456789124L))
            .setLastNotifiedTime(Timestamp.fromMillis(123456789125L))
            .setRequestPrincipal("user.admin")
            .setReviewLastNotifiedTime(Timestamp.fromMillis(123456789127L))
            .setSystemDisabled(1)
            .setPrincipalType(1);
    assertTrue(rm2.equals(rm));
    rm2.setRequestPrincipal("user.test2");
    assertFalse(rm2.equals(rm));
    rm2.setRequestPrincipal(null);
    assertFalse(rm2.equals(rm));
    rm2.setRequestPrincipal("user.admin");
    assertTrue(rm2.equals(rm));
    rm2.setDomainName("domain2");
    assertFalse(rm2.equals(rm));
    rm2.setDomainName(null);
    assertFalse(rm2.equals(rm));
    rm2.setDomainName("domain1");
    assertTrue(rm2.equals(rm));
    rm2.setGroupName("group2");
    assertFalse(rm2.equals(rm));
    rm2.setGroupName(null);
    assertFalse(rm2.equals(rm));
    rm2.setGroupName("group1");
    assertTrue(rm2.equals(rm));
    rm2.setMemberName("user.test2");
    assertFalse(rm2.equals(rm));
    rm2.setMemberName(null);
    assertFalse(rm2.equals(rm));
    rm2.setMemberName("user.test1");
    assertTrue(rm2.equals(rm));
    rm2.setExpiration(Timestamp.fromMillis(123456789124L));
    assertFalse(rm2.equals(rm));
    rm2.setExpiration(null);
    assertFalse(rm2.equals(rm));
    rm2.setExpiration(Timestamp.fromMillis(123456789123L));
    assertTrue(rm2.equals(rm));
    rm2.setRequestTime(Timestamp.fromMillis(123456789125L));
    assertFalse(rm2.equals(rm));
    rm2.setRequestTime(null);
    assertFalse(rm2.equals(rm));
    rm2.setRequestTime(Timestamp.fromMillis(123456789124L));
    assertTrue(rm2.equals(rm));
    rm2.setLastNotifiedTime(Timestamp.fromMillis(123456789128L));
    assertFalse(rm2.equals(rm));
    rm2.setLastNotifiedTime(null);
    assertFalse(rm2.equals(rm));
    rm2.setLastNotifiedTime(Timestamp.fromMillis(123456789125L));
    assertTrue(rm2.equals(rm));
    rm2.setAuditRef("audit2-ref");
    assertFalse(rm2.equals(rm));
    rm2.setAuditRef(null);
    assertFalse(rm2.equals(rm));
    rm2.setAuditRef("audit-ref");
    assertTrue(rm2.equals(rm));
    rm2.setActive(true);
    assertFalse(rm2.equals(rm));
    rm2.setActive(null);
    assertFalse(rm2.equals(rm));
    rm2.setActive(false);
    assertTrue(rm2.equals(rm));
    rm2.setApproved(false);
    assertFalse(rm2.equals(rm));
    rm2.setApproved(null);
    assertFalse(rm2.equals(rm));
    rm2.setApproved(true);
    assertTrue(rm2.equals(rm));
    rm2.setReviewLastNotifiedTime(Timestamp.fromMillis(123456789124L));
    assertFalse(rm2.equals(rm));
    rm2.setReviewLastNotifiedTime(null);
    assertFalse(rm2.equals(rm));
    rm2.setReviewLastNotifiedTime(Timestamp.fromMillis(123456789127L));
    assertTrue(rm2.equals(rm));
    rm2.setSystemDisabled(2);
    assertFalse(rm2.equals(rm));
    rm2.setSystemDisabled(null);
    assertFalse(rm2.equals(rm));
    rm2.setSystemDisabled(1);
    assertTrue(rm2.equals(rm));
    rm2.setPrincipalType(2);
    assertFalse(rm2.equals(rm));
    rm2.setPrincipalType(null);
    assertFalse(rm2.equals(rm));
    rm2.setPrincipalType(1);
    assertTrue(rm2.equals(rm));
    assertFalse(rm2.equals(null));
    GroupMember rm3 = new GroupMember();
    rm3.init();
    assertTrue(rm3.getActive());
    assertTrue(rm3.getApproved());
    rm3.setActive(false);
    rm3.setApproved(false);
    rm3.init();
    assertFalse(rm3.getActive());
    assertFalse(rm3.getApproved());
}