@Test
public void testAsStructRoleService() {

    List<Role> roles = new ArrayList<>();
    Role mRole = Mockito.mock(Role.class);
    Mockito.when(mRole.getAuditEnabled()).thenReturn(null);
    Mockito.when(mRole.getSelfServe()).thenReturn(null);
    Mockito.when(mRole.getMemberExpiryDays()).thenReturn(null);
    Mockito.when(mRole.getServiceExpiryDays()).thenReturn(null);
    Mockito.when(mRole.getMemberReviewDays()).thenReturn(null);
    Mockito.when(mRole.getServiceReviewDays()).thenReturn(null);
    Mockito.when(mRole.getTokenExpiryMins()).thenReturn(null);
    roles.add(mRole);
    
    List<String> items = new ArrayList<>();
    String item = "check_item";
    items.add(item);
    
    List<ServiceIdentity> services = new ArrayList<>();
    ServiceIdentity mService = Mockito.mock(ServiceIdentity.class);
    services.add(mService);
    
    List<PublicKeyEntry> publicKeys = new ArrayList<>();
    PublicKeyEntry mPublicKey = Mockito.mock(PublicKeyEntry.class);
    publicKeys.add(mPublicKey);
    
    SignedPolicies signedPolicies = Mockito.mock(SignedPolicies.class);
    Mockito.when(mockDomain.getAuditEnabled()).thenReturn(null);
    Mockito.when(mockDomain.getEnabled()).thenReturn(null);
    Mockito.when(mockDomain.getAccount()).thenReturn("chk_string");
    Mockito.when(mockDomain.getGroups()).thenReturn(null);
    Mockito.when(mockDomain.getRoles()).thenReturn(roles);
    Mockito.when(mRole.getMembers()).thenReturn(items);
    Mockito.when(mockDomain.getServices()).thenReturn(services);
    Mockito.when(mService.getHosts()).thenReturn(null);
    Mockito.when(mService.getPublicKeys()).thenReturn(publicKeys);
    Mockito.when(mockDomain.getPolicies()).thenReturn(signedPolicies);
    Mockito.when(signedPolicies.getContents()).thenReturn(mockPolicies);
    Mockito.when(mockDomain.getMemberExpiryDays()).thenReturn(30);
    Mockito.when(mockDomain.getServiceExpiryDays()).thenReturn(40);
    Mockito.when(mockDomain.getTokenExpiryMins()).thenReturn(450);
    
    String check = SignUtils.asCanonicalString(mockDomain);
    assertNotNull(check);
    assertEquals(check, "{\"account\":\"chk_string\",\"memberExpiryDays\":30,\"policies\""
            +":{\"contents\":{\"policies\":[]}},\"roleCertExpiryMins\":0,\"roles\":[{\"certExpiryMins\":0,\"members\":[\"check_item\"],"
            +"\"roleMembers\":[]}],\"serviceCertExpiryMins\":0,\"serviceExpiryDays\":40,\"services\":[{\"publicKeys\":[{}]}],"
            +"\"tokenExpiryMins\":450,\"ypmId\":0}");
    
    Mockito.when(mService.getPublicKeys()).thenReturn(null);
    Mockito.when(mockDomain.getMemberExpiryDays()).thenReturn(null);
    Mockito.when(mockDomain.getServiceExpiryDays()).thenReturn(null);
    check = SignUtils.asCanonicalString(mockDomain);
    assertNotNull(check);
    assertEquals(check,"{\"account\":\"chk_string\",\"policies\":{\"contents\":{\"policies\":[]}},"
            +"\"roleCertExpiryMins\":0,\"roles\":[{\"certExpiryMins\":0,\"members\":[\"check_item\"],\"roleMembers\":[]}],"
            +"\"serviceCertExpiryMins\":0,\"services\""
            +":[{\"publicKeys\":[]}],\"tokenExpiryMins\":450,\"ypmId\":0}");
}