@Test
public void testAsStructRole() {

    List<RoleMember> roleMembers1 = new ArrayList<>();
    Role role1 = new Role().setName("role1").setRoleMembers(roleMembers1)
            .setMemberExpiryDays(30).setTokenExpiryMins(450)
            .setCertExpiryMins(300).setServiceExpiryDays(40);
    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).setSignAlgorithm("ec");
    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);
    final String check = SignUtils.asCanonicalString(data);
    final String expected = "{\"enabled\":true,\"roles\":[{\"certExpiryMins\":300,"
        +"\"memberExpiryDays\":30,\"name\":\"role1\","
        +"\"roleMembers\":[],\"serviceExpiryDays\":40,\"tokenExpiryMins\":450},"
        +"{\"name\":\"role2\",\"roleMembers\":[{\"expiration\":\"1970-01-01T00:00:00.000Z\","
        +"\"memberName\":\"user.joe\"},{\"expiration\":\"1970-01-01T00:00:00.000Z\","
        +"\"memberName\":\"user.jane\"}],\"signAlgorithm\":\"ec\"},{\"name\":\"role3\"}],\"services\":[],\"ypmId\":100}";
    assertEquals(check, expected);
}