org.apache.struts.mock
Class MockServletConfig

java.lang.Object
  extended by org.apache.struts.mock.MockServletConfig
All Implemented Interfaces:
javax.servlet.ServletConfig

public class MockServletConfig
extends java.lang.Object
implements javax.servlet.ServletConfig

Mock ServletConfig 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  javax.servlet.ServletContext context
           
protected  java.util.HashMap parameters
           
 
Constructor Summary
MockServletConfig()
           
MockServletConfig(javax.servlet.ServletContext context)
           
 
Method Summary
 void addInitParameter(java.lang.String name, java.lang.String value)
           
 java.lang.String getInitParameter(java.lang.String name)
           
 java.util.Enumeration getInitParameterNames()
           
 javax.servlet.ServletContext getServletContext()
           
 java.lang.String getServletName()
           
 void setServletContext(javax.servlet.ServletContext context)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

context

protected javax.servlet.ServletContext context

parameters

protected java.util.HashMap parameters
Constructor Detail

MockServletConfig

public MockServletConfig()

MockServletConfig

public MockServletConfig(javax.servlet.ServletContext context)
Method Detail

addInitParameter

public void addInitParameter(java.lang.String name,
                             java.lang.String value)

setServletContext

public void setServletContext(javax.servlet.ServletContext context)

getInitParameter

public java.lang.String getInitParameter(java.lang.String name)
Specified by:
getInitParameter in interface javax.servlet.ServletConfig

getInitParameterNames

public java.util.Enumeration getInitParameterNames()
Specified by:
getInitParameterNames in interface javax.servlet.ServletConfig

getServletContext

public javax.servlet.ServletContext getServletContext()
Specified by:
getServletContext in interface javax.servlet.ServletConfig

getServletName

public java.lang.String getServletName()
Specified by:
getServletName in interface javax.servlet.ServletConfig


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