Class MockCookie
java.lang.Object
jakarta.servlet.http.Cookie
org.springframework.mock.web.MockCookie
- All Implemented Interfaces:
Serializable
,Cloneable
-
Constructor Summary
ConstructorsConstructorDescriptionMockCookie
(String name, String value) Construct a newMockCookie
with the supplied name and value. -
Method Summary
Modifier and TypeMethodDescriptionGet the "Expires" attribute for this cookie.Get the "SameSite" attribute for this cookie.boolean
Return whether the "Partitioned" attribute is set for this cookie.static MockCookie
Factory method that parses the value of the supplied "Set-Cookie" header.void
setAttribute
(String name, @Nullable String value) void
setExpires
(@Nullable ZonedDateTime expires) Set the "Expires" attribute for this cookie.void
setPartitioned
(boolean partitioned) Set the "Partitioned" attribute for this cookie.void
setSameSite
(@Nullable String sameSite) Set the "SameSite" attribute for this cookie.toString()
Methods inherited from class jakarta.servlet.http.Cookie
clone, equals, getAttribute, getAttributes, getComment, getDomain, getMaxAge, getName, getPath, getSecure, getValue, getVersion, hashCode, isHttpOnly, setComment, setDomain, setHttpOnly, setMaxAge, setPath, setSecure, setValue, setVersion
-
Constructor Details
-
MockCookie
Construct a newMockCookie
with the supplied name and value.- Parameters:
name
- the namevalue
- the value- See Also:
-
-
Method Details
-
setExpires
Set the "Expires" attribute for this cookie.- Since:
- 5.1.11
-
getExpires
Get the "Expires" attribute for this cookie.- Returns:
- the "Expires" attribute for this cookie, or
null
if not set - Since:
- 5.1.11
-
setSameSite
-
getSameSite
-
setPartitioned
public void setPartitioned(boolean partitioned) Set the "Partitioned" attribute for this cookie.- Since:
- 6.2
- See Also:
-
isPartitioned
public boolean isPartitioned()Return whether the "Partitioned" attribute is set for this cookie.- Since:
- 6.2
- See Also:
-
parse
Factory method that parses the value of the supplied "Set-Cookie" header.- Parameters:
setCookieHeader
- the "Set-Cookie" value; nevernull
or empty- Returns:
- the created cookie
-
setAttribute
- Overrides:
setAttribute
in classCookie
-
toString
-