@Test
public void testMatchPrincipalInRoleDelegatedTrustMatch() {

    String domainName = "coretechtrust";
    List<String> adminUsers = new ArrayList<>();
    adminUsers.add("user.user2");
    zms.dbService.makeDomain(mockDomRsrcCtx, ZMSTestUtils.makeDomainObject(domainName, "Test Domain", "org",
            true, null, 0, null, 0), adminUsers, null, auditRef);
    Policy policy = createPolicyObject(domainName, "trust", "coretechtrust:role.role1",
            false, "ASSUME_ROLE", "weather:role.role1", AssertionEffect.ALLOW);
    zms.dbService.executePutPolicy(mockDomRsrcCtx, domainName, "trust",
            policy, auditRef, "unitTest");
    
    Role role1 = createRoleObject(domainName,  "role1", null, "user.user1", null);
    zms.dbService.executePutRole(mockDomRsrcCtx, domainName, "role1",
            role1, auditRef, "unittest");
    Role role2 = createRoleObject(domainName,  "role2", null, "user.user2", null);
    zms.dbService.executePutRole(mockDomRsrcCtx, domainName, "role2",
            role2, auditRef, "unittest");
    
    Role role = createRoleObject("weather",  "role1", domainName);
    assertTrue(zms.matchPrincipalInRole(role, "weather:role.role1", "user.user1", "coretechtrust"));
    assertFalse(zms.matchPrincipalInRole(role, "weather:role.role1", "user.user1", "coretechtrust2"));
    assertFalse(zms.matchPrincipalInRole(role, "weather:role.role1", "user.user3", "coretechtrust"));
    zms.dbService.executeDeleteDomain(mockDomRsrcCtx, domainName, auditRef, "unittest");
}