org.apache.struts.mock
Class MockPrincipal

java.lang.Object
  extended by org.apache.struts.mock.MockPrincipal
All Implemented Interfaces:
java.security.Principal

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.

Version:
$Rev: 471754 $ $Date: 2005-05-07 12:11:38 -0400 (Sat, 07 May 2005) $

Field Summary
protected  java.lang.String name
           
protected  java.lang.String[] roles
           
 
Constructor Summary
MockPrincipal()
           
MockPrincipal(java.lang.String name)
           
MockPrincipal(java.lang.String name, java.lang.String[] roles)
           
 
Method Summary
 boolean equals(java.lang.Object o)
           
 java.lang.String getName()
           
 int hashCode()
           
 boolean isUserInRole(java.lang.String role)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.security.Principal
toString
 

Field Detail

name

protected java.lang.String name

roles

protected java.lang.String[] roles
Constructor Detail

MockPrincipal

public MockPrincipal()

MockPrincipal

public MockPrincipal(java.lang.String name)

MockPrincipal

public MockPrincipal(java.lang.String name,
                     java.lang.String[] roles)
Method Detail

getName

public java.lang.String getName()
Specified by:
getName in interface java.security.Principal

isUserInRole

public boolean isUserInRole(java.lang.String role)

equals

public boolean equals(java.lang.Object o)
Specified by:
equals in interface java.security.Principal
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Specified by:
hashCode in interface java.security.Principal
Overrides:
hashCode in class java.lang.Object


Copyright © 2000-2007 Apache Software Foundation. All Rights Reserved.