-
- 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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classFormPostBuilder.Companion
-
Constructor Summary
Constructors Constructor Description FormPostBuilder(ContentType contentType)FormPostBuilder(Map<String, List<String>> body, ContentType contentType, MatchingRuleCategory matchers, Generators generators)
-
Method Summary
Modifier and Type Method Description final Map<String, List<String>>getBody()final FormPostBuilderstringValue(String name, String value)Attribute that must be have the specified value final FormPostBuilderstringValue(String name, String values)Attribute that must be have the specified values final FormPostBuilderstringMatcher(String name, String regex, String value)Attribute that must match the regular expression final FormPostBuilderstringMatcher(String name, String regex, String values)Attribute that must match the regular expression final FormPostBuilderstringMatcher(String name, String regex)Attribute that must match the regular expression final FormPostBuilderdatetime(String name)Attribute that must be an ISO formatted datetime final FormPostBuilderdatetime(String name, String format)Attribute that must match the given datetime format final FormPostBuilderdatetime(String name, String format, Date example)Attribute that must match the given datetime format final FormPostBuilderdatetime(String name, String format, Date example, TimeZone timeZone)Attribute that must match the given datetime format final FormPostBuilderdatetime(String name, String format, Instant example)Attribute that must match the given datetime format final FormPostBuilderdatetime(String name, String format, Instant example, TimeZone timeZone)Attribute that must match the given datetime format final FormPostBuilderdate(String name)Attribute that must be formatted as an ISO date final FormPostBuilderdate(String name, String format)Attribute that must match the provided date format final FormPostBuilderdate(String name, String format, Date example)Attribute that must match the provided date format final FormPostBuilderdate(String name, String format, Date example, TimeZone timeZone)Attribute that must match the provided date format final FormPostBuildertime(String name)Attribute that must be an ISO formatted time final FormPostBuildertime(String name, String format)Attribute that must match the given time format final FormPostBuildertime(String name, String format, Date example)Attribute that must match the given time format final FormPostBuildertime(String name, String format, Date example, TimeZone timeZone)Attribute that must match the given time format final FormPostBuilderhexValue(String name)Attribute that must be encoded as a hexadecimal value final FormPostBuilderhexValue(String name, String hexValue)Attribute that must be encoded as a hexadecimal value final FormPostBuilderuuid(String name)Attribute that must be encoded as an UUID final FormPostBuilderuuid(String name, UUID uuid)Attribute that must be encoded as an UUID final FormPostBuilderuuid(String name, String uuid)Attribute that must be encoded as an UUID final FormPostBuilderincludesString(String name, String value)Attribute that must include the provided string value final FormPostBuilderparameterFromProviderState(String name, String expression, String example)Adds an attribute that will have it's value injected from the provider state final FormPostBuilderdateExpression(String name, String expression)Adds a date attribute formatted as an ISO date with the value generated by the date expression final FormPostBuilderdateExpression(String name, String expression, String format)Adds a date attribute with the value generated by the date expression final FormPostBuildertimeExpression(String name, String expression)Adds a time attribute formatted as an ISO time with the value generated by the time expression final FormPostBuildertimeExpression(String name, String expression, String format)Adds a time attribute with the value generated by the time expression final FormPostBuilderdatetimeExpression(String name, String expression)Adds a datetime attribute formatted as an ISO datetime with the value generated by the expression final FormPostBuilderdatetimeExpression(String name, String expression, String format)Adds a datetime attribute with the value generated by the expression MatchingRuleCategorygetMatchers()Returns the matchers for the body GeneratorsgetGenerators()Returns the generators for the body ContentTypegetContentType()Returns the content type for the body ByteArraybuildBody()Constructs the body returning the contents as a byte array -
-
Method Detail
-
stringValue
final FormPostBuilder stringValue(String name, String value)
Attribute that must be have the specified value
- Parameters:
name- attribute namevalue- string value
-
stringValue
final FormPostBuilder stringValue(String name, String values)
Attribute that must be have the specified values
- Parameters:
name- attribute namevalues- string values
-
stringMatcher
final FormPostBuilder stringMatcher(String name, String regex, String value)
Attribute that must match the regular expression
- Parameters:
name- attribute nameregex- regular expressionvalue- 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 nameregex- regular expressionvalues- example values to use for generated bodies
-
stringMatcher
final FormPostBuilder stringMatcher(String name, String regex)
Attribute that must match the regular expression
- Parameters:
name- attribute nameregex- regular expression
-
datetime
final FormPostBuilder datetime(String name)
Attribute that must be an ISO formatted datetime
-
datetime
final FormPostBuilder datetime(String name, String format)
Attribute that must match the given datetime format
- Parameters:
name- attribute nameformat- datetime format
-
datetime
final FormPostBuilder datetime(String name, String format, Date example)
Attribute that must match the given datetime format
- Parameters:
name- attribute nameformat- datetime formatexample- 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 nameformat- datetime formatexample- example date and time to use for generated bodiestimeZone- 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 nameformat- datetime formatexample- 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 nameformat- timestamp formatexample- example date and time to use for generated bodiestimeZone- 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 dateformat- 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 dateformat- date format to matchexample- 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 dateformat- date format to matchexample- example date to use for generated valuestimeZone- 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 nameformat- 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 nameformat- time format to matchexample- 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 nameformat- time format to matchexample- example time to use for generated bodiestimeZone- time zone used for formatting of example time
-
hexValue
final FormPostBuilder hexValue(String name)
Attribute that must be encoded as a hexadecimal value
- Parameters:
name- attribute name
-
hexValue
final FormPostBuilder hexValue(String name, String hexValue)
Attribute that must be encoded as a hexadecimal value
- Parameters:
name- attribute namehexValue- example value to use for generated bodies
-
uuid
final FormPostBuilder uuid(String name)
Attribute that must be encoded as an UUID
- Parameters:
name- attribute name
-
uuid
final FormPostBuilder uuid(String name, UUID uuid)
Attribute that must be encoded as an UUID
- Parameters:
name- attribute nameuuid- 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 nameuuid- 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 namevalue- 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 nameexpression- Expression to be evaluated from the provider stateexample- 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 nameexpression- 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 nameexpression- Date expression to use to generate the valuesformat- 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 nameexpression- 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 nameexpression- Time expression to use to generate the valuesformat- 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 nameexpression- 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 nameexpression- Datetime expression to use to generate the valuesformat- 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
-
-
-
-