Class MockServletConfig

  • All Implemented Interfaces:
    jakarta.servlet.ServletConfig

    @NotThreadSafe
    public class MockServletConfig
    extends Object
    implements jakarta.servlet.ServletConfig
    Mock implementation of the ServletConfig interface.
    Author:
    Philip Helger
    • Constructor Detail

      • MockServletConfig

        public MockServletConfig​(@Nonnull
                                 jakarta.servlet.ServletContext aSC,
                                 @Nonnull @Nonempty
                                 String sServletName)
        Constructor without servlet init parameters.
        Parameters:
        aSC - Base servlet context. May not be null.
        sServletName - Name of the servlet. May neither be null nor empty.
      • MockServletConfig

        public MockServletConfig​(@Nonnull
                                 jakarta.servlet.ServletContext aSC,
                                 @Nonnull @Nonempty
                                 String sServletName,
                                 @Nullable
                                 Map<String,​String> aServletInitParams)
        Constructor
        Parameters:
        aSC - Base servlet context. May not be null.
        sServletName - Name of the servlet. May neither be null nor empty.
        aServletInitParams - The map with all servlet init parameters. May be null or empty.
    • Method Detail

      • getServletName

        @Nonnull
        @Nonempty
        public String getServletName()
        Specified by:
        getServletName in interface jakarta.servlet.ServletConfig
      • getServletContext

        @Nonnull
        public jakarta.servlet.ServletContext getServletContext()
        Specified by:
        getServletContext in interface jakarta.servlet.ServletConfig
      • getInitParameter

        @Nullable
        public String getInitParameter​(@Nullable
                                       String sName)
        Specified by:
        getInitParameter in interface jakarta.servlet.ServletConfig
      • getInitParameterNames

        @Nonnull
        public Enumeration<String> getInitParameterNames()
        Specified by:
        getInitParameterNames in interface jakarta.servlet.ServletConfig
      • removeInitParameter

        @Nonnull
        public com.helger.commons.state.EChange removeInitParameter​(@Nullable
                                                                    String sName)
      • getAllInitParameters

        @Nonnull
        @Nonempty
        @ReturnsMutableCopy
        public com.helger.commons.collection.impl.ICommonsOrderedMap<String,​String> getAllInitParameters()