public class PactDslJsonRootValue
extends DslPart
protected void putObject(DslPart object)
protected void putArray(DslPart object)
public java.lang.Object getBody()
public boolean isEncodeJson()
If the value should be encoded to be safe as JSON
public void setEncodeJson(boolean encodeJson)
If the value should be encoded to be safe as JSON
public PactDslJsonArray array(java.lang.String name)
name
- field namepublic PactDslJsonArray array()
public DslPart closeArray()
public PactDslJsonBody eachLike(java.lang.String name)
name
- field namepublic PactDslJsonBody eachLike(java.lang.String name, DslPart object)
public PactDslJsonBody eachLike(int numberExamples)
numberExamples
- number of examples to generatepublic PactDslJsonBody eachLike(java.lang.String name, int numberExamples)
name
- field namenumberExamples
- number of examples to generatepublic PactDslJsonBody eachLike()
public PactDslJsonArray eachLike(DslPart object)
public PactDslJsonBody minArrayLike(java.lang.String name, java.lang.Integer size)
name
- field namesize
- minimum sizepublic PactDslJsonBody minArrayLike(java.lang.Integer size)
size
- minimum sizepublic PactDslJsonBody minArrayLike(java.lang.String name, java.lang.Integer size, DslPart object)
public PactDslJsonArray minArrayLike(java.lang.Integer size, DslPart object)
public PactDslJsonBody minArrayLike(java.lang.String name, java.lang.Integer size, int numberExamples)
name
- field namesize
- minimum sizenumberExamples
- number of examples to generatepublic PactDslJsonBody minArrayLike(java.lang.Integer size, int numberExamples)
size
- minimum sizenumberExamples
- number of examples to generatepublic PactDslJsonBody maxArrayLike(java.lang.String name, java.lang.Integer size)
name
- field namesize
- maximum sizepublic PactDslJsonBody maxArrayLike(java.lang.Integer size)
size
- minimum sizepublic PactDslJsonBody maxArrayLike(java.lang.String name, java.lang.Integer size, DslPart object)
public PactDslJsonArray maxArrayLike(java.lang.Integer size, DslPart object)
public PactDslJsonBody maxArrayLike(java.lang.String name, java.lang.Integer size, int numberExamples)
name
- field namesize
- maximum sizenumberExamples
- number of examples to generatepublic PactDslJsonBody maxArrayLike(java.lang.Integer size, int numberExamples)
size
- minimum sizenumberExamples
- number of examples to generatepublic PactDslJsonBody minMaxArrayLike(java.lang.String name, java.lang.Integer minSize, java.lang.Integer maxSize)
name
- field nameminSize
- minimum sizemaxSize
- maximum sizepublic PactDslJsonBody minMaxArrayLike(java.lang.String name, java.lang.Integer minSize, java.lang.Integer maxSize, DslPart object)
public PactDslJsonBody minMaxArrayLike(java.lang.Integer minSize, java.lang.Integer maxSize)
minSize
- minimum sizemaxSize
- maximum sizepublic PactDslJsonArray minMaxArrayLike(java.lang.Integer minSize, java.lang.Integer maxSize, DslPart object)
public PactDslJsonBody minMaxArrayLike(java.lang.String name, java.lang.Integer minSize, java.lang.Integer maxSize, int numberExamples)
name
- field nameminSize
- minimum sizemaxSize
- maximum sizenumberExamples
- number of examples to generatepublic PactDslJsonBody minMaxArrayLike(java.lang.Integer minSize, java.lang.Integer maxSize, int numberExamples)
minSize
- minimum sizemaxSize
- maximum sizenumberExamples
- number of examples to generatepublic PactDslJsonBody object(java.lang.String name)
name
- field namepublic PactDslJsonBody object()
public DslPart closeObject()
public DslPart close()
public static PactDslJsonRootValue stringType()
Value that can be any string
public static PactDslJsonRootValue stringType(java.lang.String example)
Value that can be any string
example
- example value to use for generated bodiespublic static PactDslJsonRootValue numberType()
Value that can be any number
public static PactDslJsonRootValue numberType(java.lang.Number number)
Value that can be any number
number
- example number to use for generated bodiespublic static PactDslJsonRootValue integerType()
Value that must be an integer
public static PactDslJsonRootValue integerType(java.lang.Long number)
Value that must be an integer
number
- example integer value to use for generated bodiespublic static PactDslJsonRootValue integerType(java.lang.Integer number)
Value that must be an integer
number
- example integer value to use for generated bodiespublic static PactDslJsonRootValue decimalType()
Value that must be a decimal value
public static PactDslJsonRootValue decimalType(java.math.BigDecimal number)
Value that must be a decimalType value
number
- example decimalType valuepublic static PactDslJsonRootValue decimalType(java.lang.Double number)
Value that must be a decimalType value
number
- example decimalType valuepublic static PactDslJsonRootValue booleanType()
Value that must be a boolean
public static PactDslJsonRootValue booleanType(java.lang.Boolean example)
Value that must be a boolean
example
- example boolean to use for generated bodiespublic static PactDslJsonRootValue stringMatcher(java.lang.String regex, java.lang.String value)
Value that must match the regular expression
regex
- regular expressionvalue
- example value to use for generated bodiespublic static PactDslJsonRootValue stringMatcher(java.lang.String regex)
Value that must match the regular expression
regex
- regular expressionpublic static PactDslJsonRootValue timestamp()
Value that must be an ISO formatted timestamp
public static PactDslJsonRootValue timestamp(java.lang.String format)
Value that must match the given timestamp format
format
- timestamp formatpublic static PactDslJsonRootValue timestamp(java.lang.String format, java.util.Date example)
Value that must match the given timestamp format
format
- timestamp formatexample
- example date and time to use for generated bodiespublic static PactDslJsonRootValue date()
Value that must be formatted as an ISO date
public static PactDslJsonRootValue date(java.lang.String format)
Value that must match the provided date format
format
- date format to matchpublic static PactDslJsonRootValue date(java.lang.String format, java.util.Date example)
Value that must match the provided date format
format
- date format to matchexample
- example date to use for generated valuespublic static PactDslJsonRootValue time()
Value that must be an ISO formatted time
public static PactDslJsonRootValue time(java.lang.String format)
Value that must match the given time format
format
- time format to matchpublic static PactDslJsonRootValue time(java.lang.String format, java.util.Date example)
Value that must match the given time format
format
- time format to matchexample
- example time to use for generated bodiespublic static PactDslJsonRootValue ipAddress()
Value that must be an IP4 address
public static PactDslJsonRootValue id()
Value that must be a numeric identifier
public static PactDslJsonRootValue id(java.lang.Long id)
Value that must be a numeric identifier
id
- example id to use for generated bodiespublic static PactDslJsonRootValue hexValue()
Value that must be encoded as a hexadecimal value
public static PactDslJsonRootValue hexValue(java.lang.String hexValue)
Value that must be encoded as a hexadecimal value
hexValue
- example value to use for generated bodiespublic static PactDslJsonRootValue uuid()
Value that must be encoded as an UUID
public static PactDslJsonRootValue uuid(java.util.UUID uuid)
Value that must be encoded as an UUID
uuid
- example UUID to use for generated bodiespublic static PactDslJsonRootValue uuid(java.lang.String uuid)
Value that must be encoded as an UUID
uuid
- example UUID to use for generated bodiespublic void setValue(java.lang.Object value)
public void setMatcher(au.com.dius.pact.core.model.matchingrules.MatchingRule matcher)
public PactDslJsonArray eachArrayLike(java.lang.String name)
name
- field namepublic PactDslJsonArray eachArrayLike(int numberExamples)
numberExamples
- number of examples to generatepublic PactDslJsonArray eachArrayWithMaxLike(java.lang.String name, java.lang.Integer size)
name
- field namesize
- Maximum size of the outer arraypublic PactDslJsonArray eachArrayWithMaxLike(java.lang.Integer size)
size
- Maximum size of the outer arraypublic PactDslJsonArray eachArrayWithMaxLike(java.lang.String name, int numberExamples, java.lang.Integer size)
name
- field namenumberExamples
- number of examples to generatesize
- Maximum size of the outer arraypublic PactDslJsonArray eachArrayWithMaxLike(int numberExamples, java.lang.Integer size)
numberExamples
- number of examples to generatesize
- Maximum size of the outer arraypublic PactDslJsonArray eachArrayWithMinLike(java.lang.String name, java.lang.Integer size)
name
- field namesize
- Minimum size of the outer arraypublic PactDslJsonArray eachArrayWithMinLike(java.lang.Integer size)
size
- Minimum size of the outer arraypublic PactDslJsonArray eachArrayWithMinLike(java.lang.String name, int numberExamples, java.lang.Integer size)
name
- field namenumberExamples
- number of examples to generatesize
- Minimum size of the outer arraypublic PactDslJsonArray eachArrayWithMinLike(int numberExamples, java.lang.Integer size)
numberExamples
- number of examples to generatesize
- Minimum size of the outer arraypublic PactDslJsonArray eachArrayWithMinMaxLike(java.lang.String name, java.lang.Integer minSize, java.lang.Integer maxSize)
name
- field nameminSize
- minimum sizemaxSize
- maximum sizepublic PactDslJsonArray eachArrayWithMinMaxLike(java.lang.Integer minSize, java.lang.Integer maxSize)
minSize
- minimum sizemaxSize
- maximum sizepublic PactDslJsonArray eachArrayWithMinMaxLike(java.lang.String name, int numberExamples, java.lang.Integer minSize, java.lang.Integer maxSize)
name
- field namenumberExamples
- number of examples to generateminSize
- minimum sizemaxSize
- maximum sizepublic PactDslJsonArray eachArrayWithMinMaxLike(int numberExamples, java.lang.Integer minSize, java.lang.Integer maxSize)
numberExamples
- number of examples to generateminSize
- minimum sizemaxSize
- maximum sizepublic PactDslJsonArray eachArrayLike(java.lang.String name, int numberExamples)
name
- field namenumberExamples
- number of examples to generatepublic PactDslJsonArray eachArrayLike()
public static PactDslJsonRootValue and(java.lang.Object example, au.com.dius.pact.core.model.matchingrules.MatchingRule... rules)
Combine all the matchers using AND
example
- Attribute example valuerules
- Matching rules to applypublic static PactDslJsonRootValue or(java.lang.Object example, au.com.dius.pact.core.model.matchingrules.MatchingRule... rules)
Combine all the matchers using OR
example
- Attribute namerules
- Matching rules to applypublic PactDslJsonRootValue matchUrl(java.lang.String basePath, java.lang.Object... pathFragments)
Matches a URL that is composed of a base path and a sequence of path expressions
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. These can be strings or regular expressions.public static PactDslJsonRootValue valueFromProviderState(java.lang.String expression, java.lang.Object example)
Adds a value that will have it's value injected from the provider state
expression
- Expression to be evaluated from the provider stateexample
- Example value to be used in the consumer testpublic static PactDslJsonRootValue dateExpression(java.lang.String expression)
Date value generated from an expression. The date will be formatted as an ISO date.
expression
- Date expressionpublic static PactDslJsonRootValue dateExpression(java.lang.String expression, java.lang.String format)
Date value generated from an expression.
expression
- Date expressionformat
- Date format to usepublic static PactDslJsonRootValue timeExpression(java.lang.String expression)
Time value generated from an expression. The time will be formatted as an ISO time.
expression
- Date expressionpublic static PactDslJsonRootValue timeExpression(java.lang.String expression, java.lang.String format)
Time value generated from an expression.
expression
- Time expressionformat
- Time format to usepublic static PactDslJsonRootValue datetimeExpression(java.lang.String expression)
Datetime value generated from an expression. The datetime will be formatted as an ISO datetime.
expression
- Datetime expressionpublic static PactDslJsonRootValue datetimeExpression(java.lang.String expression, java.lang.String format)
Datetime value generated from an expression.
expression
- Datetime expressionformat
- Datetime format to use