Class ResponseCookiesSnippet
java.lang.Object
org.springframework.restdocs.snippet.TemplatedSnippet
org.springframework.restdocs.cookies.AbstractCookiesSnippet
org.springframework.restdocs.cookies.ResponseCookiesSnippet
- All Implemented Interfaces:
Snippet
A
Snippet that documents the cookies in a response.- Since:
- 3.0
- Author:
- Clyde Stubbs, Andy Wilkinson
- See Also:
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedResponseCookiesSnippet(List<CookieDescriptor> descriptors) Creates a newResponseCookiesSnippetthat will document the cookies in the response using the givendescriptors.protectedResponseCookiesSnippet(List<CookieDescriptor> descriptors, boolean ignoreUndocumentedCookies) Creates a newResponseCookiesSnippetthat will document the cookies in the response using the givendescriptors.protectedResponseCookiesSnippet(List<CookieDescriptor> descriptors, Map<String, Object> attributes) Creates a newResponseCookiesSnippetthat will document the cookies in the response using the givendescriptors.protectedResponseCookiesSnippet(List<CookieDescriptor> descriptors, Map<String, Object> attributes, boolean ignoreUndocumentedCookies) Creates a newResponseCookiesSnippetthat will document the cookies in the response using the givendescriptors. -
Method Summary
Modifier and TypeMethodDescriptionfinal ResponseCookiesSnippetand(List<CookieDescriptor> additionalDescriptors) Returns a newResponseCookiesSnippetconfigured with this snippet's attributes and its descriptors combined with the givenadditionalDescriptors.final ResponseCookiesSnippetand(CookieDescriptor... additionalDescriptors) Returns a newResponseCookiesSnippetconfigured with this snippet's attributes and its descriptors combined with the givenadditionalDescriptors.extractActualCookies(Operation operation) Extracts the names of the cookies from the request or response of the givenoperation.protected voidverificationFailed(Set<String> undocumentedCookies, Set<String> missingCookies) Called when the documented cookies do not match the actual cookies.Methods inherited from class org.springframework.restdocs.cookies.AbstractCookiesSnippet
createModel, createModelForDescriptor, getCookieDescriptors, isIgnoreUndocumentedCookiesMethods inherited from class org.springframework.restdocs.snippet.TemplatedSnippet
document, getAttributes, getSnippetName
-
Constructor Details
-
ResponseCookiesSnippet
Creates a newResponseCookiesSnippetthat will document the cookies in the response using the givendescriptors.- Parameters:
descriptors- the descriptors
-
ResponseCookiesSnippet
protected ResponseCookiesSnippet(List<CookieDescriptor> descriptors, boolean ignoreUndocumentedCookies) Creates a newResponseCookiesSnippetthat will document the cookies in the response using the givendescriptors. IfignoreUndocumentedCookiesistrue, undocumented cookies will be ignored and will not trigger a failure.- Parameters:
descriptors- the descriptorsignoreUndocumentedCookies- whether undocumented cookies should be ignored
-
ResponseCookiesSnippet
Creates a newResponseCookiesSnippetthat will document the cookies in the response using the givendescriptors. The givenattributeswill be included in the model during template rendering. Undocumented cookies will not be ignored.- Parameters:
descriptors- the descriptorsattributes- the additional attributes
-
ResponseCookiesSnippet
protected ResponseCookiesSnippet(List<CookieDescriptor> descriptors, Map<String, Object> attributes, boolean ignoreUndocumentedCookies) Creates a newResponseCookiesSnippetthat will document the cookies in the response using the givendescriptors. The givenattributeswill be included in the model during template rendering.- Parameters:
descriptors- the descriptorsattributes- the additional attributesignoreUndocumentedCookies- whether undocumented cookies should be ignored
-
-
Method Details
-
extractActualCookies
Description copied from class:AbstractCookiesSnippetExtracts the names of the cookies from the request or response of the givenoperation.- Specified by:
extractActualCookiesin classAbstractCookiesSnippet- Parameters:
operation- the operation- Returns:
- the cookie names
-
verificationFailed
Description copied from class:AbstractCookiesSnippetCalled when the documented cookies do not match the actual cookies.- Specified by:
verificationFailedin classAbstractCookiesSnippet- Parameters:
undocumentedCookies- the cookies that were found in the operation but were not documentedmissingCookies- the cookies that were documented but were not found in the operation
-
and
Returns a newResponseCookiesSnippetconfigured with this snippet's attributes and its descriptors combined with the givenadditionalDescriptors.- Parameters:
additionalDescriptors- the additional descriptors- Returns:
- the new snippet
-
and
Returns a newResponseCookiesSnippetconfigured with this snippet's attributes and its descriptors combined with the givenadditionalDescriptors.- Parameters:
additionalDescriptors- the additional descriptors- Returns:
- the new snippet
-