Class RequestCookiesSnippet

All Implemented Interfaces:
Snippet

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

    • RequestCookiesSnippet

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

      protected RequestCookiesSnippet(List<CookieDescriptor> descriptors, boolean ignoreUndocumentedCookies)
      Creates a new RequestCookiesSnippet that will document the cookies in the request 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
    • RequestCookiesSnippet

      protected RequestCookiesSnippet(List<CookieDescriptor> descriptors, Map<String,Object> attributes)
      Creates a new RequestCookiesSnippet that will document the cookies in the request 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
    • RequestCookiesSnippet

      protected RequestCookiesSnippet(List<CookieDescriptor> descriptors, Map<String,Object> attributes, boolean ignoreUndocumentedCookies)
      Creates a new RequestCookiesSnippet that will document the cookies in the request 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 RequestCookiesSnippet and(CookieDescriptor... additionalDescriptors)
      Returns a new RequestCookiesSnippet 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 RequestCookiesSnippet and(List<CookieDescriptor> additionalDescriptors)
      Returns a new RequestCookiesSnippet configured with this snippet's attributes and its descriptors combined with the given additionalDescriptors.
      Parameters:
      additionalDescriptors - the additional descriptors
      Returns:
      the new snippet