Package com.avoka.tm.test
Class MockPrincipal
- java.lang.Object
-
- com.avoka.tm.test.MockPrincipal
-
public static class MockPrincipal extends java.lang.Object
Mock implementation of a userprincipal
. 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