org.apache.struts.mock
Class MockPrincipal
java.lang.Object
org.apache.struts.mock.MockPrincipal
- All Implemented Interfaces:
- Principal
public class MockPrincipal
- extends Object
- implements 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.
- Version:
- $Rev: 471754 $ $Date: 2005-05-07 12:11:38 -0400 (Sat, 07 May 2005)
$
name
protected String name
roles
protected String[] roles
MockPrincipal
public MockPrincipal()
MockPrincipal
public MockPrincipal(String name)
MockPrincipal
public MockPrincipal(String name,
String[] roles)
getName
public String getName()
- Specified by:
getName
in interface Principal
isUserInRole
public boolean isUserInRole(String role)
equals
public boolean equals(Object o)
- Specified by:
equals
in interface Principal
- Overrides:
equals
in class Object
hashCode
public int hashCode()
- Specified by:
hashCode
in interface Principal
- Overrides:
hashCode
in class Object
Copyright © 2000-2008 Apache Software Foundation. All Rights Reserved.