Class MockFilterConfig

java.lang.Object
org.springframework.mock.web.MockFilterConfig
All Implemented Interfaces:
jakarta.servlet.FilterConfig

public class MockFilterConfig extends Object implements jakarta.servlet.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:
  • 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 jakarta.servlet.ServletContext servletContext)
      Create a new MockFilterConfig.
      Parameters:
      servletContext - the ServletContext that the servlet runs in
    • MockFilterConfig

      public MockFilterConfig(@Nullable jakarta.servlet.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 jakarta.servlet.FilterConfig
    • getServletContext

      public jakarta.servlet.ServletContext getServletContext()
      Specified by:
      getServletContext in interface jakarta.servlet.FilterConfig
    • addInitParameter

      public void addInitParameter(String name, String value)
    • getInitParameter

      public @Nullable String getInitParameter(String name)
      Specified by:
      getInitParameter in interface jakarta.servlet.FilterConfig
    • getInitParameterNames

      public Enumeration<String> getInitParameterNames()
      Specified by:
      getInitParameterNames in interface jakarta.servlet.FilterConfig