Package 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.

Since:
  1.0.2
Author:
  Rod Johnson, Juergen Hoeller

## Constructor Summary

Constructors
Constructor
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

Modifier and Type
Method
Description
`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 Details

### 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(@Nullable ServletContext servletContext)
Create a new MockServletConfig.

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

### MockServletConfig

public MockServletConfig(@Nullable ServletContext servletContext, String servletName)
Create a new MockServletConfig.

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

## Method Details

### 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

@Nullable public String getInitParameter(String name)

Specified by:
  `getInitParameter` in interface `ServletConfig`

### getInitParameterNames

public Enumeration<String> getInitParameterNames()

Specified by:
  `getInitParameterNames` in interface `ServletConfig`