@Test
public void testAsStructGroup() {

    List<GroupMember> groupMembers1 = new ArrayList<>();
    Group group1 = new Group().setName("group1").setGroupMembers(groupMembers1)
            .setReviewEnabled(true).setSelfServe(true).setAuditEnabled(true);
    List<GroupMember> groupMembers2 = new ArrayList<>();
    groupMembers2.add(new GroupMember().setMemberName("user.joe").setExpiration(Timestamp.fromMillis(0)));
    groupMembers2.add(new GroupMember().setMemberName("user.jane").setExpiration(Timestamp.fromMillis(0)));
    Group group2 = new Group().setName("group2").setGroupMembers(groupMembers2);
    List<Group> groups = new ArrayList<>();
    groups.add(group1);
    groups.add(group2);
    groups.add(new Group().setName("group3"));
    DomainData data = new DomainData().setGroups(groups).setYpmId(100)
            .setEnabled(Boolean.TRUE);
    final String check = SignUtils.asCanonicalString(data);
    final String expected = "{\"enabled\":true,\"groups\":[{\"auditEnabled\":true,"
            +"\"groupMembers\":[],\"name\":\"group1\",\"reviewEnabled\":true,\"selfServe\":true},"
            +"{\"groupMembers\":[{\"expiration\":\"1970-01-01T00:00:00.000Z\","
            +"\"memberName\":\"user.joe\"},{\"expiration\":\"1970-01-01T00:00:00.000Z\","
            +"\"memberName\":\"user.jane\"}],\"name\":\"group2\"},{\"name\":\"group3\"}],"
            +"\"roles\":[],\"services\":[],\"ypmId\":100}";
    assertEquals(check, expected);
}