Class MockPrincipal


  • public static class MockPrincipal
    extends java.lang.Object
    Mock implementation of a user principal. This class also provides convenient methods for specifying the user principal roles.

    Example usage with MockContext:

     MockContext mockContext = MockContext.initContext();
    
     // Create a new user principal with the roles "user" and "manager"
     MockPrincipal principal = new MockPrincipal("Bob", "user", "manager");
    
     // Set the user principal on the request object
     mockContext.getMockRequest().setUserPrincipal(principal); 

    Example usage with MockContainer:

     MockContainer container = new MockContainer("c:/dev/myapp/web");
    
     // Create a new user principal with the roles "user" and "manager"
     MockPrincipal principal = new MockPrincipal("Bob", "user", "manager");
    
     // Set the user principal on the request object
     container.getRequest().setUserPrincipal(principal); 
    Since:
    17.10.0
    See Also:
    Serialized Form
    • Method Summary

      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait