Package com.avoka.tm.test
Class MockPrincipal
com.avoka.tm.test.MockPrincipal
public static class MockPrincipal
Mock implementation of a user
.
This class also provides convenient methods for specifying the user principal
roles.
Example usage with MockContext:
invalid reference
principal
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: