public class DslPart
Abstract base class to support Object and Array JSON DSL builders
public static long DATE_2000
public static au.com.dius.pact.consumer.dsl.DslPart.Companion Companion
public DslPart(@Nullable
DslPart parent,
@NotNull
java.lang.String rootPath,
@NotNull
java.lang.String rootName)
public DslPart(@NotNull
java.lang.String rootPath,
@NotNull
java.lang.String rootName)
@Nullable public DslPart getParent()
Returns the parent of this part (object or array)
@NotNull public java.lang.String getRootPath()
@NotNull public java.lang.String getRootName()
@NotNull public au.com.dius.pact.core.model.matchingrules.Category getMatchers()
public void setMatchers(@NotNull
au.com.dius.pact.core.model.matchingrules.Category p)
@NotNull public au.com.dius.pact.core.model.generators.Generators getGenerators()
public void setGenerators(@NotNull
au.com.dius.pact.core.model.generators.Generators p)
protected boolean getClosed()
protected void setClosed(boolean p)
public void putObjectPrivate(@NotNull
DslPart obj)
public void putArrayPrivate(@NotNull
DslPart obj)
@NotNull public au.com.dius.pact.core.support.json.JsonValue getBody()
public void setBody(@NotNull
au.com.dius.pact.core.support.json.JsonValue p)
@NotNull public PactDslJsonArray array(@NotNull java.lang.String name)
Field which is an array
name - field name@NotNull public PactDslJsonArray array()
Element as an array
@Nullable public DslPart closeArray()
Close of the previous array element
@NotNull public PactDslJsonBody eachLike(@NotNull java.lang.String name)
Array field where each element must match the following object
name - field name@NotNull public PactDslJsonBody eachLike(@NotNull java.lang.String name, @NotNull DslPart obj)
Array field where each element must match the following object
name - field name@NotNull public PactDslJsonBody eachLike()
Array element where each element of the array must match the following object
@NotNull public PactDslJsonArray eachLike(@NotNull DslPart obj)
Array element where each element of the array must match the provided object
@NotNull public PactDslJsonBody eachLike(@NotNull java.lang.String name, int numberExamples)
Array field where each element must match the following object
name - field namenumberExamples - number of examples to generate@NotNull public PactDslJsonBody eachLike(int numberExamples)
Array element where each element of the array must match the following object
numberExamples - number of examples to generate@NotNull public PactDslJsonBody minArrayLike(@NotNull java.lang.String name, int size)
Array field with a minimum size and each element must match the following object
name - field namesize - minimum size@NotNull public PactDslJsonBody minArrayLike(int size)
Array element with a minimum size and each element of the array must match the following object
size - minimum size@NotNull public PactDslJsonBody minArrayLike(@NotNull java.lang.String name, int size, @NotNull DslPart obj)
Array field with a minimum size and each element must match the provided object
name - field namesize - minimum size@NotNull public PactDslJsonArray minArrayLike(int size, @NotNull DslPart obj)
Array element with a minumum size and each element of the array must match the provided object
size - minimum size@NotNull public PactDslJsonBody minArrayLike(@NotNull java.lang.String name, int size, int numberExamples)
Array field with a minumum size and each element must match the following object
name - field namesize - minimum sizenumberExamples - number of examples to generate@NotNull public PactDslJsonBody minArrayLike(int size, int numberExamples)
Array element with a minimum size and each element of the array must match the following object
size - minimum sizenumberExamples - number of examples to generate@NotNull public PactDslJsonBody maxArrayLike(@NotNull java.lang.String name, int size)
Array field with a maximum size and each element must match the following object
name - field namesize - maximum size@NotNull public PactDslJsonBody maxArrayLike(int size)
Array element with a maximum size and each element of the array must match the following object
size - maximum size@NotNull public PactDslJsonBody maxArrayLike(@NotNull java.lang.String name, int size, @NotNull DslPart obj)
Array field with a maximum size and each element must match the provided object
name - field namesize - maximum size@NotNull public PactDslJsonArray maxArrayLike(int size, @NotNull DslPart obj)
Array element with a maximum size and each element of the array must match the provided object
size - minimum size@NotNull public PactDslJsonBody maxArrayLike(@NotNull java.lang.String name, int size, int numberExamples)
Array field with a maximum size and each element must match the following object
name - field namesize - maximum sizenumberExamples - number of examples to generate@NotNull public PactDslJsonBody maxArrayLike(int size, int numberExamples)
Array element with a maximum size and each element of the array must match the following object
size - maximum sizenumberExamples - number of examples to generate@NotNull public PactDslJsonBody minMaxArrayLike(@NotNull java.lang.String name, int minSize, int maxSize)
Array field with a minimum and maximum size and each element must match the following object
name - field nameminSize - minimum sizemaxSize - maximum size@NotNull public PactDslJsonBody minMaxArrayLike(@NotNull java.lang.String name, int minSize, int maxSize, @NotNull DslPart obj)
Array field with a minimum and maximum size and each element must match the provided object
name - field nameminSize - minimum sizemaxSize - maximum size@NotNull public PactDslJsonBody minMaxArrayLike(int minSize, int maxSize)
Array element with a minimum and maximum size and each element of the array must match the following object
minSize - minimum sizemaxSize - maximum size@NotNull public PactDslJsonArray minMaxArrayLike(int minSize, int maxSize, @NotNull DslPart obj)
Array element with a minimum and maximum size and each element of the array must match the provided object
minSize - minimum sizemaxSize - maximum size@NotNull public PactDslJsonBody minMaxArrayLike(@NotNull java.lang.String name, int minSize, int maxSize, int numberExamples)
Array field with a minimum and maximum size and each element must match the following object
name - field nameminSize - minimum sizemaxSize - maximum sizenumberExamples - number of examples to generate@NotNull public PactDslJsonBody minMaxArrayLike(int minSize, int maxSize, int numberExamples)
Array element with a minimum and maximum size and each element of the array must match the following object
minSize - minimum sizemaxSize - maximum sizenumberExamples - number of examples to generate@NotNull public PactDslJsonArray eachArrayLike(@NotNull java.lang.String name)
Array field where each element is an array and must match the following object
name - field name@NotNull public PactDslJsonArray eachArrayLike()
Array element where each element of the array is an array and must match the following object
@NotNull public PactDslJsonArray eachArrayLike(@NotNull java.lang.String name, int numberExamples)
Array field where each element is an array and must match the following object
name - field namenumberExamples - number of examples to generate@NotNull public PactDslJsonArray eachArrayLike(int numberExamples)
Array element where each element of the array is an array and must match the following object
numberExamples - number of examples to generate@NotNull public PactDslJsonArray eachArrayWithMaxLike(@NotNull java.lang.String name, int size)
Array field where each element is an array and must match the following object
name - field namesize - Maximum size of the outer array@NotNull public PactDslJsonArray eachArrayWithMaxLike(int size)
Array element where each element of the array is an array and must match the following object
size - Maximum size of the outer array@NotNull public PactDslJsonArray eachArrayWithMaxLike(@NotNull java.lang.String name, int numberExamples, int size)
Array field where each element is an array and must match the following object
name - field namenumberExamples - number of examples to generatesize - Maximum size of the outer array@NotNull public PactDslJsonArray eachArrayWithMaxLike(int numberExamples, int size)
Array element where each element of the array is an array and must match the following object
numberExamples - number of examples to generatesize - Maximum size of the outer array@NotNull public PactDslJsonArray eachArrayWithMinLike(@NotNull java.lang.String name, int size)
Array field where each element is an array and must match the following object
name - field namesize - Minimum size of the outer array@NotNull public PactDslJsonArray eachArrayWithMinLike(int size)
Array element where each element of the array is an array and must match the following object
size - Minimum size of the outer array@NotNull public PactDslJsonArray eachArrayWithMinLike(@NotNull java.lang.String name, int numberExamples, int size)
Array field where each element is an array and must match the following object
name - field namenumberExamples - number of examples to generatesize - Minimum size of the outer array@NotNull public PactDslJsonArray eachArrayWithMinLike(int numberExamples, int size)
Array element where each element of the array is an array and must match the following object
numberExamples - number of examples to generatesize - Minimum size of the outer array@NotNull public PactDslJsonArray eachArrayWithMinMaxLike(@NotNull java.lang.String name, int minSize, int maxSize)
Array field where each element is an array and must match the following object
name - field nameminSize - minimum sizemaxSize - maximum size@NotNull public PactDslJsonArray eachArrayWithMinMaxLike(int minSize, int maxSize)
Array element where each element of the array is an array and must match the following object
minSize - minimum sizemaxSize - maximum size@NotNull public PactDslJsonArray eachArrayWithMinMaxLike(@NotNull java.lang.String name, int numberExamples, int minSize, int maxSize)
Array field where each element is an array and must match the following object
name - field namenumberExamples - number of examples to generateminSize - minimum sizemaxSize - maximum size@NotNull public PactDslJsonArray eachArrayWithMinMaxLike(int numberExamples, int minSize, int maxSize)
Array element where each element of the array is an array and must match the following object
numberExamples - number of examples to generateminSize - minimum sizemaxSize - maximum size@NotNull public PactDslJsonBody object(@NotNull java.lang.String name)
Object field
name - field name@NotNull public PactDslJsonBody object()
Object element
@Nullable public DslPart closeObject()
Close off the previous object
@NotNull
protected au.com.dius.pact.core.model.matchingrules.RegexMatcher regexp(@NotNull
java.lang.String regex)
@NotNull
protected au.com.dius.pact.core.model.matchingrules.TimestampMatcher matchTimestamp(@NotNull
java.lang.String format)
@NotNull
protected au.com.dius.pact.core.model.matchingrules.DateMatcher matchDate(@NotNull
java.lang.String format)
@NotNull
protected au.com.dius.pact.core.model.matchingrules.TimeMatcher matchTime(@NotNull
java.lang.String format)
@NotNull protected au.com.dius.pact.core.model.matchingrules.MinTypeMatcher matchMin(int min)
@NotNull protected au.com.dius.pact.core.model.matchingrules.MaxTypeMatcher matchMax(int max)
@NotNull
protected au.com.dius.pact.core.model.matchingrules.MinMaxTypeMatcher matchMinMax(int minSize,
int maxSize)
@NotNull
protected au.com.dius.pact.core.model.matchingrules.IncludeMatcher includesMatcher(@NotNull
java.lang.Object value)
@NotNull public PactDslJsonBody asBody()
@NotNull public PactDslJsonArray asArray()
@Nullable public DslPart close()
This closes off the object graph build from the DSL in case any closeObject|Array methods have not been called.
@NotNull public DslPart matchUrl(@NotNull java.lang.String name, @Nullable java.lang.String basePath, @NotNull java.lang.Object... pathFragments)
Matches a URL that is composed of a base path and a sequence of path expressions
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. These can be strings or regular expressions.@NotNull public DslPart matchUrl(@Nullable java.lang.String basePath, @NotNull 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.@NotNull public DslPart matchUrl2(@NotNull java.lang.String name, @NotNull java.lang.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.
name - Attribute namepathFragments - Series of path fragments to match on. These can be strings or regular expressions.@NotNull public DslPart matchUrl2(@NotNull java.lang.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.
pathFragments - Series of path fragments to match on. These can be strings or regular expressions.@JvmStatic
@NotNull
public static au.com.dius.pact.core.model.matchingrules.RegexMatcher regex(@NotNull
java.lang.String regex,
@NotNull
java.lang.String example)
Returns a regular expression matcher
regex - Regex to match withexample - Example value to use@JvmStatic
@NotNull
public static au.com.dius.pact.core.model.matchingrules.RegexMatcher regex(@NotNull
java.lang.String regex)
Returns a regular expression matcher. Will generate random examples from the regex.
regex - Regex to match with