Package 

Class FormPostBuilder

  • All Implemented Interfaces:
    au.com.dius.pact.consumer.dsl.BodyBuilder

    
    public final class FormPostBuilder
     implements BodyBuilder
                        

    Builder for constructing application/x-www-form-urlencoded bodies

    • Constructor Detail

      • FormPostBuilder

        FormPostBuilder(ContentType contentType)
      • FormPostBuilder

        FormPostBuilder(Map<String, List<String>> body, ContentType contentType, MatchingRuleCategory matchers, Generators generators)
    • Method Detail

      • stringMatcher

         final FormPostBuilder stringMatcher(String name, String regex, String value)

        Attribute that must match the regular expression

        Parameters:
        name - attribute name
        regex - regular expression
        value - example value to use for generated bodies
      • stringMatcher

         final FormPostBuilder stringMatcher(String name, String regex, String values)

        Attribute that must match the regular expression

        Parameters:
        name - attribute name
        regex - regular expression
        values - example values to use for generated bodies
      • datetime

         final FormPostBuilder datetime(String name, String format)

        Attribute that must match the given datetime format

        Parameters:
        name - attribute name
        format - datetime format
      • datetime

         final FormPostBuilder datetime(String name, String format, Date example)

        Attribute that must match the given datetime format

        Parameters:
        name - attribute name
        format - datetime format
        example - example date and time to use for generated bodies
      • datetime

         final FormPostBuilder datetime(String name, String format, Date example, TimeZone timeZone)

        Attribute that must match the given datetime format

        Parameters:
        name - attribute name
        format - datetime format
        example - example date and time to use for generated bodies
        timeZone - time zone used for formatting of example date and time
      • datetime

         final FormPostBuilder datetime(String name, String format, Instant example)

        Attribute that must match the given datetime format

        Parameters:
        name - attribute name
        format - datetime format
        example - example date and time to use for generated bodies
      • datetime

         final FormPostBuilder datetime(String name, String format, Instant example, TimeZone timeZone)

        Attribute that must match the given datetime format

        Parameters:
        name - attribute name
        format - timestamp format
        example - example date and time to use for generated bodies
        timeZone - time zone used for formatting of example date and time
      • date

         final FormPostBuilder date(String name)

        Attribute that must be formatted as an ISO date

        Parameters:
        name - attribute name
      • date

         final FormPostBuilder date(String name, String format)

        Attribute that must match the provided date format

        Parameters:
        name - attribute date
        format - date format to match
      • date

         final FormPostBuilder date(String name, String format, Date example)

        Attribute that must match the provided date format

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

         final FormPostBuilder date(String name, String format, Date example, TimeZone timeZone)

        Attribute that must match the provided date format

        Parameters:
        name - attribute date
        format - date format to match
        example - example date to use for generated values
        timeZone - time zone used for formatting of example date
      • time

         final FormPostBuilder time(String name)

        Attribute that must be an ISO formatted time

        Parameters:
        name - attribute name
      • time

         final FormPostBuilder time(String name, String format)

        Attribute that must match the given time format

        Parameters:
        name - attribute name
        format - time format to match
      • time

         final FormPostBuilder time(String name, String format, Date example)

        Attribute that must match the given time format

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

         final FormPostBuilder time(String name, String format, Date example, TimeZone timeZone)

        Attribute that must match the given time format

        Parameters:
        name - attribute name
        format - time format to match
        example - example time to use for generated bodies
        timeZone - time zone used for formatting of example time
      • hexValue

         final FormPostBuilder hexValue(String name, String hexValue)

        Attribute that must be encoded as a hexadecimal value

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

         final FormPostBuilder uuid(String name, UUID uuid)

        Attribute that must be encoded as an UUID

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

         final FormPostBuilder uuid(String name, String uuid)

        Attribute that must be encoded as an UUID

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

         final FormPostBuilder includesString(String name, String value)

        Attribute that must include the provided string value

        Parameters:
        name - attribute name
        value - Value that must be included
      • parameterFromProviderState

         final FormPostBuilder parameterFromProviderState(String name, String expression, String example)

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

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

         final FormPostBuilder dateExpression(String name, String expression)

        Adds a date attribute formatted as an ISO date with the value generated by the date expression

        Parameters:
        name - Attribute name
        expression - Date expression to use to generate the values
      • dateExpression

         final FormPostBuilder dateExpression(String name, String expression, String format)

        Adds a date attribute with the value generated by the date expression

        Parameters:
        name - Attribute name
        expression - Date expression to use to generate the values
        format - Date format to use
      • timeExpression

         final FormPostBuilder timeExpression(String name, String expression)

        Adds a time attribute formatted as an ISO time with the value generated by the time expression

        Parameters:
        name - Attribute name
        expression - Time expression to use to generate the values
      • timeExpression

         final FormPostBuilder timeExpression(String name, String expression, String format)

        Adds a time attribute with the value generated by the time expression

        Parameters:
        name - Attribute name
        expression - Time expression to use to generate the values
        format - Time format to use
      • datetimeExpression

         final FormPostBuilder datetimeExpression(String name, String expression)

        Adds a datetime attribute formatted as an ISO datetime with the value generated by the expression

        Parameters:
        name - Attribute name
        expression - Datetime expression to use to generate the values
      • datetimeExpression

         final FormPostBuilder datetimeExpression(String name, String expression, String format)

        Adds a datetime attribute with the value generated by the expression

        Parameters:
        name - Attribute name
        expression - Datetime expression to use to generate the values
        format - Datetime format to use
      • getMatchers

         MatchingRuleCategory getMatchers()

        Returns the matchers for the body

      • getGenerators

         Generators getGenerators()

        Returns the generators for the body

      • getContentType

         ContentType getContentType()

        Returns the content type for the body

      • buildBody

         ByteArray buildBody()

        Constructs the body returning the contents as a byte array