spring-framework / org.springframework.test.web.servlet.result / CookieResultMatchers

CookieResultMatchers

open class CookieResultMatchers

Factory for response cookie assertions.

An instance of this class is typically accessed via MockMvcResultMatchers#cookie.

Author
Rossen Stoyanchev

Author
Thomas Bruyelle

Since
3.2

Functions

comment

open fun comment(name: String, matcher: Matcher<in String>): ResultMatcher

Assert a cookie's comment with a Hamcrest Matcher.

open fun comment(name: String, comment: String): ResultMatcher

Assert a cookie's comment value.

doesNotExist

open fun doesNotExist(name: String): ResultMatcher

Assert a cookie does not exist. Note that the existence check is irrespective of whether max age is 0, i.e. expired.

domain

open fun domain(name: String, matcher: Matcher<in String>): ResultMatcher

Assert a cookie's domain with a Hamcrest Matcher.

open fun domain(name: String, domain: String): ResultMatcher

Assert a cookie's domain value.

exists

open fun exists(name: String): ResultMatcher

Assert a cookie exists. The existence check is irrespective of whether max age is 0 (i.e. expired).

httpOnly

open fun httpOnly(name: String, httpOnly: Boolean): ResultMatcher

Assert whether the cookie must be HTTP only.

maxAge

open fun maxAge(name: String, matcher: Matcher<in Int>): ResultMatcher

Assert a cookie's maxAge with a Hamcrest Matcher.

open fun maxAge(name: String, maxAge: Int): ResultMatcher

Assert a cookie's maxAge value.

path

open fun path(name: String, matcher: Matcher<in String>): ResultMatcher

Assert a cookie path with a Hamcrest Matcher.

open fun path(name: String, path: String): ResultMatcher

secure

open fun secure(name: String, secure: Boolean): ResultMatcher

Assert whether the cookie must be sent over a secure protocol or not.

value

open fun value(name: String, matcher: Matcher<in String>): ResultMatcher

Assert a cookie value with the given Hamcrest Matcher.

open fun value(name: String, expectedValue: String): ResultMatcher

Assert a cookie value.

version

open fun version(name: String, matcher: Matcher<in Int>): ResultMatcher

Assert a cookie's version with a Hamcrest Matcher

open fun version(name: String, version: Int): ResultMatcher

Assert a cookie's version value.