@Test
public void testCreatePrincipalForName() {

    
    ZMSImpl zmsImpl = zmsInit();
    zmsImpl.userDomain = "user";
    zmsImpl.userDomainAlias = null;
    
    Principal principal = zmsImpl.createPrincipalForName("joe");
    assertEquals(principal.getFullName(), "user.joe");
    
    principal = zmsImpl.createPrincipalForName("joe-smith");
    assertEquals(principal.getFullName(), "user.joe-smith");
    
    principal = zmsImpl.createPrincipalForName("user.joe");
    assertEquals(principal.getFullName(), "user.joe");
    principal = zmsImpl.createPrincipalForName("user.joe.storage");
    assertEquals(principal.getFullName(), "user.joe.storage");
    
    principal = zmsImpl.createPrincipalForName("alias.joe");
    assertEquals(principal.getFullName(), "alias.joe");
    
    principal = zmsImpl.createPrincipalForName("alias.joe.storage");
    assertEquals(principal.getFullName(), "alias.joe.storage");
    
    zmsImpl.userDomainAlias = "alias";
    
    principal = zmsImpl.createPrincipalForName("joe");
    assertEquals(principal.getFullName(), "user.joe");
    
    principal = zmsImpl.createPrincipalForName("joe-smith");
    assertEquals(principal.getFullName(), "user.joe-smith");
    
    principal = zmsImpl.createPrincipalForName("user.joe");
    assertEquals(principal.getFullName(), "user.joe");
    principal = zmsImpl.createPrincipalForName("user.joe.storage");
    assertEquals(principal.getFullName(), "user.joe.storage");
    
    principal = zmsImpl.createPrincipalForName("alias.joe");
    assertEquals(principal.getFullName(), "user.joe");
    
    principal = zmsImpl.createPrincipalForName("alias.joe.storage");
    assertEquals(principal.getFullName(), "alias.joe.storage");
    zmsImpl.objectStore.clearConnections();
}