public class MockHttpSession extends Object implements HttpSession
HttpSession
for mocking purposes.
Session-based tests can use this API to create customized instances of HttpSession
objects
that can be passed to the MockRestRequest.httpSession(HttpSession)
method.
Constructor and Description |
---|
MockHttpSession() |
public MockHttpSession()
public static MockHttpSession create()
public MockHttpSession creationTime(long value)
Affects the results of calling HttpSession.getCreationTime()
.
value
- The new value for this setting.public MockHttpSession lastAccessedTime(long value)
Affects the results of calling HttpSession.getLastAccessedTime()
.
value
- The new value for this setting.public MockHttpSession maxInactiveInterval(int value)
Affects the results of calling HttpSession.getMaxInactiveInterval()
.
value
- The new value for this setting.public MockHttpSession id(String value)
Affects the results of calling HttpSession.getId()
.
value
- The new value for this setting.public MockHttpSession servletContext(ServletContext value)
Affects the results of calling HttpSession.getServletContext()
.
value
- The new value for this setting.public MockHttpSession isNew(boolean value)
Affects the results of calling HttpSession.isNew()
.
value
- The new value for this setting.public long getCreationTime()
getCreationTime
in interface HttpSession
public String getId()
getId
in interface HttpSession
public long getLastAccessedTime()
getLastAccessedTime
in interface HttpSession
public ServletContext getServletContext()
getServletContext
in interface HttpSession
public void setMaxInactiveInterval(int value)
setMaxInactiveInterval
in interface HttpSession
public int getMaxInactiveInterval()
getMaxInactiveInterval
in interface HttpSession
public HttpSessionContext getSessionContext()
getSessionContext
in interface HttpSession
public Object getAttribute(String name)
getAttribute
in interface HttpSession
public Object getValue(String name)
getValue
in interface HttpSession
public Enumeration<String> getAttributeNames()
getAttributeNames
in interface HttpSession
public String[] getValueNames()
getValueNames
in interface HttpSession
public void setAttribute(String name, Object value)
setAttribute
in interface HttpSession
public void putValue(String name, Object value)
putValue
in interface HttpSession
public void removeAttribute(String name)
removeAttribute
in interface HttpSession
public void removeValue(String name)
removeValue
in interface HttpSession
public void invalidate()
invalidate
in interface HttpSession
public boolean isNew()
isNew
in interface HttpSession
Copyright © 2016–2020 The Apache Software Foundation. All rights reserved.