public class PactDslRootValue
extends DslPart
Matcher to create a plain root matching strategy. Used with text/plain to match regex responses
protected void putObject(DslPart object)
protected void putArray(DslPart object)
public java.lang.Object getBody()
public PactDslJsonArray array(java.lang.String name)
name
- field namepublic PactDslJsonArray array()
public DslPart closeArray()
public PactDslJsonBody arrayLike(java.lang.String name)
name
- field namepublic PactDslJsonBody arrayLike()
public PactDslJsonBody eachLike(java.lang.String name)
name
- field namepublic 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 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, 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, 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.Integer minSize, java.lang.Integer maxSize)
minSize
- minimum sizemaxSize
- maximum sizepublic 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 PactDslRootValue stringType()
Value that can be any string
public static PactDslRootValue stringType(java.lang.String example)
Value that can be any string
example
- example value to use for generated bodiespublic static PactDslRootValue numberType()
Value that can be any number
public static PactDslRootValue numberType(java.lang.Number number)
Value that can be any number
number
- example number to use for generated bodiespublic static PactDslRootValue integerType()
Value that must be an integer
public static PactDslRootValue integerType(java.lang.Long number)
Value that must be an integer
number
- example integer value to use for generated bodiespublic static PactDslRootValue integerType(java.lang.Integer number)
Value that must be an integer
number
- example integer value to use for generated bodiespublic static PactDslRootValue decimalType()
Value that must be a decimal value
public static PactDslRootValue decimalType(java.math.BigDecimal number)
Value that must be a decimalType value
number
- example decimalType valuepublic static PactDslRootValue decimalType(java.lang.Double number)
Value that must be a decimalType value
number
- example decimalType valuepublic static PactDslRootValue booleanType()
Value that must be a boolean
public static PactDslRootValue booleanType(java.lang.Boolean example)
Value that must be a boolean
example
- example boolean to use for generated bodiespublic static PactDslRootValue 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 PactDslRootValue stringMatcher(java.lang.String regex)
Value that must match the regular expression
regex
- regular expressionpublic static PactDslRootValue timestamp()
Value that must be an ISO formatted timestamp
public static PactDslRootValue timestamp(java.lang.String format)
Value that must match the given timestamp format
format
- timestamp formatpublic static PactDslRootValue 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 PactDslRootValue date()
Value that must be formatted as an ISO date
public static PactDslRootValue date(java.lang.String format)
Value that must match the provided date format
format
- date format to matchpublic static PactDslRootValue 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 PactDslRootValue time()
Value that must be an ISO formatted time
public static PactDslRootValue time(java.lang.String format)
Value that must match the given time format
format
- time format to matchpublic static PactDslRootValue 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 PactDslRootValue ipAddress()
Value that must be an IP4 address
public static PactDslRootValue id()
Value that must be a numeric identifier
public static PactDslRootValue id(java.lang.Long id)
Value that must be a numeric identifier
id
- example id to use for generated bodiespublic static PactDslRootValue hexValue()
Value that must be encoded as a hexadecimal value
public static PactDslRootValue hexValue(java.lang.String hexValue)
Value that must be encoded as a hexadecimal value
hexValue
- example value to use for generated bodiespublic static PactDslRootValue uuid()
Value that must be encoded as an UUID
public static PactDslRootValue uuid(java.util.UUID uuid)
Value that must be encoded as an UUID
uuid
- example UUID to use for generated bodiespublic static PactDslRootValue 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 PactDslRootValue 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 PactDslRootValue 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 static PactDslRootValue 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 test