public class MockServletConfig extends 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.
Modifier and Type | Field and Description |
---|---|
protected javax.servlet.ServletContext |
context |
protected HashMap |
parameters |
Constructor and Description |
---|
MockServletConfig() |
MockServletConfig(javax.servlet.ServletContext context) |
Modifier and Type | Method and Description |
---|---|
void |
addInitParameter(String name,
String value) |
String |
getInitParameter(String name) |
Enumeration |
getInitParameterNames() |
javax.servlet.ServletContext |
getServletContext() |
String |
getServletName() |
void |
setServletContext(javax.servlet.ServletContext context) |
protected javax.servlet.ServletContext context
protected HashMap parameters
public MockServletConfig()
public MockServletConfig(javax.servlet.ServletContext context)
public void setServletContext(javax.servlet.ServletContext context)
public String getInitParameter(String name)
getInitParameter
in interface javax.servlet.ServletConfig
public Enumeration getInitParameterNames()
getInitParameterNames
in interface javax.servlet.ServletConfig
public javax.servlet.ServletContext getServletContext()
getServletContext
in interface javax.servlet.ServletConfig
public String getServletName()
getServletName
in interface javax.servlet.ServletConfig
Copyright © 2000–2017 Apache Software Foundation. All rights reserved.