@Test
public void testAsStructRoleDomainWithAuditEnabled() {

    List<RoleMember> roleMembers1 = new ArrayList<>();
    Role role1 = new Role().setName("role1").setRoleMembers(roleMembers1).setAuditEnabled(true);
    List<RoleMember> roleMembers2 = new ArrayList<>();
    roleMembers2.add(new RoleMember().setMemberName("user.joe").setExpiration(Timestamp.fromMillis(0)));
    roleMembers2.add(new RoleMember().setMemberName("user.jane").setExpiration(Timestamp.fromMillis(0)));
    Role role2 = new Role().setName("role2").setRoleMembers(roleMembers2);
    List<Role> roles = new ArrayList<>();
    roles.add(role1);
    roles.add(role2);
    roles.add(new Role().setName("role3"));
    DomainData data = new DomainData().setRoles(roles).setYpmId(100)
            .setEnabled(Boolean.TRUE).setAuditEnabled(true)
            .setRoleCertExpiryMins(100).setServiceCertExpiryMins(200)
            .setTokenExpiryMins(300).setSignAlgorithm("rsa");
    final String check = SignUtils.asCanonicalString(data);
    final String expected = "{\"auditEnabled\":true,\"enabled\":true,\"roleCertExpiryMins\":100,"
            +"\"roles\":[{\"auditEnabled\":true,\"name\":\"role1\",\"roleMembers\":[]},"
            +"{\"name\":\"role2\",\"roleMembers\":[{\"expiration\":\"1970-01-01T00:00:00.000Z\","
            +"\"memberName\":\"user.joe\"},{\"expiration\":\"1970-01-01T00:00:00.000Z\","
            +"\"memberName\":\"user.jane\"}]},{\"name\":\"role3\"}],\"serviceCertExpiryMins\":200,"
            +"\"services\":[],\"signAlgorithm\":\"rsa\",\"tokenExpiryMins\":300,\"ypmId\":100}";
    assertEquals(check, expected);
}