Record Class ContractCase

java.lang.Object
java.lang.Record
com.arc_e_tect.gradle.apionly.transcriberj.spi.ContractCase
Record Components:
id - readable, unique within its operation and the same on every run
kind - what the case tests
requiresState - whether a target must be put in a particular state before the request is sent: true for CaseKind.SUCCESS and CaseKind.NOT_FOUND
variant - for a success case, which valid request it sends: required, full or noBody; null for every other kind
description - one sentence saying what the case sends
in - for an invalid-request case, where the fault is: path, query, header or body; null otherwise
name - for an invalid-request case, the parameter's name, or null
pointer - for an invalid-request case, the JSON pointer into the body, or null
keyword - for an invalid-request case, the violated keyword; null otherwise
request - the complete request
expectedStatus - the status the contract declares for it
expectedContentTypes - every content type that response is declared with; empty when it has no content
responseBodyClass - the simple name of the generated class of that response's body, or null
operationId - the operation's operationId, or null
declaredQuery - every query parameter the operation declares, in declaration order
declaredHeaders - every header parameter the operation declares, in declaration order, without Accept, Content-Type and Authorization
index - the case's position in its operation's CASES

public record ContractCase(String id, CaseKind kind, boolean requiresState, String variant, String description, String in, String name, String pointer, String keyword, ContractRequest request, int expectedStatus, List<String> expectedContentTypes, String responseBodyClass, String operationId, List<String> declaredQuery, List<String> declaredHeaders, int index) extends Record
One contract case, as an emitter is given it: the values the generated ContractCase of the base package holds, and the case's index in its operation's CASES.
  • Constructor Details

    • ContractCase

      public ContractCase(String id, CaseKind kind, boolean requiresState, String variant, String description, String in, String name, String pointer, String keyword, ContractRequest request, int expectedStatus, List<String> expectedContentTypes, String responseBodyClass, String operationId, List<String> declaredQuery, List<String> declaredHeaders, int index)
      A case, with its lists copied so that they cannot change.
      Parameters:
      id - the id
      kind - the kind
      requiresState - whether it requires state
      variant - the success variant, or null
      description - the description
      in - where an invalid request's fault is, or null
      name - the parameter's name, or null
      pointer - the pointer into the body, or null
      keyword - the violated keyword, or null
      request - the request
      expectedStatus - the expected status
      expectedContentTypes - the expected content types
      responseBodyClass - the response body's class, or null
      operationId - the operation's id, or null
      declaredQuery - the declared query parameters
      declaredHeaders - the declared headers
      index - the position in CASES
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • id

      public String id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component
    • kind

      public CaseKind kind()
      Returns the value of the kind record component.
      Returns:
      the value of the kind record component
    • requiresState

      public boolean requiresState()
      Returns the value of the requiresState record component.
      Returns:
      the value of the requiresState record component
    • variant

      public String variant()
      Returns the value of the variant record component.
      Returns:
      the value of the variant record component
    • description

      public String description()
      Returns the value of the description record component.
      Returns:
      the value of the description record component
    • in

      public String in()
      Returns the value of the in record component.
      Returns:
      the value of the in record component
    • name

      public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • pointer

      public String pointer()
      Returns the value of the pointer record component.
      Returns:
      the value of the pointer record component
    • keyword

      public String keyword()
      Returns the value of the keyword record component.
      Returns:
      the value of the keyword record component
    • request

      public ContractRequest request()
      Returns the value of the request record component.
      Returns:
      the value of the request record component
    • expectedStatus

      public int expectedStatus()
      Returns the value of the expectedStatus record component.
      Returns:
      the value of the expectedStatus record component
    • expectedContentTypes

      public List<String> expectedContentTypes()
      Returns the value of the expectedContentTypes record component.
      Returns:
      the value of the expectedContentTypes record component
    • responseBodyClass

      public String responseBodyClass()
      Returns the value of the responseBodyClass record component.
      Returns:
      the value of the responseBodyClass record component
    • operationId

      public String operationId()
      Returns the value of the operationId record component.
      Returns:
      the value of the operationId record component
    • declaredQuery

      public List<String> declaredQuery()
      Returns the value of the declaredQuery record component.
      Returns:
      the value of the declaredQuery record component
    • declaredHeaders

      public List<String> declaredHeaders()
      Returns the value of the declaredHeaders record component.
      Returns:
      the value of the declaredHeaders record component
    • index

      public int index()
      Returns the value of the index record component.
      Returns:
      the value of the index record component