Class ResponseCookiesSnippet

All Implemented Interfaces:
Snippet

public class ResponseCookiesSnippet extends AbstractCookiesSnippet
A Snippet that documents the cookies in a response.
Since:
3.0
Author:
Clyde Stubbs, Andy Wilkinson
See Also:
  • Constructor Details

    • ResponseCookiesSnippet

      protected ResponseCookiesSnippet(List<CookieDescriptor> descriptors)
      Creates a new ResponseCookiesSnippet that will document the cookies in the response using the given descriptors.
      Parameters:
      descriptors - the descriptors
    • ResponseCookiesSnippet

      protected ResponseCookiesSnippet(List<CookieDescriptor> descriptors, boolean ignoreUndocumentedCookies)
      Creates a new ResponseCookiesSnippet that will document the cookies in the response using the given descriptors. If ignoreUndocumentedCookies is true, undocumented cookies will be ignored and will not trigger a failure.
      Parameters:
      descriptors - the descriptors
      ignoreUndocumentedCookies - whether undocumented cookies should be ignored
    • ResponseCookiesSnippet

      protected ResponseCookiesSnippet(List<CookieDescriptor> descriptors, Map<String,Object> attributes)
      Creates a new ResponseCookiesSnippet that will document the cookies in the response using the given descriptors. The given attributes will be included in the model during template rendering. Undocumented cookies will not be ignored.
      Parameters:
      descriptors - the descriptors
      attributes - the additional attributes
    • ResponseCookiesSnippet

      protected ResponseCookiesSnippet(List<CookieDescriptor> descriptors, Map<String,Object> attributes, boolean ignoreUndocumentedCookies)
      Creates a new ResponseCookiesSnippet that will document the cookies in the response using the given descriptors. The given attributes will be included in the model during template rendering.
      Parameters:
      descriptors - the descriptors
      attributes - the additional attributes
      ignoreUndocumentedCookies - whether undocumented cookies should be ignored
  • Method Details

    • extractActualCookies

      protected Set<String> extractActualCookies(Operation operation)
      Description copied from class: AbstractCookiesSnippet
      Extracts the names of the cookies from the request or response of the given operation.
      Specified by:
      extractActualCookies in class AbstractCookiesSnippet
      Parameters:
      operation - the operation
      Returns:
      the cookie names
    • verificationFailed

      protected void verificationFailed(Set<String> undocumentedCookies, Set<String> missingCookies)
      Description copied from class: AbstractCookiesSnippet
      Called when the documented cookies do not match the actual cookies.
      Specified by:
      verificationFailed in class AbstractCookiesSnippet
      Parameters:
      undocumentedCookies - the cookies that were found in the operation but were not documented
      missingCookies - the cookies that were documented but were not found in the operation
    • and

      public final ResponseCookiesSnippet and(CookieDescriptor... additionalDescriptors)
      Returns a new ResponseCookiesSnippet configured with this snippet's attributes and its descriptors combined with the given additionalDescriptors.
      Parameters:
      additionalDescriptors - the additional descriptors
      Returns:
      the new snippet
    • and

      public final ResponseCookiesSnippet and(List<CookieDescriptor> additionalDescriptors)
      Returns a new ResponseCookiesSnippet configured with this snippet's attributes and its descriptors combined with the given additionalDescriptors.
      Parameters:
      additionalDescriptors - the additional descriptors
      Returns:
      the new snippet