public class MockPrincipal
extends java.lang.Object
implements java.security.Principal
Mock Principal object for low-level unit tests of Struts controller components. Coarser grained tests should be implemented in terms of the Cactus framework, instead of the mock object classes.
WARNING - Only the minimal set of methods needed to
create unit tests is provided, plus additional methods to configure this
object as necessary. Methods for unsupported operations will throw
UnsupportedOperationException.
WARNING - Because unit tests operate in a single threaded environment, no synchronization is performed.
| Modifier and Type | Field and Description |
|---|---|
protected java.lang.String |
name |
protected java.lang.String[] |
roles |
| Constructor and Description |
|---|
MockPrincipal() |
MockPrincipal(java.lang.String name) |
MockPrincipal(java.lang.String name,
java.lang.String[] roles) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object o) |
java.lang.String |
getName() |
int |
hashCode() |
boolean |
isUserInRole(java.lang.String role) |
public MockPrincipal()
public MockPrincipal(java.lang.String name)
public MockPrincipal(java.lang.String name,
java.lang.String[] roles)
public java.lang.String getName()
getName in interface java.security.Principalpublic boolean isUserInRole(java.lang.String role)
public boolean equals(java.lang.Object o)
equals in interface java.security.Principalequals in class java.lang.Objectpublic int hashCode()
hashCode in interface java.security.PrincipalhashCode in class java.lang.ObjectCopyright © 2000–2025 Apache Software Foundation. All rights reserved.