-
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 PactDslJsonBody(String rootPath, String rootName, PactDslJsonArray parent, Integer examples)Constructs a new body as a child of an array
-
Method Summary
Modifier and Type Method Description JsonValuegetBody()UnitsetBody(JsonValue body)final DslPartgetParent()Returns the parent of this part (object or array) final StringgetRootPath()final StringgetRootName()final MatchingRuleCategorygetMatchers()final UnitsetMatchers(MatchingRuleCategory matchers)final GeneratorsgetGenerators()final UnitsetGenerators(Generators generators)StringtoString()UnitputObjectPrivate(DslPart obj)UnitputArrayPrivate(DslPart obj)final PactDslJsonBodystringValue(String name, String values)Attribute that must be the specified value final PactDslJsonBodynumberValue(String name, Number values)Attribute that must be the specified number final PactDslJsonBodybooleanValue(String name, Boolean values)Attribute that must be the specified boolean PactDslJsonBodylike(String name, Object examples)Attribute that must be the same type as the example final PactDslJsonBodystringType(String name)Attribute that can be any string final PactDslJsonBodystringType(String name, String examples)Attribute that can be any string final PactDslJsonBodystringTypes(String names)Attributes that can be any string final PactDslJsonBodynumberType(String name)Attribute that can be any number final PactDslJsonBodynumberType(String name, Number numbers)Attribute that can be any number final PactDslJsonBodynumberTypes(String names)Attributes that can be any number final PactDslJsonBodyintegerType(String name)Attribute that must be an integer final PactDslJsonBodyintegerType(String name, Long numbers)Attribute that must be an integer final PactDslJsonBodyintegerType(String name, Integer numbers)Attribute that must be an integer final PactDslJsonBodyintegerTypes(String names)Attributes that must be an integer final PactDslJsonBodydecimalType(String name)Attribute that must be a decimal value final PactDslJsonBodydecimalType(String name, BigDecimal numbers)Attribute that must be a decimalType value final PactDslJsonBodydecimalType(String name, Double numbers)Attribute that must be a decimalType value final PactDslJsonBodydecimalTypes(String names)Attributes that must be a decimal values final PactDslJsonBodybooleanTypes(String names)Attributes that must be a boolean final PactDslJsonBodybooleanType(String name, Boolean examples)Attribute that must be a boolean final PactDslJsonBodybooleanType(String name)Attribute that must be a boolean final PactDslJsonBodystringMatcher(String name, String regex, String values)Attribute that must match the regular expression final PactDslJsonBodystringMatcher(String name, String regex)Attribute that must match the regular expression 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, Date example)Attribute that must match the given datetime format final PactDslJsonBodydatetime(String name, String format, TimeZone timeZone, Date examples)Attribute that must match the given datetime format final PactDslJsonBodydatetime(String name, String format, Date examples)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 PactDslJsonBodydatetime(String name, String format, Instant example)Attribute that must match the given datetime format final PactDslJsonBodydatetime(String name, String format, TimeZone timeZone, Instant examples)Attribute that must match the given datetime format final PactDslJsonBodydatetime(String name, String format, Instant examples)Attribute that must match the given datetime format final PactDslJsonBodydate(String name)Attribute that must be formatted as an ISO date final PactDslJsonBodydate()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 PactDslJsonBodydate(String name, String format, Date example)Attribute that must match the provided date format final PactDslJsonBodydate(String name, String format, TimeZone timeZone, Date examples)Attribute that must match the provided date format final PactDslJsonBodydate(String name, String format, Date examples)Attribute that must match the provided date format final PactDslJsonBodylocalDate(String name, String format, LocalDate examples)Attribute that must match the provided date format final PactDslJsonBodytime(String name)Attribute named 'time' that must be an ISO formatted time final PactDslJsonBodytime()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 PactDslJsonBodytime(String name, String format, Date example)Attribute that must match the given time format final PactDslJsonBodytime(String name, String format, TimeZone timeZone, Date examples)Attribute that must match the given time format final PactDslJsonBodytime(String name, String format, Date examples)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 final PactDslJsonBodyeachLike(String name, PactDslJsonRootValue value)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 final PactDslJsonBodyminArrayLike(String name, Integer size, PactDslJsonRootValue value)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 PactDslJsonBodymaxArrayLike(String name, Integer size, PactDslJsonRootValue value)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 that must be a numeric identifier final PactDslJsonBodyid()Attribute that must be a numeric identifier final PactDslJsonBodyid(String name, Long examples)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 examples)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 uuids)Attribute that must be encoded as an UUID final PactDslJsonBodyuuid(String name, String examples)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 examples)Attribute that must be equal to the provided value. final PactDslJsonBodyand(String name, Object value, MatchingRule rules)Combine all the matchers using AND final PactDslJsonBodyor(String name, Object value, MatchingRule rules)Combine all the matchers using OR PactDslJsonBodymatchUrl(String name, String basePath, Object pathFragments)Matches a URL that is composed of a base path and a sequence of path expressions DslPartmatchUrl(String basePath, Object pathFragments)Matches a URL that is composed of a base path and a sequence of path expressions PactDslJsonBodymatchUrl2(String name, Object pathFragments)Matches a URL that is composed of a base path and a sequence of path expressions. DslPartmatchUrl2(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 PactDslJsonBodydateExpression(String name, String expression)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 PactDslJsonBodytimeExpression(String name, String expression)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 final PactDslJsonBodydatetimeExpression(String name, String expression)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. -
-
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
-
PactDslJsonBody
PactDslJsonBody(String rootPath, String rootName, PactDslJsonArray parent, Integer examples)
Constructs a new body as a child of an array- Parameters:
rootPath- Path to prefix to this childrootName- Name to associate this object as in the parentparent- Parent to attach toexamples- Number of examples to generate
-
-
Method Detail
-
getBody
JsonValue getBody()
-
getRootPath
final String getRootPath()
-
getRootName
final String getRootName()
-
getMatchers
final MatchingRuleCategory getMatchers()
-
setMatchers
final Unit setMatchers(MatchingRuleCategory matchers)
-
getGenerators
final Generators getGenerators()
-
setGenerators
final Unit setGenerators(Generators generators)
-
putObjectPrivate
Unit putObjectPrivate(DslPart obj)
-
putArrayPrivate
Unit putArrayPrivate(DslPart obj)
-
stringValue
final PactDslJsonBody stringValue(String name, String values)
Attribute that must be the specified value
- Parameters:
name- attribute name
-
numberValue
final PactDslJsonBody numberValue(String name, Number values)
Attribute that must be the specified number
- Parameters:
name- attribute name
-
booleanValue
final PactDslJsonBody booleanValue(String name, Boolean values)
Attribute that must be the specified boolean
- Parameters:
name- attribute name
-
like
PactDslJsonBody like(String name, Object examples)
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(String name, String examples)
Attribute that can be any string
- Parameters:
name- attribute name
-
stringTypes
final PactDslJsonBody stringTypes(String names)
Attributes that can be any string
- Parameters:
names- attribute names
-
numberType
final PactDslJsonBody numberType(String name)
Attribute that can be any number
- Parameters:
name- attribute name
-
numberType
final PactDslJsonBody numberType(String name, Number numbers)
Attribute that can be any number
- Parameters:
name- attribute name
-
numberTypes
final PactDslJsonBody numberTypes(String names)
Attributes that can be any number
- Parameters:
names- attribute names
-
integerType
final PactDslJsonBody integerType(String name)
Attribute that must be an integer
- Parameters:
name- attribute name
-
integerType
final PactDslJsonBody integerType(String name, Long numbers)
Attribute that must be an integer
- Parameters:
name- attribute name
-
integerType
final PactDslJsonBody integerType(String name, Integer numbers)
Attribute that must be an integer
- Parameters:
name- attribute name
-
integerTypes
final PactDslJsonBody integerTypes(String names)
Attributes that must be an integer
- Parameters:
names- attribute names
-
decimalType
final PactDslJsonBody decimalType(String name)
Attribute that must be a decimal value
- Parameters:
name- attribute name
-
decimalType
final PactDslJsonBody decimalType(String name, BigDecimal numbers)
Attribute that must be a decimalType value
- Parameters:
name- attribute name
-
decimalType
final PactDslJsonBody decimalType(String name, Double numbers)
Attribute that must be a decimalType value
- Parameters:
name- attribute name
-
decimalTypes
final PactDslJsonBody decimalTypes(String names)
Attributes that must be a decimal values
- Parameters:
names- attribute names
-
booleanTypes
final PactDslJsonBody booleanTypes(String names)
Attributes that must be a boolean
- Parameters:
names- attribute names
-
booleanType
@JvmOverloads() final PactDslJsonBody booleanType(String name, Boolean examples)
Attribute that must be a boolean
- Parameters:
name- attribute name
-
booleanType
@JvmOverloads() final PactDslJsonBody booleanType(String name)
Attribute that must be a boolean
- Parameters:
name- attribute name
-
stringMatcher
final PactDslJsonBody stringMatcher(String name, String regex, String values)
Attribute that must match the regular expression
- Parameters:
name- attribute nameregex- regular expression
-
stringMatcher
final PactDslJsonBody stringMatcher(String name, String regex)
Attribute that must match the regular expression
- Parameters:
name- attribute nameregex- regular expression
-
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, 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
@JvmOverloads() final PactDslJsonBody datetime(String name, String format, TimeZone timeZone, Date examples)
Attribute that must match the given datetime format
- Parameters:
name- attribute nameformat- datetime formattimeZone- time zone used for formatting of example date and time
-
datetime
@JvmOverloads() final PactDslJsonBody datetime(String name, String format, Date examples)
Attribute that must match the given datetime format
- Parameters:
name- attribute nameformat- datetime format
-
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
-
datetime
@JvmOverloads() final PactDslJsonBody datetime(String name, String format, Instant example)
Attribute that must match the given datetime format
- Parameters:
name- attribute nameformat- timestamp formatexample- example date and time to use for generated bodies
-
datetime
@JvmOverloads() final PactDslJsonBody datetime(String name, String format, TimeZone timeZone, Instant examples)
Attribute that must match the given datetime format
- Parameters:
name- attribute nameformat- timestamp formattimeZone- time zone used for formatting of example date and timeexamples- example dates and times to use for generated bodies
-
datetime
@JvmOverloads() final PactDslJsonBody datetime(String name, String format, Instant examples)
Attribute that must match the given datetime format
- Parameters:
name- attribute nameformat- timestamp formatexamples- example dates and times to use for generated bodies
-
date
@JvmOverloads() final PactDslJsonBody date(String name)
Attribute that must be formatted as an ISO date
- Parameters:
name- attribute name
-
date
@JvmOverloads() final PactDslJsonBody date()
Attribute that must be formatted as an ISO date
-
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
-
date
@JvmOverloads() final PactDslJsonBody 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
@JvmOverloads() final PactDslJsonBody date(String name, String format, TimeZone timeZone, Date examples)
Attribute that must match the provided date format
- Parameters:
name- attribute dateformat- date format to matchtimeZone- time zone used for formatting of example dateexamples- example dates to use for generated values
-
date
@JvmOverloads() final PactDslJsonBody date(String name, String format, Date examples)
Attribute that must match the provided date format
- Parameters:
name- attribute dateformat- date format to matchexamples- example dates to use for generated values
-
localDate
final PactDslJsonBody localDate(String name, String format, LocalDate examples)
Attribute that must match the provided date format
- Parameters:
name- attribute dateformat- date format to match
-
time
@JvmOverloads() final PactDslJsonBody time(String name)
Attribute named 'time' that must be an ISO formatted time
-
time
@JvmOverloads() final PactDslJsonBody time()
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
-
time
@JvmOverloads() final PactDslJsonBody 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
@JvmOverloads() final PactDslJsonBody time(String name, String format, TimeZone timeZone, Date examples)
Attribute that must match the given time format
- Parameters:
name- attribute nameformat- time format to matchtimeZone- time zone used for formatting of example timeexamples- example times to use for generated bodies
-
time
@JvmOverloads() final PactDslJsonBody time(String name, String format, Date examples)
Attribute that must match the given time format
- Parameters:
name- attribute nameformat- time format to matchexamples- example times to use for generated bodies
-
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
-
eachLike
@JvmOverloads() final PactDslJsonBody eachLike(String name, PactDslJsonRootValue value)
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 item
-
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
-
minArrayLike
@JvmOverloads() final PactDslJsonBody minArrayLike(String name, Integer size, PactDslJsonRootValue value)
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 item
-
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
-
maxArrayLike
@JvmOverloads() final PactDslJsonBody maxArrayLike(String name, Integer size, PactDslJsonRootValue value)
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 item
-
id
@JvmOverloads() final PactDslJsonBody id(String name)
Attribute that must be a numeric identifier
- Parameters:
name- attribute name, defaults to 'id', that must be a numeric identifier
-
id
@JvmOverloads() final PactDslJsonBody id()
Attribute that must be a numeric identifier
-
id
final PactDslJsonBody id(String name, Long examples)
Attribute that must be a numeric identifier
- Parameters:
name- attribute nameexamples- example ids 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 examples)
Attribute that must be encoded as a hexadecimal value
- Parameters:
name- attribute name
-
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 uuids)
Attribute that must be encoded as an UUID
- Parameters:
name- attribute name
-
uuid
final PactDslJsonBody uuid(String name, String examples)
Attribute that must be encoded as an UUID
- Parameters:
name- attribute name
-
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 examples)
Attribute that must be equal to the provided value.
- Parameters:
name- attribute name
-
and
final PactDslJsonBody and(String name, Object value, 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, 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, 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, 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, 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(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
-
dateExpression
@JvmOverloads() final PactDslJsonBody dateExpression(String name, String expression)
Adds a date attribute with the value generated by the date expression
- Parameters:
name- Attribute nameexpression- Date expression to use to generate the values
-
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
-
timeExpression
@JvmOverloads() final PactDslJsonBody timeExpression(String name, String expression)
Adds a time attribute with the value generated by the time expression
- Parameters:
name- Attribute nameexpression- Time expression to use to generate the values
-
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
-
datetimeExpression
@JvmOverloads() final PactDslJsonBody datetimeExpression(String name, String expression)
Adds a datetime attribute with the value generated by the expression
- Parameters:
name- Attribute nameexpression- Datetime expression to use to generate the values
-
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
-
-
-
-