Class DslPart

  • All Implemented Interfaces:

    
    public abstract class DslPart
    
                        

    Abstract base class to support Object and Array JSON DSL builders

    • Method Detail

      • getParent

         final DslPart getParent()

        Returns the parent of this part (object or array)

      • getBody

         abstract JsonValue getBody()
      • eachLike

         abstract PactDslJsonBody eachLike(String name)

        Array field where each element must match the following object

        Parameters:
        name - field name
      • eachLike

         abstract PactDslJsonBody eachLike()

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

      • eachLike

         abstract 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

         abstract PactDslJsonBody eachLike(Integer numberExamples)

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

        Parameters:
        numberExamples - number of examples to generate
      • minArrayLike

         abstract 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

         abstract 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

         abstract 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

         abstract 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

         abstract 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

         abstract 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

         abstract 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

         abstract 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

         abstract 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

         abstract 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

         abstract 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

         abstract 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

         abstract 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

         abstract 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
      • eachArrayLike

         abstract PactDslJsonArray eachArrayLike(String name)

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

        Parameters:
        name - field name
      • eachArrayLike

         abstract PactDslJsonArray eachArrayLike()

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

      • eachArrayLike

         abstract 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

         abstract 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
      • eachArrayWithMaxLike

         abstract PactDslJsonArray eachArrayWithMaxLike(String name, Integer size)

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

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

         abstract 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

         abstract 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

         abstract 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

         abstract PactDslJsonArray eachArrayWithMinLike(String name, Integer size)

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

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

         abstract 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

         abstract 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

         abstract 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

         abstract 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

         abstract 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
      • close

         abstract DslPart close()

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

      • matchUrl

         abstract 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

         abstract 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

         abstract 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

         abstract 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

         abstract 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
      • regex

         final static RegexMatcher regex(String regex, String example)

        Returns a regular expression matcher

        Parameters:
        regex - Regex to match with
        example - Example value to use
      • regex

         final static RegexMatcher regex(String regex)

        Returns a regular expression matcher. Will generate random examples from the regex.

        Parameters:
        regex - Regex to match with