Package org.springframework.mock.web

# Class MockFilterConfig

java.lang.Object
org.springframework.mock.web.MockFilterConfig

All Implemented Interfaces:
  `FilterConfig`

public class MockFilterConfig extends Object implements FilterConfig
Mock implementation of the `FilterConfig` interface.

Used for testing the web framework; also useful for testing custom `Filter` implementations.

Since:
  1.0.2
Author:
  Juergen Hoeller
See Also:
  - `MockFilterChain`
  - `PassThroughFilterChain`

## Constructor Summary

Constructors
Constructor
Description
`MockFilterConfig()`
Create a new MockFilterConfig with a default `MockServletContext`.
`MockFilterConfig(ServletContext servletContext)`
Create a new MockFilterConfig.
`MockFilterConfig(ServletContext servletContext, String filterName)`
Create a new MockFilterConfig.
`MockFilterConfig(String filterName)`
Create a new MockFilterConfig with a default `MockServletContext`.

## Method Summary

Modifier and Type
Method
Description
`void`
`addInitParameter(String name, String value)`
`String`
`getFilterName()`
`String`
`getInitParameter(String name)`
`Enumeration<String>`
`getInitParameterNames()`
`ServletContext`
`getServletContext()`

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

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

## Constructor Details

### MockFilterConfig

public MockFilterConfig()
Create a new MockFilterConfig with a default `MockServletContext`.

### MockFilterConfig

public MockFilterConfig(String filterName)
Create a new MockFilterConfig with a default `MockServletContext`.

Parameters:
  `filterName` - the name of the filter

### MockFilterConfig

public MockFilterConfig(@Nullable ServletContext servletContext)
Create a new MockFilterConfig.

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

### MockFilterConfig

public MockFilterConfig(@Nullable ServletContext servletContext, String filterName)
Create a new MockFilterConfig.

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

## Method Details

### getFilterName

public String getFilterName()

Specified by:
  `getFilterName` in interface `FilterConfig`

### getServletContext

public ServletContext getServletContext()

Specified by:
  `getServletContext` in interface `FilterConfig`

### addInitParameter

public void addInitParameter(String name, String value)

### getInitParameter

@Nullable public String getInitParameter(String name)

Specified by:
  `getInitParameter` in interface `FilterConfig`

### getInitParameterNames

public Enumeration<String> getInitParameterNames()

Specified by:
  `getInitParameterNames` in interface `FilterConfig`