Class MockHttpSession

java.lang.Object
io.github.cdiunit.internal.servlet6.MockHttpSession
All Implemented Interfaces:
jakarta.servlet.http.HttpSession

public class MockHttpSession extends Object implements jakarta.servlet.http.HttpSession
Shamlessly ripped from mockrunner.
  • Constructor Details

    • MockHttpSession

      public MockHttpSession(jakarta.servlet.ServletContext servletContext)
  • Method Details

    • resetAll

      public void resetAll()
      Resets the state of this object to the default values
    • addAttributeListener

      public void addAttributeListener(jakarta.servlet.http.HttpSessionAttributeListener listener)
    • setupServletContext

      public void setupServletContext(jakarta.servlet.ServletContext servletContext)
      Set the ServletContext.
      Parameters:
      servletContext - the ServletContext
    • getServletContext

      public jakarta.servlet.ServletContext getServletContext()
      Specified by:
      getServletContext in interface jakarta.servlet.http.HttpSession
    • isValid

      public boolean isValid()
    • isNew

      public boolean isNew()
      Specified by:
      isNew in interface jakarta.servlet.http.HttpSession
    • setUpIsNew

      public void setUpIsNew(boolean isNew)
    • getCreationTime

      public long getCreationTime()
      Specified by:
      getCreationTime in interface jakarta.servlet.http.HttpSession
    • invalidate

      public void invalidate()
      Specified by:
      invalidate in interface jakarta.servlet.http.HttpSession
    • getId

      public String getId()
      Specified by:
      getId in interface jakarta.servlet.http.HttpSession
    • getValue

      public Object getValue(String key)
    • getValueNames

      public String[] getValueNames()
    • putValue

      public void putValue(String key, Object value)
    • removeValue

      public void removeValue(String key)
    • clearAttributes

      public void clearAttributes()
    • getAttribute

      public Object getAttribute(String key)
      Specified by:
      getAttribute in interface jakarta.servlet.http.HttpSession
    • getAttributeNames

      public Enumeration getAttributeNames()
      Specified by:
      getAttributeNames in interface jakarta.servlet.http.HttpSession
    • removeAttribute

      public void removeAttribute(String key)
      Specified by:
      removeAttribute in interface jakarta.servlet.http.HttpSession
    • setAttribute

      public void setAttribute(String key, Object value)
      Specified by:
      setAttribute in interface jakarta.servlet.http.HttpSession
    • getLastAccessedTime

      public long getLastAccessedTime()
      Specified by:
      getLastAccessedTime in interface jakarta.servlet.http.HttpSession
    • setMaxInactiveInterval

      public void setMaxInactiveInterval(int maxInactiveInterval)
      Specified by:
      setMaxInactiveInterval in interface jakarta.servlet.http.HttpSession
    • getMaxInactiveInterval

      public int getMaxInactiveInterval()
      Specified by:
      getMaxInactiveInterval in interface jakarta.servlet.http.HttpSession