-
public class PactDslJsonBody extends DslPart
DSL to define a JSON Object
-
-
Constructor Summary
Constructors Constructor Description PactDslJsonBody()Constructs a new body as a root PactDslJsonBody(String rootPath, String rootName, DslPart parent)Constructs a new body as a child PactDslJsonBody(String rootPath, String rootName, DslPart parent, PactDslJsonBody body)Constructs a new body as a child as a copy of an existing one
-
Method Summary
Modifier and Type Method Description StringtoString()UnitputObjectPrivate(DslPart obj)UnitputArrayPrivate(DslPart obj)final PactDslJsonBodystringValue(String name, String value)Attribute that must be the specified value final PactDslJsonBodynumberValue(String name, Number value)Attribute that must be the specified number final PactDslJsonBodybooleanValue(String name, Boolean value)Attribute that must be the specified boolean PactDslJsonBodylike(String name, Object example)Attribute that must be the same type as the example final PactDslJsonBodystringType(String name)Attribute that can be any string final PactDslJsonBodystringType(Array<out String> names)Attributes that can be any string final PactDslJsonBodystringType(String name, String example)Attribute that can be any string final PactDslJsonBodynumberType(String name)Attribute that can be any number final PactDslJsonBodynumberType(Array<out String> names)Attributes that can be any number final PactDslJsonBodynumberType(String name, Number number)Attribute that can be any number final PactDslJsonBodyintegerType(String name)Attribute that must be an integer final PactDslJsonBodyintegerType(Array<out String> names)Attributes that must be an integer final PactDslJsonBodyintegerType(String name, Long number)Attribute that must be an integer final PactDslJsonBodyintegerType(String name, Integer number)Attribute that must be an integer final PactDslJsonBodydecimalType(String name)Attribute that must be a decimal value final PactDslJsonBodydecimalType(Array<out String> names)Attributes that must be a decimal values final PactDslJsonBodydecimalType(String name, BigDecimal number)Attribute that must be a decimalType value final PactDslJsonBodydecimalType(String name, Double number)Attribute that must be a decimalType value final PactDslJsonBodybooleanType(Array<out String> names)Attributes that must be a boolean final PactDslJsonBodybooleanType(String name, Boolean example)Attribute that must be a boolean final PactDslJsonBodystringMatcher(String name, String regex, String value)Attribute that must match the regular expression final PactDslJsonBodystringMatcher(String name, String regex)Attribute that must match the regular expression final PactDslJsonBodytimestamp()Attribute named 'timestamp' that must be an ISO formatted timestamp final PactDslJsonBodytimestamp(String name)Attribute that must be an ISO formatted timestamp final PactDslJsonBodytimestamp(String name, String format)Attribute that must match the given datetime format final PactDslJsonBodytimestamp(String name, String format, Date example)Attribute that must match the given timestamp format final PactDslJsonBodytimestamp(String name, String format, Date example, TimeZone timeZone)Attribute that must match the given timestamp format final PactDslJsonBodytimestamp(String name, String format, Instant example)Attribute that must match the given timestamp format final PactDslJsonBodytimestamp(String name, String format, Instant example, TimeZone timeZone)Attribute that must match the given timestamp format final PactDslJsonBodydatetime(String name)Attribute that must be an ISO formatted datetime final PactDslJsonBodydatetime(String name, String format)Attribute that must match the given datetime format final PactDslJsonBodydatetime(String name, String format, Date example, TimeZone timeZone)Attribute that must match the given datetime format final PactDslJsonBodydatetime(String name, String format, Instant example, TimeZone timeZone)Attribute that must match the given datetime format final PactDslJsonBodydate(String name)Attribute that must be formatted as an ISO date final PactDslJsonBodydate(String name, String format)Attribute that must match the provided date format final PactDslJsonBodydate(String name, String format, Date example, TimeZone timeZone)Attribute that must match the provided date format final PactDslJsonBodylocalDate(String name, String format, LocalDate example)Attribute that must match the provided date format final PactDslJsonBodytime(String name)Attribute named 'time' that must be an ISO formatted time final PactDslJsonBodytime(String name, String format)Attribute that must match the given time format final PactDslJsonBodytime(String name, String format, Date example, TimeZone timeZone)Attribute that must match the given time format final PactDslJsonBodyipAddress(String name)Attribute that must be an IP4 address PactDslJsonBodyobject(String name)Attribute that is a JSON object PactDslJsonBodyobject()Object element final PactDslJsonBodyobject(String name, DslPart value)Attribute that is a JSON object defined from a DSL part DslPartcloseObject()Closes the current JSON object DslPartclose()This closes off the object graph build from the DSL in case any closeObject|Array methods have not been called. PactDslJsonArrayarray(String name)Attribute that is an array PactDslJsonArrayarray()Element as an array PactDslJsonArrayunorderedArray(String name)Array field where order is ignored PactDslJsonArrayunorderedArray()Array element where order is ignored PactDslJsonArrayunorderedMinArray(String name, Integer size)Array field of min size where order is ignored PactDslJsonArrayunorderedMinArray(Integer size)Array element of min size where order is ignored PactDslJsonArrayunorderedMaxArray(String name, Integer size)Array field of max size where order is ignored PactDslJsonArrayunorderedMaxArray(Integer size)Array element of max size where order is ignored PactDslJsonArrayunorderedMinMaxArray(String name, Integer minSize, Integer maxSize)Array field of min and max size where order is ignored PactDslJsonArrayunorderedMinMaxArray(Integer minSize, Integer maxSize)Array element of min and max size where order is ignored DslPartcloseArray()Closes the current array PactDslJsonBodyeachLike(String name)Attribute that is an array where each item must match the following example PactDslJsonBodyeachLike(String name, DslPart obj)Array field where each element must match the following object PactDslJsonBodyeachLike()Array element where each element of the array must match the following object PactDslJsonArrayeachLike(DslPart obj)Array element where each element of the array must match the provided object PactDslJsonBodyeachLike(String name, Integer numberExamples)Attribute that is an array where each item must match the following example PactDslJsonBodyeachLike(Integer numberExamples)Array element where each element of the array must match the following object final PactDslJsonBodyeachLike(String name, PactDslJsonRootValue value, Integer numberExamples)Attribute that is an array of values that are not objects where each item must match the following example PactDslJsonBodyminArrayLike(String name, Integer size)Attribute that is an array with a minimum size where each item must match the following example PactDslJsonBodyminArrayLike(Integer size)Array element with a minimum size and each element of the array must match the following object PactDslJsonBodyminArrayLike(String name, Integer size, DslPart obj)Array field with a minimum size and each element must match the provided object PactDslJsonArrayminArrayLike(Integer size, DslPart obj)Array element with a minumum size and each element of the array must match the provided object PactDslJsonBodyminArrayLike(String name, Integer size, Integer numberExamples)Attribute that is an array with a minimum size where each item must match the following example PactDslJsonBodyminArrayLike(Integer size, Integer numberExamples)Array element with a minimum size and each element of the array must match the following object final PactDslJsonBodyminArrayLike(String name, Integer size, PactDslJsonRootValue value, Integer numberExamples)Attribute that is an array of values with a minimum size that are not objects where each item must match the following example PactDslJsonBodymaxArrayLike(String name, Integer size)Attribute that is an array with a maximum size where each item must match the following example PactDslJsonBodymaxArrayLike(Integer size)Array element with a maximum size and each element of the array must match the following object PactDslJsonBodymaxArrayLike(String name, Integer size, DslPart obj)Array field with a maximum size and each element must match the provided object PactDslJsonArraymaxArrayLike(Integer size, DslPart obj)Array element with a maximum size and each element of the array must match the provided object PactDslJsonBodymaxArrayLike(String name, Integer size, Integer numberExamples)Attribute that is an array with a maximum size where each item must match the following example PactDslJsonBodymaxArrayLike(Integer size, Integer numberExamples)Array element with a maximum size and each element of the array must match the following object final PactDslJsonBodymaxArrayLike(String name, Integer size, PactDslJsonRootValue value, Integer numberExamples)Attribute that is an array of values with a maximum size that are not objects where each item must match the following example final PactDslJsonBodyid(String name)Attribute named 'id' that must be a numeric identifier final PactDslJsonBodyid(String name, Long id)Attribute that must be a numeric identifier final PactDslJsonBodyhexValue(String name)Attribute that must be encoded as a hexadecimal value final PactDslJsonBodyhexValue(String name, String hexValue)Attribute that must be encoded as a hexadecimal value final PactDslJsonBodyuuid(String name)Attribute that must be encoded as an UUID final PactDslJsonBodyuuid(String name, UUID uuid)Attribute that must be encoded as an UUID final PactDslJsonBodyuuid(String name, String uuid)Attribute that must be encoded as an UUID final PactDslJsonBodynullValue(String fieldName)Sets the field to a null value PactDslJsonArrayeachArrayLike(String name)Array field where each element is an array and must match the following object PactDslJsonArrayeachArrayLike()Array element where each element of the array is an array and must match the following object PactDslJsonArrayeachArrayLike(String name, Integer numberExamples)Array field where each element is an array and must match the following object PactDslJsonArrayeachArrayLike(Integer numberExamples)Array element where each element of the array is an array and must match the following object PactDslJsonArrayeachArrayWithMaxLike(String name, Integer size)Array field where each element is an array and must match the following object PactDslJsonArrayeachArrayWithMaxLike(Integer size)Array element where each element of the array is an array and must match the following object PactDslJsonArrayeachArrayWithMaxLike(String name, Integer numberExamples, Integer size)Array field where each element is an array and must match the following object PactDslJsonArrayeachArrayWithMaxLike(Integer numberExamples, Integer size)Array element where each element of the array is an array and must match the following object PactDslJsonArrayeachArrayWithMinLike(String name, Integer size)Array field where each element is an array and must match the following object PactDslJsonArrayeachArrayWithMinLike(Integer size)Array element where each element of the array is an array and must match the following object PactDslJsonArrayeachArrayWithMinLike(String name, Integer numberExamples, Integer size)Array field where each element is an array and must match the following object PactDslJsonArrayeachArrayWithMinLike(Integer numberExamples, Integer size)Array element where each element of the array is an array and must match the following object final PactDslJsonBodyeachKeyMappedToAnArrayLike(String exampleKey)Accepts any key, and each key is mapped to a list of items that must match the following object definition final PactDslJsonBodyeachKeyLike(String exampleKey)Accepts any key, and each key is mapped to a map that must match the following object definition final PactDslJsonBodyeachKeyLike(String exampleKey, PactDslJsonRootValue value)Accepts any key, and each key is mapped to a map that must match the provided object definition final PactDslJsonBodyincludesStr(String name, String value)Attribute that must include the provided string value final PactDslJsonBodyequalTo(String name, Object value)Attribute that must be equal to the provided value. final PactDslJsonBodyand(String name, Object value, Array<out MatchingRule> rules)Combine all the matchers using AND final PactDslJsonBodyor(String name, Object value, Array<out MatchingRule> rules)Combine all the matchers using OR PactDslJsonBodymatchUrl(String name, String basePath, Array<out Object> pathFragments)Matches a URL that is composed of a base path and a sequence of path expressions DslPartmatchUrl(String basePath, Array<out Object> pathFragments)Matches a URL that is composed of a base path and a sequence of path expressions PactDslJsonBodymatchUrl2(String name, Array<out Object> pathFragments)Matches a URL that is composed of a base path and a sequence of path expressions. DslPartmatchUrl2(Array<out Object> pathFragments)Matches a URL that is composed of a base path and a sequence of path expressions. PactDslJsonBodyminMaxArrayLike(String name, Integer minSize, Integer maxSize)Array field with a minimum and maximum size and each element must match the following object PactDslJsonBodyminMaxArrayLike(String name, Integer minSize, Integer maxSize, DslPart obj)Array field with a minimum and maximum size and each element must match the provided object PactDslJsonBodyminMaxArrayLike(Integer minSize, Integer maxSize)Array element with a minimum and maximum size and each element of the array must match the following object PactDslJsonArrayminMaxArrayLike(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 PactDslJsonBodyminMaxArrayLike(String name, Integer minSize, Integer maxSize, Integer numberExamples)Array field with a minimum and maximum size and each element must match the following object PactDslJsonBodyminMaxArrayLike(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 final PactDslJsonBodyminMaxArrayLike(String name, Integer minSize, Integer maxSize, PactDslJsonRootValue value, Integer numberExamples)Attribute that is an array of values with a minimum and maximum size that are not objects where each item must match the following example PactDslJsonArrayeachArrayWithMinMaxLike(String name, Integer minSize, Integer maxSize)Array field where each element is an array and must match the following object PactDslJsonArrayeachArrayWithMinMaxLike(Integer minSize, Integer maxSize)Array element where each element of the array is an array and must match the following object PactDslJsonArrayeachArrayWithMinMaxLike(String name, Integer numberExamples, Integer minSize, Integer maxSize)Array field where each element is an array and must match the following object PactDslJsonArrayeachArrayWithMinMaxLike(Integer numberExamples, Integer minSize, Integer maxSize)Array element where each element of the array is an array and must match the following object final PactDslJsonBodyvalueFromProviderState(String name, String expression, Object example)Adds an attribute that will have it's value injected from the provider state final PactDslJsonBodydateExpression(String name, String expression, String format)Adds a date attribute with the value generated by the date expression final PactDslJsonBodytimeExpression(String name, String expression, String format)Adds a time attribute with the value generated by the time expression final PactDslJsonBodydatetimeExpression(String name, String expression, String format)Adds a datetime attribute with the value generated by the expression DslPartarrayContaining(String name)Matches the items in an array against a number of variants. JsonValuegetBody()final DslPartgetParent()Returns the parent of this part (object or array) final StringgetRootPath()final StringgetRootName()final MatchingRuleCategorygetMatchers()final GeneratorsgetGenerators()UnitsetBody(JsonValue body)final UnitsetMatchers(MatchingRuleCategory matchers)final UnitsetGenerators(Generators generators)-
Methods inherited from class au.com.dius.pact.consumer.dsl.PactDslJsonBody
asArray, asBody -
Methods inherited from class au.com.dius.pact.consumer.dsl.DslPart
equals, hashCode -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
PactDslJsonBody
PactDslJsonBody()
Constructs a new body as a root
-
PactDslJsonBody
PactDslJsonBody(String rootPath, String rootName, DslPart parent)
Constructs a new body as a child- Parameters:
rootPath- Path to prefix to this childrootName- Name to associate this object as in the parentparent- Parent to attach to
-
PactDslJsonBody
PactDslJsonBody(String rootPath, String rootName, DslPart parent, PactDslJsonBody body)
Constructs a new body as a child as a copy of an existing one- Parameters:
rootPath- Path to prefix to this childrootName- Name to associate this object as in the parentparent- Parent to attach tobody- Body to copy values from
-
-
Method Detail
-
putObjectPrivate
Unit putObjectPrivate(DslPart obj)
-
putArrayPrivate
Unit putArrayPrivate(DslPart obj)
-
stringValue
final PactDslJsonBody stringValue(String name, String value)
Attribute that must be the specified value
- Parameters:
name- attribute namevalue- string value
-
numberValue
final PactDslJsonBody numberValue(String name, Number value)
Attribute that must be the specified number
- Parameters:
name- attribute namevalue- number value
-
booleanValue
final PactDslJsonBody booleanValue(String name, Boolean value)
Attribute that must be the specified boolean
- Parameters:
name- attribute namevalue- boolean value
-
like
PactDslJsonBody like(String name, Object example)
Attribute that must be the same type as the example
- Parameters:
name- attribute name
-
stringType
final PactDslJsonBody stringType(String name)
Attribute that can be any string
- Parameters:
name- attribute name
-
stringType
final PactDslJsonBody stringType(Array<out String> names)
Attributes that can be any string
- Parameters:
names- attribute names
-
stringType
final PactDslJsonBody stringType(String name, String example)
Attribute that can be any string
- Parameters:
name- attribute nameexample- example value to use for generated bodies
-
numberType
final PactDslJsonBody numberType(String name)
Attribute that can be any number
- Parameters:
name- attribute name
-
numberType
final PactDslJsonBody numberType(Array<out String> names)
Attributes that can be any number
- Parameters:
names- attribute names
-
numberType
final PactDslJsonBody numberType(String name, Number number)
Attribute that can be any number
- Parameters:
name- attribute namenumber- example number to use for generated bodies
-
integerType
final PactDslJsonBody integerType(String name)
Attribute that must be an integer
- Parameters:
name- attribute name
-
integerType
final PactDslJsonBody integerType(Array<out String> names)
Attributes that must be an integer
- Parameters:
names- attribute names
-
integerType
final PactDslJsonBody integerType(String name, Long number)
Attribute that must be an integer
- Parameters:
name- attribute namenumber- example integer value to use for generated bodies
-
integerType
final PactDslJsonBody integerType(String name, Integer number)
Attribute that must be an integer
- Parameters:
name- attribute namenumber- example integer value to use for generated bodies
-
decimalType
final PactDslJsonBody decimalType(String name)
Attribute that must be a decimal value
- Parameters:
name- attribute name
-
decimalType
final PactDslJsonBody decimalType(Array<out String> names)
Attributes that must be a decimal values
- Parameters:
names- attribute names
-
decimalType
final PactDslJsonBody decimalType(String name, BigDecimal number)
Attribute that must be a decimalType value
- Parameters:
name- attribute namenumber- example decimalType value
-
decimalType
final PactDslJsonBody decimalType(String name, Double number)
Attribute that must be a decimalType value
- Parameters:
name- attribute namenumber- example decimalType value
-
booleanType
final PactDslJsonBody booleanType(Array<out String> names)
Attributes that must be a boolean
- Parameters:
names- attribute names
-
booleanType
@JvmOverloads() final PactDslJsonBody booleanType(String name, Boolean example)
Attribute that must be a boolean
- Parameters:
name- attribute nameexample- example boolean to use for generated bodies
-
stringMatcher
final PactDslJsonBody 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 PactDslJsonBody stringMatcher(String name, String regex)
Attribute that must match the regular expression
- Parameters:
name- attribute nameregex- regular expression
-
timestamp
@Deprecated(message = "Use datetime instead") final PactDslJsonBody timestamp()
Attribute named 'timestamp' that must be an ISO formatted timestamp
-
timestamp
@Deprecated(message = "Use datetime instead") final PactDslJsonBody timestamp(String name)
Attribute that must be an ISO formatted timestamp
-
timestamp
@Deprecated(message = "use datetime instead") final PactDslJsonBody timestamp(String name, String format)
Attribute that must match the given datetime format
- Parameters:
name- attribute nameformat- timestamp format
-
timestamp
@Deprecated(message = "use datetime instead") final PactDslJsonBody timestamp(String name, String format, Date example)
Attribute that must match the given timestamp format
- Parameters:
name- attribute nameformat- timestamp formatexample- example date and time to use for generated bodies
-
timestamp
@Deprecated(message = "use datetime instead") final PactDslJsonBody timestamp(String name, String format, Date example, TimeZone timeZone)
Attribute that must match the given timestamp 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
-
timestamp
@Deprecated(message = "use datetime instead") final PactDslJsonBody timestamp(String name, String format, Instant example)
Attribute that must match the given timestamp format
- Parameters:
name- attribute nameformat- timestamp formatexample- example date and time to use for generated bodies
-
timestamp
@Deprecated(message = "use datetime instead") final PactDslJsonBody timestamp(String name, String format, Instant example, TimeZone timeZone)
Attribute that must match the given timestamp 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
-
datetime
final PactDslJsonBody datetime(String name)
Attribute that must be an ISO formatted datetime
-
datetime
final PactDslJsonBody datetime(String name, String format)
Attribute that must match the given datetime format
- Parameters:
name- attribute nameformat- datetime format
-
datetime
@JvmOverloads() final PactDslJsonBody 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
@JvmOverloads() final PactDslJsonBody 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
@JvmOverloads() final PactDslJsonBody date(String name)
Attribute that must be formatted as an ISO date
- Parameters:
name- attribute name
-
date
final PactDslJsonBody date(String name, String format)
Attribute that must match the provided date format
- Parameters:
name- attribute dateformat- date format to match
-
date
@JvmOverloads() final PactDslJsonBody 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
-
localDate
final PactDslJsonBody localDate(String name, String format, LocalDate example)
Attribute that must match the provided date format
- Parameters:
name- attribute dateformat- date format to matchexample- example date to use for generated values
-
time
@JvmOverloads() final PactDslJsonBody time(String name)
Attribute named 'time' that must be an ISO formatted time
-
time
final PactDslJsonBody time(String name, String format)
Attribute that must match the given time format
- Parameters:
name- attribute nameformat- time format to match
-
time
@JvmOverloads() final PactDslJsonBody 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
-
ipAddress
final PactDslJsonBody ipAddress(String name)
Attribute that must be an IP4 address
- Parameters:
name- attribute name
-
object
PactDslJsonBody object(String name)
Attribute that is a JSON object
- Parameters:
name- field name
-
object
PactDslJsonBody object()
Object element
-
object
final PactDslJsonBody object(String name, DslPart value)
Attribute that is a JSON object defined from a DSL part
- Parameters:
name- field namevalue- DSL Part to set the value as
-
closeObject
DslPart closeObject()
Closes the current JSON object
-
close
DslPart close()
This closes off the object graph build from the DSL in case any closeObject|Array methods have not been called.
-
array
PactDslJsonArray array(String name)
Attribute that is an array
- Parameters:
name- field name
-
array
PactDslJsonArray array()
Element as an array
-
unorderedArray
PactDslJsonArray unorderedArray(String name)
Array field where order is ignored
- Parameters:
name- field name
-
unorderedArray
PactDslJsonArray unorderedArray()
Array element where order is ignored
-
unorderedMinArray
PactDslJsonArray unorderedMinArray(String name, Integer size)
Array field of min size where order is ignored
- Parameters:
name- field namesize- minimum size
-
unorderedMinArray
PactDslJsonArray unorderedMinArray(Integer size)
Array element of min size where order is ignored
- Parameters:
size- minimum size
-
unorderedMaxArray
PactDslJsonArray unorderedMaxArray(String name, Integer size)
Array field of max size where order is ignored
- Parameters:
name- field namesize- maximum size
-
unorderedMaxArray
PactDslJsonArray unorderedMaxArray(Integer size)
Array element of max size where order is ignored
- Parameters:
size- maximum size
-
unorderedMinMaxArray
PactDslJsonArray unorderedMinMaxArray(String name, Integer minSize, Integer maxSize)
Array field of min and max size where order is ignored
- Parameters:
name- field nameminSize- minimum sizemaxSize- maximum size
-
unorderedMinMaxArray
PactDslJsonArray unorderedMinMaxArray(Integer minSize, Integer maxSize)
Array element of min and max size where order is ignored
- Parameters:
minSize- minimum sizemaxSize- maximum size
-
closeArray
DslPart closeArray()
Closes the current array
-
eachLike
PactDslJsonBody eachLike(String name)
Attribute that is an array where each item must match the following example
- Parameters:
name- field name
-
eachLike
PactDslJsonBody eachLike(String name, DslPart obj)
Array field where each element must match the following object
- Parameters:
name- field name
-
eachLike
PactDslJsonBody eachLike()
Array element where each element of the array must match the following object
-
eachLike
PactDslJsonArray eachLike(DslPart obj)
Array element where each element of the array must match the provided object
-
eachLike
PactDslJsonBody eachLike(String name, Integer numberExamples)
Attribute that is an array where each item must match the following example
- Parameters:
name- field namenumberExamples- number of examples to generate
-
eachLike
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
@JvmOverloads() final PactDslJsonBody eachLike(String name, PactDslJsonRootValue value, Integer numberExamples)
Attribute that is an array of values that are not objects where each item must match the following example
- Parameters:
name- field namevalue- Value to use to match each itemnumberExamples- number of examples to generate
-
minArrayLike
PactDslJsonBody minArrayLike(String name, Integer size)
Attribute that is an array with a minimum size where each item must match the following example
- Parameters:
name- field namesize- minimum size of the array
-
minArrayLike
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
PactDslJsonBody minArrayLike(String name, Integer size, DslPart obj)
Array field with a minimum size and each element must match the provided object
- Parameters:
name- field namesize- minimum size
-
minArrayLike
PactDslJsonArray minArrayLike(Integer size, DslPart obj)
Array element with a minumum size and each element of the array must match the provided object
- Parameters:
size- minimum size
-
minArrayLike
PactDslJsonBody minArrayLike(String name, Integer size, Integer numberExamples)
Attribute that is an array with a minimum size where each item must match the following example
- Parameters:
name- field namesize- minimum size of the arraynumberExamples- number of examples to generate
-
minArrayLike
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 sizenumberExamples- number of examples to generate
-
minArrayLike
@JvmOverloads() final PactDslJsonBody minArrayLike(String name, Integer size, PactDslJsonRootValue value, Integer numberExamples)
Attribute that is an array of values with a minimum size that are not objects where each item must match the following example
- Parameters:
name- field namesize- minimum size of the arrayvalue- Value to use to match each itemnumberExamples- number of examples to generate
-
maxArrayLike
PactDslJsonBody maxArrayLike(String name, Integer size)
Attribute that is an array with a maximum size where each item must match the following example
- Parameters:
name- field namesize- maximum size of the array
-
maxArrayLike
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
PactDslJsonBody maxArrayLike(String name, Integer size, DslPart obj)
Array field with a maximum size and each element must match the provided object
- Parameters:
name- field namesize- maximum size
-
maxArrayLike
PactDslJsonArray maxArrayLike(Integer size, DslPart obj)
Array element with a maximum size and each element of the array must match the provided object
- Parameters:
size- minimum size
-
maxArrayLike
PactDslJsonBody maxArrayLike(String name, Integer size, Integer numberExamples)
Attribute that is an array with a maximum size where each item must match the following example
- Parameters:
name- field namesize- maximum size of the arraynumberExamples- number of examples to generate
-
maxArrayLike
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 sizenumberExamples- number of examples to generate
-
maxArrayLike
@JvmOverloads() final PactDslJsonBody maxArrayLike(String name, Integer size, PactDslJsonRootValue value, Integer numberExamples)
Attribute that is an array of values with a maximum size that are not objects where each item must match the following example
- Parameters:
name- field namesize- maximum size of the arrayvalue- Value to use to match each itemnumberExamples- number of examples to generate
-
id
@JvmOverloads() final PactDslJsonBody id(String name)
Attribute named 'id' that must be a numeric identifier
-
id
final PactDslJsonBody id(String name, Long id)
Attribute that must be a numeric identifier
- Parameters:
name- attribute nameid- example id to use for generated bodies
-
hexValue
final PactDslJsonBody hexValue(String name)
Attribute that must be encoded as a hexadecimal value
- Parameters:
name- attribute name
-
hexValue
final PactDslJsonBody 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 PactDslJsonBody uuid(String name)
Attribute that must be encoded as an UUID
- Parameters:
name- attribute name
-
uuid
final PactDslJsonBody 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 PactDslJsonBody uuid(String name, String uuid)
Attribute that must be encoded as an UUID
- Parameters:
name- attribute nameuuid- example UUID to use for generated bodies
-
nullValue
final PactDslJsonBody nullValue(String fieldName)
Sets the field to a null value
- Parameters:
fieldName- field name
-
eachArrayLike
PactDslJsonArray eachArrayLike(String name)
Array field where each element is an array and must match the following object
- Parameters:
name- field name
-
eachArrayLike
PactDslJsonArray eachArrayLike()
Array element where each element of the array is an array and must match the following object
-
eachArrayLike
PactDslJsonArray eachArrayLike(String name, Integer numberExamples)
Array field where each element is an array and must match the following object
- Parameters:
name- field namenumberExamples- number of examples to generate
-
eachArrayLike
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
PactDslJsonArray eachArrayWithMaxLike(String name, Integer size)
Array field where each element is an array and must match the following object
- Parameters:
name- field namesize- Maximum size of the outer array
-
eachArrayWithMaxLike
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
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 namenumberExamples- number of examples to generatesize- Maximum size of the outer array
-
eachArrayWithMaxLike
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 generatesize- Maximum size of the outer array
-
eachArrayWithMinLike
PactDslJsonArray eachArrayWithMinLike(String name, Integer size)
Array field where each element is an array and must match the following object
- Parameters:
name- field namesize- Minimum size of the outer array
-
eachArrayWithMinLike
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
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 namenumberExamples- number of examples to generatesize- Minimum size of the outer array
-
eachArrayWithMinLike
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 generatesize- Minimum size of the outer array
-
eachKeyMappedToAnArrayLike
final PactDslJsonBody eachKeyMappedToAnArrayLike(String exampleKey)
Accepts any key, and each key is mapped to a list of items that must match the following object definition
- Parameters:
exampleKey- Example key to use for generating bodies
-
eachKeyLike
final PactDslJsonBody eachKeyLike(String exampleKey)
Accepts any key, and each key is mapped to a map that must match the following object definition
- Parameters:
exampleKey- Example key to use for generating bodies
-
eachKeyLike
final PactDslJsonBody eachKeyLike(String exampleKey, PactDslJsonRootValue value)
Accepts any key, and each key is mapped to a map that must match the provided object definition
- Parameters:
exampleKey- Example key to use for generating bodiesvalue- Value to use for matching and generated bodies
-
includesStr
final PactDslJsonBody includesStr(String name, String value)
Attribute that must include the provided string value
- Parameters:
name- attribute namevalue- Value that must be included
-
equalTo
final PactDslJsonBody equalTo(String name, Object value)
Attribute that must be equal to the provided value.
- Parameters:
name- attribute namevalue- Value that will be used for comparisons
-
and
final PactDslJsonBody and(String name, Object value, Array<out MatchingRule> rules)
Combine all the matchers using AND
- Parameters:
name- Attribute namevalue- Attribute example valuerules- Matching rules to apply
-
or
final PactDslJsonBody or(String name, Object value, Array<out MatchingRule> rules)
Combine all the matchers using OR
- Parameters:
name- Attribute namevalue- Attribute example valuerules- Matching rules to apply
-
matchUrl
PactDslJsonBody matchUrl(String name, String basePath, Array<out Object> pathFragments)
Matches a URL that is composed of a base path and a sequence of path expressions
- Parameters:
name- Attribute namebasePath- The base path for the URL (like "http://localhost:8080/") which will be excluded from the matchingpathFragments- Series of path fragments to match on.
-
matchUrl
DslPart matchUrl(String basePath, Array<out 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 matchingpathFragments- Series of path fragments to match on.
-
matchUrl2
PactDslJsonBody matchUrl2(String name, Array<out 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 namepathFragments- Series of path fragments to match on.
-
matchUrl2
DslPart matchUrl2(Array<out 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.
-
minMaxArrayLike
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 nameminSize- minimum sizemaxSize- maximum size
-
minMaxArrayLike
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 nameminSize- minimum sizemaxSize- maximum size
-
minMaxArrayLike
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 sizemaxSize- maximum size
-
minMaxArrayLike
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 sizemaxSize- maximum size
-
minMaxArrayLike
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 nameminSize- minimum sizemaxSize- maximum sizenumberExamples- number of examples to generate
-
minMaxArrayLike
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 sizemaxSize- maximum sizenumberExamples- number of examples to generate
-
minMaxArrayLike
final PactDslJsonBody minMaxArrayLike(String name, Integer minSize, Integer maxSize, PactDslJsonRootValue value, Integer numberExamples)
Attribute that is an array of values with a minimum and maximum size that are not objects where each item must match the following example
- Parameters:
name- field nameminSize- minimum sizemaxSize- maximum sizevalue- Value to use to match each itemnumberExamples- number of examples to generate
-
eachArrayWithMinMaxLike
PactDslJsonArray eachArrayWithMinMaxLike(String name, Integer minSize, Integer maxSize)
Array field where each element is an array and must match the following object
- Parameters:
name- field nameminSize- minimum sizemaxSize- maximum size
-
eachArrayWithMinMaxLike
PactDslJsonArray eachArrayWithMinMaxLike(Integer minSize, Integer maxSize)
Array element where each element of the array is an array and must match the following object
- Parameters:
minSize- minimum sizemaxSize- maximum size
-
eachArrayWithMinMaxLike
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 namenumberExamples- number of examples to generateminSize- minimum sizemaxSize- maximum size
-
eachArrayWithMinMaxLike
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 generateminSize- minimum sizemaxSize- maximum size
-
valueFromProviderState
final PactDslJsonBody valueFromProviderState(String name, String expression, Object 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
@JvmOverloads() final PactDslJsonBody 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
@JvmOverloads() final PactDslJsonBody 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
@JvmOverloads() final PactDslJsonBody 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
-
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
-
getBody
JsonValue getBody()
-
getRootPath
final String getRootPath()
-
getRootName
final String getRootName()
-
getMatchers
final MatchingRuleCategory getMatchers()
-
getGenerators
final Generators getGenerators()
-
setMatchers
final Unit setMatchers(MatchingRuleCategory matchers)
-
setGenerators
final Unit setGenerators(Generators generators)
-
-
-
-