Class PactDslRootValue

  • All Implemented Interfaces:

    
    public class PactDslRootValue
    extends DslPart
                        

    Matcher to create a plain root matching strategy. Used with text/plain to match regex responses

    • Constructor Detail

      • PactDslRootValue

        PactDslRootValue()
    • Method Detail

      • eachLike

        @Deprecated(message = "Use PactDslJsonArray for arrays") PactDslJsonBody eachLike(String name)

        Array field where each element must match the following object

        Parameters:
        name - field name
      • eachLike

        @Deprecated(message = "Use PactDslJsonArray for arrays") PactDslJsonBody eachLike(Integer numberExamples)

        Array element where each element of the array must match the following object

        Parameters:
        numberExamples - number of examples to generate
      • eachLike

        @Deprecated(message = "Use PactDslJsonArray for arrays") PactDslJsonBody eachLike(String name, Integer numberExamples)

        Array field where each element must match the following object

        Parameters:
        name - field name
        numberExamples - number of examples to generate
      • eachLike

        @Deprecated(message = "Use PactDslJsonArray for arrays") PactDslJsonBody eachLike()

        Array element where each element of the array must match the following object

      • minArrayLike

        @Deprecated(message = "Use PactDslJsonArray for arrays") PactDslJsonBody minArrayLike(String name, Integer size)

        Array field with a minimum size and each element must match the following object

        Parameters:
        name - field name
        size - minimum size
      • minArrayLike

        @Deprecated(message = "Use PactDslJsonArray for arrays") PactDslJsonBody minArrayLike(Integer size)

        Array element with a minimum size and each element of the array must match the following object

        Parameters:
        size - minimum size
      • minArrayLike

        @Deprecated(message = "Use PactDslJsonArray for arrays") PactDslJsonBody minArrayLike(String name, Integer size, Integer numberExamples)

        Array field with a minumum size and each element must match the following object

        Parameters:
        name - field name
        size - minimum size
        numberExamples - number of examples to generate
      • minArrayLike

        @Deprecated(message = "Use PactDslJsonArray for arrays") PactDslJsonBody minArrayLike(Integer size, Integer numberExamples)

        Array element with a minimum size and each element of the array must match the following object

        Parameters:
        size - minimum size
        numberExamples - number of examples to generate
      • maxArrayLike

        @Deprecated(message = "Use PactDslJsonArray for arrays") PactDslJsonBody maxArrayLike(String name, Integer size)

        Array field with a maximum size and each element must match the following object

        Parameters:
        name - field name
        size - maximum size
      • maxArrayLike

        @Deprecated(message = "Use PactDslJsonArray for arrays") PactDslJsonBody maxArrayLike(Integer size)

        Array element with a maximum size and each element of the array must match the following object

        Parameters:
        size - maximum size
      • maxArrayLike

        @Deprecated(message = "Use PactDslJsonArray for arrays") PactDslJsonBody maxArrayLike(String name, Integer size, Integer numberExamples)

        Array field with a maximum size and each element must match the following object

        Parameters:
        name - field name
        size - maximum size
        numberExamples - number of examples to generate
      • maxArrayLike

        @Deprecated(message = "Use PactDslJsonArray for arrays") PactDslJsonBody maxArrayLike(Integer size, Integer numberExamples)

        Array element with a maximum size and each element of the array must match the following object

        Parameters:
        size - maximum size
        numberExamples - number of examples to generate
      • minMaxArrayLike

        @Deprecated(message = "Use PactDslJsonArray for arrays") PactDslJsonBody minMaxArrayLike(String name, Integer minSize, Integer maxSize)

        Array field with a minimum and maximum size and each element must match the following object

        Parameters:
        name - field name
        minSize - minimum size
        maxSize - maximum size
      • minMaxArrayLike

        @Deprecated(message = "Use PactDslJsonArray for arrays") PactDslJsonBody minMaxArrayLike(String name, Integer minSize, Integer maxSize, DslPart obj)

        Array field with a minimum and maximum size and each element must match the provided object

        Parameters:
        name - field name
        minSize - minimum size
        maxSize - maximum size
      • minMaxArrayLike

        @Deprecated(message = "Use PactDslJsonArray for arrays") PactDslJsonBody minMaxArrayLike(Integer minSize, Integer maxSize)

        Array element with a minimum and maximum size and each element of the array must match the following object

        Parameters:
        minSize - minimum size
        maxSize - maximum size
      • minMaxArrayLike

        @Deprecated(message = "Use PactDslJsonArray for arrays") PactDslJsonArray minMaxArrayLike(Integer minSize, Integer maxSize, DslPart obj)

        Array element with a minimum and maximum size and each element of the array must match the provided object

        Parameters:
        minSize - minimum size
        maxSize - maximum size
      • minMaxArrayLike

        @Deprecated(message = "Use PactDslJsonArray for arrays") PactDslJsonBody minMaxArrayLike(String name, Integer minSize, Integer maxSize, Integer numberExamples)

        Array field with a minimum and maximum size and each element must match the following object

        Parameters:
        name - field name
        minSize - minimum size
        maxSize - maximum size
        numberExamples - number of examples to generate
      • minMaxArrayLike

        @Deprecated(message = "Use PactDslJsonArray for arrays") PactDslJsonBody minMaxArrayLike(Integer minSize, Integer maxSize, Integer numberExamples)

        Array element with a minimum and maximum size and each element of the array must match the following object

        Parameters:
        minSize - minimum size
        maxSize - maximum size
        numberExamples - number of examples to generate
      • close

         DslPart close()

        This closes off the object graph build from the DSL in case any closeObject|Array methods have not been called.

      • eachArrayLike

        @Deprecated(message = "Use PactDslJsonArray for arrays") PactDslJsonArray eachArrayLike(String name)

        Array field where each element is an array and must match the following object

        Parameters:
        name - field name
      • eachArrayLike

        @Deprecated(message = "Use PactDslJsonArray for arrays") PactDslJsonArray eachArrayLike(Integer numberExamples)

        Array element where each element of the array is an array and must match the following object

        Parameters:
        numberExamples - number of examples to generate
      • eachArrayLike

        @Deprecated(message = "Use PactDslJsonArray for arrays") PactDslJsonArray eachArrayLike(String name, Integer numberExamples)

        Array field where each element is an array and must match the following object

        Parameters:
        name - field name
        numberExamples - number of examples to generate
      • eachArrayLike

        @Deprecated(message = "Use PactDslJsonArray for arrays") PactDslJsonArray eachArrayLike()

        Array element where each element of the array is an array and must match the following object

      • eachArrayWithMaxLike

        @Deprecated(message = "Use PactDslJsonArray for arrays") PactDslJsonArray eachArrayWithMaxLike(Integer size)

        Array element where each element of the array is an array and must match the following object

        Parameters:
        size - Maximum size of the outer array
      • eachArrayWithMaxLike

        @Deprecated(message = "Use PactDslJsonArray for arrays") PactDslJsonArray eachArrayWithMaxLike(String name, Integer numberExamples, Integer size)

        Array field where each element is an array and must match the following object

        Parameters:
        name - field name
        numberExamples - number of examples to generate
        size - Maximum size of the outer array
      • eachArrayWithMaxLike

        @Deprecated(message = "Use PactDslJsonArray for arrays") PactDslJsonArray eachArrayWithMaxLike(Integer numberExamples, Integer size)

        Array element where each element of the array is an array and must match the following object

        Parameters:
        numberExamples - number of examples to generate
        size - Maximum size of the outer array
      • eachArrayWithMinLike

        @Deprecated(message = "Use PactDslJsonArray for arrays") PactDslJsonArray eachArrayWithMinLike(Integer size)

        Array element where each element of the array is an array and must match the following object

        Parameters:
        size - Minimum size of the outer array
      • eachArrayWithMinLike

        @Deprecated(message = "Use PactDslJsonArray for arrays") PactDslJsonArray eachArrayWithMinLike(String name, Integer numberExamples, Integer size)

        Array field where each element is an array and must match the following object

        Parameters:
        name - field name
        numberExamples - number of examples to generate
        size - Minimum size of the outer array
      • eachArrayWithMinLike

        @Deprecated(message = "Use PactDslJsonArray for arrays") PactDslJsonArray eachArrayWithMinLike(Integer numberExamples, Integer size)

        Array element where each element of the array is an array and must match the following object

        Parameters:
        numberExamples - number of examples to generate
        size - Minimum size of the outer array
      • eachArrayWithMinMaxLike

        @Deprecated(message = "Use PactDslJsonArray for arrays") PactDslJsonArray eachArrayWithMinMaxLike(String name, Integer numberExamples, Integer minSize, Integer maxSize)

        Array field where each element is an array and must match the following object

        Parameters:
        name - field name
        numberExamples - number of examples to generate
        minSize - minimum size
        maxSize - maximum size
      • eachArrayWithMinMaxLike

        @Deprecated(message = "Use PactDslJsonArray for arrays") PactDslJsonArray eachArrayWithMinMaxLike(Integer numberExamples, Integer minSize, Integer maxSize)

        Array element where each element of the array is an array and must match the following object

        Parameters:
        numberExamples - number of examples to generate
        minSize - minimum size
        maxSize - maximum size
      • matchUrl

         DslPart matchUrl(String name, String basePath, Object pathFragments)

        Matches a URL that is composed of a base path and a sequence of path expressions

        Parameters:
        name - Attribute name
        basePath - The base path for the URL (like "http://localhost:8080/") which will be excluded from the matching
        pathFragments - Series of path fragments to match on.
      • matchUrl

         DslPart matchUrl(String basePath, Object pathFragments)

        Matches a URL that is composed of a base path and a sequence of path expressions

        Parameters:
        basePath - The base path for the URL (like "http://localhost:8080/") which will be excluded from the matching
        pathFragments - Series of path fragments to match on.
      • matchUrl2

         DslPart matchUrl2(String name, Object pathFragments)

        Matches a URL that is composed of a base path and a sequence of path expressions. Base path from the mock server will be used.

        Parameters:
        name - Attribute name
        pathFragments - Series of path fragments to match on.
      • matchUrl2

         DslPart matchUrl2(Object pathFragments)

        Matches a URL that is composed of a base path and a sequence of path expressions. Base path from the mock server

        • will be used.

        Parameters:
        pathFragments - Series of path fragments to match on.
      • arrayContaining

         DslPart arrayContaining(String name)

        Matches the items in an array against a number of variants. Matching is successful if each variant occurs once in the array. Variants may be objects containing matching rules.

        Parameters:
        name - Attribute name
      • stringType

         final static PactDslRootValue stringType(String example)

        Value that can be any string

        Parameters:
        example - example value to use for generated bodies
      • numberType

         final static PactDslRootValue numberType(Number number)

        Value that can be any number

        Parameters:
        number - example number to use for generated bodies
      • integerType

         final static PactDslRootValue integerType(Long number)

        Value that must be an integer

        Parameters:
        number - example integer value to use for generated bodies
      • integerType

         final static PactDslRootValue integerType(Integer number)

        Value that must be an integer

        Parameters:
        number - example integer value to use for generated bodies
      • decimalType

         final static PactDslRootValue decimalType()

        Value that must be a decimal value (has significant digits after the decimal point)

      • decimalType

         final static PactDslRootValue decimalType(BigDecimal number)

        Value that must be a decimalType value (has significant digits after the decimal point)

        Parameters:
        number - example decimalType value
      • decimalType

         final static PactDslRootValue decimalType(Double number)

        Value that must be a decimalType value (has significant digits after the decimal point)

        Parameters:
        number - example decimalType value
      • numberMatching

         final static PactDslRootValue numberMatching(String regex, Number example)

        Attribute that can be any number and which must match the provided regular expression

        Parameters:
        regex - Regular expression that the numbers string form must match
        example - example number to use for generated bodies
      • decimalMatching

         final static PactDslRootValue decimalMatching(String regex, Double example)

        Attribute that can be any number decimal number (has significant digits after the decimal point) and which must match the provided regular expression

        Parameters:
        regex - Regular expression that the numbers string form must match
        example - example number to use for generated bodies
      • integerMatching

         final static PactDslRootValue integerMatching(String regex, Integer example)

        Attribute that can be any integer and which must match the provided regular expression

        Parameters:
        regex - Regular expression that the numbers string form must match
        example - example integer to use for generated bodies
      • stringMatcher

         final static PactDslRootValue stringMatcher(String regex, String value)

        Value that must match the regular expression

        Parameters:
        regex - regular expression
        value - example value to use for generated bodies
      • timestamp

         final static PactDslRootValue timestamp(String format, Date example)

        Value that must match the given timestamp format

        Parameters:
        format - timestamp format
        example - example date and time to use for generated bodies
      • date

         final static PactDslRootValue date(String format, Date example)

        Value that must match the provided date format

        Parameters:
        format - date format to match
        example - example date to use for generated values
      • time

         final static PactDslRootValue time(String format, Date example)

        Value that must match the given time format

        Parameters:
        format - time format to match
        example - example time to use for generated bodies
      • id

         final static PactDslRootValue id(Long id)

        Value that must be a numeric identifier

        Parameters:
        id - example id to use for generated bodies
      • hexValue

         final static PactDslRootValue hexValue(String hexValue)

        Value that must be encoded as a hexadecimal value

        Parameters:
        hexValue - example value to use for generated bodies
      • uuid

         final static PactDslRootValue uuid(UUID uuid)

        Value that must be encoded as an UUID

        Parameters:
        uuid - example UUID to use for generated bodies
      • uuid

         final static PactDslRootValue uuid(String uuid)

        Value that must be encoded as an UUID

        Parameters:
        uuid - example UUID to use for generated bodies
      • and

         final static PactDslRootValue and(Object example, MatchingRule rules)

        Combine all the matchers using AND

        Parameters:
        example - Attribute example value
        rules - Matching rules to apply
      • or

         final static PactDslRootValue or(Object example, MatchingRule rules)

        Combine all the matchers using OR

        Parameters:
        example - Attribute name
        rules - Matching rules to apply
      • valueFromProviderState

         final static PactDslRootValue valueFromProviderState(String expression, Object example)

        Adds a value that will have it's value injected from the provider state

        Parameters:
        expression - Expression to be evaluated from the provider state
        example - Example value to be used in the consumer test