org.springframework.mock.web

## Class MockServletConfig

- java.lang.Object
- - org.springframework.mock.web.MockServletConfig

All Implemented Interfaces:
  ServletConfig

    public class MockServletConfig
    extends Object
    implements ServletConfig

Mock implementation of the `ServletConfig` interface.

Used for testing the web framework; typically not necessary for testing application controllers.

Since:
  1.0.2
Author:
  Rod Johnson, Juergen Hoeller

### Constructor Summary

Constructors
Constructor and Description
`MockServletConfig()` Create a new MockServletConfig with a default `MockServletContext`.
`MockServletConfig(ServletContext servletContext)` Create a new MockServletConfig.
`MockServletConfig(ServletContext servletContext, String servletName)` Create a new MockServletConfig.
`MockServletConfig(String servletName)` Create a new MockServletConfig with a default `MockServletContext`.

### Method Summary

Methods
`void` `addInitParameter(String name, String value)`
`String` `getInitParameter(String name)`
`Enumeration<String>` `getInitParameterNames()`
`ServletContext` `getServletContext()`
`String` `getServletName()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### MockServletConfig

    public MockServletConfig()

Create a new MockServletConfig with a default `MockServletContext`.

#### MockServletConfig

    public MockServletConfig(String servletName)

Create a new MockServletConfig with a default `MockServletContext`.

Parameters:
  `servletName` - the name of the servlet

#### MockServletConfig

    public MockServletConfig(ServletContext servletContext)

Create a new MockServletConfig.

Parameters:
  `servletContext` - the ServletContext that the servlet runs in

#### MockServletConfig

    public MockServletConfig(ServletContext servletContext,
                     String servletName)

Create a new MockServletConfig.

Parameters:
  `servletContext` - the ServletContext that the servlet runs in
  `servletName` - the name of the servlet

### Method Detail

#### getServletName

    public String getServletName()

Specified by:
  `getServletName` in interface `ServletConfig`

#### getServletContext

    public ServletContext getServletContext()

Specified by:
  `getServletContext` in interface `ServletConfig`

#### addInitParameter

    public void addInitParameter(String name,
                        String value)

#### getInitParameter

    public String getInitParameter(String name)

Specified by:
  `getInitParameter` in interface `ServletConfig`

#### getInitParameterNames

    public Enumeration<String> getInitParameterNames()

Specified by:
  `getInitParameterNames` in interface `ServletConfig`