@Test
public void testCreatePrincipalForName() {

    Principal principal = zts.createPrincipalForName("athenz.provider");
    assertEquals(principal.getDomain(), "athenz");
    assertEquals(principal.getName(), "provider");
    
    principal = zts.createPrincipalForName("athenz.subdomain.provider");
    assertEquals(principal.getDomain(), "athenz.subdomain");
    assertEquals(principal.getName(), "provider");
    
    principal = zts.createPrincipalForName("provider");
    assertEquals(principal.getDomain(), zts.userDomain);
    assertEquals(principal.getName(), "provider");
    zts.userDomain = "user";
    zts.userDomainAlias = null;
    
    principal = zts.createPrincipalForName("joe");
    assertEquals(principal.getFullName(), "user.joe");
    
    principal = zts.createPrincipalForName("joe-smith");
    assertEquals(principal.getFullName(), "user.joe-smith");
    
    principal = zts.createPrincipalForName("user.joe");
    assertEquals(principal.getFullName(), "user.joe");
    principal = zts.createPrincipalForName("user.joe.storage");
    assertEquals(principal.getFullName(), "user.joe.storage");
    
    principal = zts.createPrincipalForName("alias.joe");
    assertEquals(principal.getFullName(), "alias.joe");
    
    principal = zts.createPrincipalForName("alias.joe.storage");
    assertEquals(principal.getFullName(), "alias.joe.storage");
    
    zts.userDomainAlias = "alias";
    
    principal = zts.createPrincipalForName("joe");
    assertEquals(principal.getFullName(), "user.joe");
    
    principal = zts.createPrincipalForName("joe-smith");
    assertEquals(principal.getFullName(), "user.joe-smith");
    
    principal = zts.createPrincipalForName("user.joe");
    assertEquals(principal.getFullName(), "user.joe");
    principal = zts.createPrincipalForName("user.joe.storage");
    assertEquals(principal.getFullName(), "user.joe.storage");
    
    principal = zts.createPrincipalForName("alias.joe");
    assertEquals(principal.getFullName(), "user.joe");
    
    principal = zts.createPrincipalForName("alias.joe.storage");
    assertEquals(principal.getFullName(), "alias.joe.storage");
}