diff --git a/multi/multi_contract-dsl.html b/multi/multi_contract-dsl.html index 209a9d6886..b2cc040f4b 100644 --- a/multi/multi_contract-dsl.html +++ b/multi/multi_contract-dsl.html @@ -965,122 +965,122 @@ email, url, uuid, iso_date, iso_date_time, iso_time, iso_8601_with_offset, non_e type: by_regex predefined: only_alpha_unicode
Below you can find the allowed list of `type`s.
For stubMatchers:
by_equalityby_regexby_dateby_timestampby_timeFor testMatchers:
by_equalityby_regexby_dateby_timestampby_timeby_type
minOccurrence and maxOccurrence.by_commandby_nullConsider the following example:
Groovy DSL.
Contract contractDsl = Contract.make {
- request {
- method 'GET'
- urlPath '/get'
- body([
- duck : 123,
- alpha : 'abc',
- number : 123,
- aBoolean : true,
- date : '2017-01-01',
- dateTime : '2017-01-01T01:23:45',
- time : '01:02:34',
- valueWithoutAMatcher: 'foo',
- valueWithTypeMatch : 'string',
- key : [
- 'complex.key': 'foo'
- ]
- ])
- bodyMatchers {
- jsonPath('$.duck', byRegex("[0-9]{3}"))
- jsonPath('$.duck', byEquality())
- jsonPath('$.alpha', byRegex(onlyAlphaUnicode()))
- jsonPath('$.alpha', byEquality())
- jsonPath('$.number', byRegex(number()))
- jsonPath('$.aBoolean', byRegex(anyBoolean()))
- jsonPath('$.date', byDate())
- jsonPath('$.dateTime', byTimestamp())
- jsonPath('$.time', byTime())
- jsonPath("\$.['key'].['complex.key']", byEquality())
- }
- headers {
- contentType(applicationJson())
- }
- }
- response {
- status OK()
- body([
- duck : 123,
- alpha : 'abc',
- number : 123,
- positiveInteger : 1234567890,
- negativeInteger : -1234567890,
- positiveDecimalNumber: 123.4567890,
- negativeDecimalNumber: -123.4567890,
- aBoolean : true,
- date : '2017-01-01',
- dateTime : '2017-01-01T01:23:45',
- time : "01:02:34",
- valueWithoutAMatcher : 'foo',
- valueWithTypeMatch : 'string',
- valueWithMin : [
- 1, 2, 3
- ],
- valueWithMax : [
- 1, 2, 3
- ],
- valueWithMinMax : [
- 1, 2, 3
- ],
- valueWithMinEmpty : [],
- valueWithMaxEmpty : [],
- key : [
- 'complex.key': 'foo'
- ],
- nullValue : null
- ])
- bodyMatchers {
- // asserts the jsonpath value against manual regex
- jsonPath('$.duck', byRegex("[0-9]{3}"))
- // asserts the jsonpath value against the provided value
- jsonPath('$.duck', byEquality())
- // asserts the jsonpath value against some default regex
- jsonPath('$.alpha', byRegex(onlyAlphaUnicode()))
- jsonPath('$.alpha', byEquality())
- jsonPath('$.number', byRegex(number()))
- jsonPath('$.positiveInteger', byRegex(anInteger()))
- jsonPath('$.negativeInteger', byRegex(anInteger()))
- jsonPath('$.positiveDecimalNumber', byRegex(aDouble()))
- jsonPath('$.negativeDecimalNumber', byRegex(aDouble()))
- jsonPath('$.aBoolean', byRegex(anyBoolean()))
- // asserts vs inbuilt time related regex
- jsonPath('$.date', byDate())
- jsonPath('$.dateTime', byTimestamp())
- jsonPath('$.time', byTime())
- // asserts that the resulting type is the same as in response body
- jsonPath('$.valueWithTypeMatch', byType())
- jsonPath('$.valueWithMin', byType {
- // results in verification of size of array (min 1)
- minOccurrence(1)
- })
- jsonPath('$.valueWithMax', byType {
- // results in verification of size of array (max 3)
- maxOccurrence(3)
- })
- jsonPath('$.valueWithMinMax', byType {
- // results in verification of size of array (min 1 & max 3)
- minOccurrence(1)
- maxOccurrence(3)
- })
- jsonPath('$.valueWithMinEmpty', byType {
- // results in verification of size of array (min 0)
- minOccurrence(0)
- })
- jsonPath('$.valueWithMaxEmpty', byType {
- // results in verification of size of array (max 0)
- maxOccurrence(0)
- })
- // will execute a method `assertThatValueIsANumber`
- jsonPath('$.duck', byCommand('assertThatValueIsANumber($it)'))
- jsonPath("\$.['key'].['complex.key']", byEquality())
- jsonPath('$.nullValue', byNull())
- }
- headers {
- contentType(applicationJson())
- header('Some-Header', $(c('someValue'), p(regex('[a-zA-Z]{9}'))))
- }
- }
+ request {
+ method 'GET'
+ urlPath '/get'
+ body([
+ duck : 123,
+ alpha : 'abc',
+ number : 123,
+ aBoolean : true,
+ date : '2017-01-01',
+ dateTime : '2017-01-01T01:23:45',
+ time : '01:02:34',
+ valueWithoutAMatcher: 'foo',
+ valueWithTypeMatch : 'string',
+ key : [
+ 'complex.key': 'foo'
+ ]
+ ])
+ bodyMatchers {
+ jsonPath('$.duck', byRegex("[0-9]{3}"))
+ jsonPath('$.duck', byEquality())
+ jsonPath('$.alpha', byRegex(onlyAlphaUnicode()))
+ jsonPath('$.alpha', byEquality())
+ jsonPath('$.number', byRegex(number()))
+ jsonPath('$.aBoolean', byRegex(anyBoolean()))
+ jsonPath('$.date', byDate())
+ jsonPath('$.dateTime', byTimestamp())
+ jsonPath('$.time', byTime())
+ jsonPath("\$.['key'].['complex.key']", byEquality())
+ }
+ headers {
+ contentType(applicationJson())
+ }
+ }
+ response {
+ status OK()
+ body([
+ duck : 123,
+ alpha : 'abc',
+ number : 123,
+ positiveInteger : 1234567890,
+ negativeInteger : -1234567890,
+ positiveDecimalNumber: 123.4567890,
+ negativeDecimalNumber: -123.4567890,
+ aBoolean : true,
+ date : '2017-01-01',
+ dateTime : '2017-01-01T01:23:45',
+ time : "01:02:34",
+ valueWithoutAMatcher : 'foo',
+ valueWithTypeMatch : 'string',
+ valueWithMin : [
+ 1, 2, 3
+ ],
+ valueWithMax : [
+ 1, 2, 3
+ ],
+ valueWithMinMax : [
+ 1, 2, 3
+ ],
+ valueWithMinEmpty : [],
+ valueWithMaxEmpty : [],
+ key : [
+ 'complex.key': 'foo'
+ ],
+ nullValue : null
+ ])
+ bodyMatchers {
+ // asserts the jsonpath value against manual regex
+ jsonPath('$.duck', byRegex("[0-9]{3}"))
+ // asserts the jsonpath value against the provided value
+ jsonPath('$.duck', byEquality())
+ // asserts the jsonpath value against some default regex
+ jsonPath('$.alpha', byRegex(onlyAlphaUnicode()))
+ jsonPath('$.alpha', byEquality())
+ jsonPath('$.number', byRegex(number()))
+ jsonPath('$.positiveInteger', byRegex(anInteger()))
+ jsonPath('$.negativeInteger', byRegex(anInteger()))
+ jsonPath('$.positiveDecimalNumber', byRegex(aDouble()))
+ jsonPath('$.negativeDecimalNumber', byRegex(aDouble()))
+ jsonPath('$.aBoolean', byRegex(anyBoolean()))
+ // asserts vs inbuilt time related regex
+ jsonPath('$.date', byDate())
+ jsonPath('$.dateTime', byTimestamp())
+ jsonPath('$.time', byTime())
+ // asserts that the resulting type is the same as in response body
+ jsonPath('$.valueWithTypeMatch', byType())
+ jsonPath('$.valueWithMin', byType {
+ // results in verification of size of array (min 1)
+ minOccurrence(1)
+ })
+ jsonPath('$.valueWithMax', byType {
+ // results in verification of size of array (max 3)
+ maxOccurrence(3)
+ })
+ jsonPath('$.valueWithMinMax', byType {
+ // results in verification of size of array (min 1 & max 3)
+ minOccurrence(1)
+ maxOccurrence(3)
+ })
+ jsonPath('$.valueWithMinEmpty', byType {
+ // results in verification of size of array (min 0)
+ minOccurrence(0)
+ })
+ jsonPath('$.valueWithMaxEmpty', byType {
+ // results in verification of size of array (max 0)
+ maxOccurrence(0)
+ })
+ // will execute a method `assertThatValueIsANumber`
+ jsonPath('$.duck', byCommand('assertThatValueIsANumber($it)'))
+ jsonPath("\$.['key'].['complex.key']", byEquality())
+ jsonPath('$.nullValue', byNull())
+ }
+ headers {
+ contentType(applicationJson())
+ header('Some-Header', $(c('someValue'), p(regex('[a-zA-Z]{9}'))))
+ }
+ }
}
YAML.
request: diff --git a/single/spring-cloud-contract.html b/single/spring-cloud-contract.html index 98a0cb906d..2baf875677 100644 --- a/single/spring-cloud-contract.html +++ b/single/spring-cloud-contract.html @@ -4356,122 +4356,122 @@ email, url, uuid, iso_date, iso_date_time, iso_time, iso_8601_with_offset, non_e type: by_regex predefined: only_alpha_unicode
Below you can find the allowed list of `type`s.
For stubMatchers:
by_equalityby_regexby_dateby_timestampby_timeFor testMatchers:
by_equalityby_regexby_dateby_timestampby_timeby_type
minOccurrence and maxOccurrence.by_commandby_nullConsider the following example:
Groovy DSL.
Contract contractDsl = Contract.make {
- request {
- method 'GET'
- urlPath '/get'
- body([
- duck : 123,
- alpha : 'abc',
- number : 123,
- aBoolean : true,
- date : '2017-01-01',
- dateTime : '2017-01-01T01:23:45',
- time : '01:02:34',
- valueWithoutAMatcher: 'foo',
- valueWithTypeMatch : 'string',
- key : [
- 'complex.key': 'foo'
- ]
- ])
- bodyMatchers {
- jsonPath('$.duck', byRegex("[0-9]{3}"))
- jsonPath('$.duck', byEquality())
- jsonPath('$.alpha', byRegex(onlyAlphaUnicode()))
- jsonPath('$.alpha', byEquality())
- jsonPath('$.number', byRegex(number()))
- jsonPath('$.aBoolean', byRegex(anyBoolean()))
- jsonPath('$.date', byDate())
- jsonPath('$.dateTime', byTimestamp())
- jsonPath('$.time', byTime())
- jsonPath("\$.['key'].['complex.key']", byEquality())
- }
- headers {
- contentType(applicationJson())
- }
- }
- response {
- status OK()
- body([
- duck : 123,
- alpha : 'abc',
- number : 123,
- positiveInteger : 1234567890,
- negativeInteger : -1234567890,
- positiveDecimalNumber: 123.4567890,
- negativeDecimalNumber: -123.4567890,
- aBoolean : true,
- date : '2017-01-01',
- dateTime : '2017-01-01T01:23:45',
- time : "01:02:34",
- valueWithoutAMatcher : 'foo',
- valueWithTypeMatch : 'string',
- valueWithMin : [
- 1, 2, 3
- ],
- valueWithMax : [
- 1, 2, 3
- ],
- valueWithMinMax : [
- 1, 2, 3
- ],
- valueWithMinEmpty : [],
- valueWithMaxEmpty : [],
- key : [
- 'complex.key': 'foo'
- ],
- nullValue : null
- ])
- bodyMatchers {
- // asserts the jsonpath value against manual regex
- jsonPath('$.duck', byRegex("[0-9]{3}"))
- // asserts the jsonpath value against the provided value
- jsonPath('$.duck', byEquality())
- // asserts the jsonpath value against some default regex
- jsonPath('$.alpha', byRegex(onlyAlphaUnicode()))
- jsonPath('$.alpha', byEquality())
- jsonPath('$.number', byRegex(number()))
- jsonPath('$.positiveInteger', byRegex(anInteger()))
- jsonPath('$.negativeInteger', byRegex(anInteger()))
- jsonPath('$.positiveDecimalNumber', byRegex(aDouble()))
- jsonPath('$.negativeDecimalNumber', byRegex(aDouble()))
- jsonPath('$.aBoolean', byRegex(anyBoolean()))
- // asserts vs inbuilt time related regex
- jsonPath('$.date', byDate())
- jsonPath('$.dateTime', byTimestamp())
- jsonPath('$.time', byTime())
- // asserts that the resulting type is the same as in response body
- jsonPath('$.valueWithTypeMatch', byType())
- jsonPath('$.valueWithMin', byType {
- // results in verification of size of array (min 1)
- minOccurrence(1)
- })
- jsonPath('$.valueWithMax', byType {
- // results in verification of size of array (max 3)
- maxOccurrence(3)
- })
- jsonPath('$.valueWithMinMax', byType {
- // results in verification of size of array (min 1 & max 3)
- minOccurrence(1)
- maxOccurrence(3)
- })
- jsonPath('$.valueWithMinEmpty', byType {
- // results in verification of size of array (min 0)
- minOccurrence(0)
- })
- jsonPath('$.valueWithMaxEmpty', byType {
- // results in verification of size of array (max 0)
- maxOccurrence(0)
- })
- // will execute a method `assertThatValueIsANumber`
- jsonPath('$.duck', byCommand('assertThatValueIsANumber($it)'))
- jsonPath("\$.['key'].['complex.key']", byEquality())
- jsonPath('$.nullValue', byNull())
- }
- headers {
- contentType(applicationJson())
- header('Some-Header', $(c('someValue'), p(regex('[a-zA-Z]{9}'))))
- }
- }
+ request {
+ method 'GET'
+ urlPath '/get'
+ body([
+ duck : 123,
+ alpha : 'abc',
+ number : 123,
+ aBoolean : true,
+ date : '2017-01-01',
+ dateTime : '2017-01-01T01:23:45',
+ time : '01:02:34',
+ valueWithoutAMatcher: 'foo',
+ valueWithTypeMatch : 'string',
+ key : [
+ 'complex.key': 'foo'
+ ]
+ ])
+ bodyMatchers {
+ jsonPath('$.duck', byRegex("[0-9]{3}"))
+ jsonPath('$.duck', byEquality())
+ jsonPath('$.alpha', byRegex(onlyAlphaUnicode()))
+ jsonPath('$.alpha', byEquality())
+ jsonPath('$.number', byRegex(number()))
+ jsonPath('$.aBoolean', byRegex(anyBoolean()))
+ jsonPath('$.date', byDate())
+ jsonPath('$.dateTime', byTimestamp())
+ jsonPath('$.time', byTime())
+ jsonPath("\$.['key'].['complex.key']", byEquality())
+ }
+ headers {
+ contentType(applicationJson())
+ }
+ }
+ response {
+ status OK()
+ body([
+ duck : 123,
+ alpha : 'abc',
+ number : 123,
+ positiveInteger : 1234567890,
+ negativeInteger : -1234567890,
+ positiveDecimalNumber: 123.4567890,
+ negativeDecimalNumber: -123.4567890,
+ aBoolean : true,
+ date : '2017-01-01',
+ dateTime : '2017-01-01T01:23:45',
+ time : "01:02:34",
+ valueWithoutAMatcher : 'foo',
+ valueWithTypeMatch : 'string',
+ valueWithMin : [
+ 1, 2, 3
+ ],
+ valueWithMax : [
+ 1, 2, 3
+ ],
+ valueWithMinMax : [
+ 1, 2, 3
+ ],
+ valueWithMinEmpty : [],
+ valueWithMaxEmpty : [],
+ key : [
+ 'complex.key': 'foo'
+ ],
+ nullValue : null
+ ])
+ bodyMatchers {
+ // asserts the jsonpath value against manual regex
+ jsonPath('$.duck', byRegex("[0-9]{3}"))
+ // asserts the jsonpath value against the provided value
+ jsonPath('$.duck', byEquality())
+ // asserts the jsonpath value against some default regex
+ jsonPath('$.alpha', byRegex(onlyAlphaUnicode()))
+ jsonPath('$.alpha', byEquality())
+ jsonPath('$.number', byRegex(number()))
+ jsonPath('$.positiveInteger', byRegex(anInteger()))
+ jsonPath('$.negativeInteger', byRegex(anInteger()))
+ jsonPath('$.positiveDecimalNumber', byRegex(aDouble()))
+ jsonPath('$.negativeDecimalNumber', byRegex(aDouble()))
+ jsonPath('$.aBoolean', byRegex(anyBoolean()))
+ // asserts vs inbuilt time related regex
+ jsonPath('$.date', byDate())
+ jsonPath('$.dateTime', byTimestamp())
+ jsonPath('$.time', byTime())
+ // asserts that the resulting type is the same as in response body
+ jsonPath('$.valueWithTypeMatch', byType())
+ jsonPath('$.valueWithMin', byType {
+ // results in verification of size of array (min 1)
+ minOccurrence(1)
+ })
+ jsonPath('$.valueWithMax', byType {
+ // results in verification of size of array (max 3)
+ maxOccurrence(3)
+ })
+ jsonPath('$.valueWithMinMax', byType {
+ // results in verification of size of array (min 1 & max 3)
+ minOccurrence(1)
+ maxOccurrence(3)
+ })
+ jsonPath('$.valueWithMinEmpty', byType {
+ // results in verification of size of array (min 0)
+ minOccurrence(0)
+ })
+ jsonPath('$.valueWithMaxEmpty', byType {
+ // results in verification of size of array (max 0)
+ maxOccurrence(0)
+ })
+ // will execute a method `assertThatValueIsANumber`
+ jsonPath('$.duck', byCommand('assertThatValueIsANumber($it)'))
+ jsonPath("\$.['key'].['complex.key']", byEquality())
+ jsonPath('$.nullValue', byNull())
+ }
+ headers {
+ contentType(applicationJson())
+ header('Some-Header', $(c('someValue'), p(regex('[a-zA-Z]{9}'))))
+ }
+ }
}
YAML.
request: diff --git a/spring-cloud-contract.xml b/spring-cloud-contract.xml index 8ad59b07d3..2fbe5fd22c 100644 --- a/spring-cloud-contract.xml +++ b/spring-cloud-contract.xml @@ -7384,122 +7384,122 @@ email, url, uuid, iso_date, iso_date_time, iso_time, iso_8601_with_offset, non_eGroovy DSL Contract contractDsl = Contract.make { - request { - method 'GET' - urlPath '/get' - body([ - duck : 123, - alpha : 'abc', - number : 123, - aBoolean : true, - date : '2017-01-01', - dateTime : '2017-01-01T01:23:45', - time : '01:02:34', - valueWithoutAMatcher: 'foo', - valueWithTypeMatch : 'string', - key : [ - 'complex.key': 'foo' - ] - ]) - bodyMatchers { - jsonPath('$.duck', byRegex("[0-9]{3}")) - jsonPath('$.duck', byEquality()) - jsonPath('$.alpha', byRegex(onlyAlphaUnicode())) - jsonPath('$.alpha', byEquality()) - jsonPath('$.number', byRegex(number())) - jsonPath('$.aBoolean', byRegex(anyBoolean())) - jsonPath('$.date', byDate()) - jsonPath('$.dateTime', byTimestamp()) - jsonPath('$.time', byTime()) - jsonPath("\$.['key'].['complex.key']", byEquality()) - } - headers { - contentType(applicationJson()) - } - } - response { - status OK() - body([ - duck : 123, - alpha : 'abc', - number : 123, - positiveInteger : 1234567890, - negativeInteger : -1234567890, - positiveDecimalNumber: 123.4567890, - negativeDecimalNumber: -123.4567890, - aBoolean : true, - date : '2017-01-01', - dateTime : '2017-01-01T01:23:45', - time : "01:02:34", - valueWithoutAMatcher : 'foo', - valueWithTypeMatch : 'string', - valueWithMin : [ - 1, 2, 3 - ], - valueWithMax : [ - 1, 2, 3 - ], - valueWithMinMax : [ - 1, 2, 3 - ], - valueWithMinEmpty : [], - valueWithMaxEmpty : [], - key : [ - 'complex.key': 'foo' - ], - nullValue : null - ]) - bodyMatchers { - // asserts the jsonpath value against manual regex - jsonPath('$.duck', byRegex("[0-9]{3}")) - // asserts the jsonpath value against the provided value - jsonPath('$.duck', byEquality()) - // asserts the jsonpath value against some default regex - jsonPath('$.alpha', byRegex(onlyAlphaUnicode())) - jsonPath('$.alpha', byEquality()) - jsonPath('$.number', byRegex(number())) - jsonPath('$.positiveInteger', byRegex(anInteger())) - jsonPath('$.negativeInteger', byRegex(anInteger())) - jsonPath('$.positiveDecimalNumber', byRegex(aDouble())) - jsonPath('$.negativeDecimalNumber', byRegex(aDouble())) - jsonPath('$.aBoolean', byRegex(anyBoolean())) - // asserts vs inbuilt time related regex - jsonPath('$.date', byDate()) - jsonPath('$.dateTime', byTimestamp()) - jsonPath('$.time', byTime()) - // asserts that the resulting type is the same as in response body - jsonPath('$.valueWithTypeMatch', byType()) - jsonPath('$.valueWithMin', byType { - // results in verification of size of array (min 1) - minOccurrence(1) - }) - jsonPath('$.valueWithMax', byType { - // results in verification of size of array (max 3) - maxOccurrence(3) - }) - jsonPath('$.valueWithMinMax', byType { - // results in verification of size of array (min 1 & max 3) - minOccurrence(1) - maxOccurrence(3) - }) - jsonPath('$.valueWithMinEmpty', byType { - // results in verification of size of array (min 0) - minOccurrence(0) - }) - jsonPath('$.valueWithMaxEmpty', byType { - // results in verification of size of array (max 0) - maxOccurrence(0) - }) - // will execute a method `assertThatValueIsANumber` - jsonPath('$.duck', byCommand('assertThatValueIsANumber($it)')) - jsonPath("\$.['key'].['complex.key']", byEquality()) - jsonPath('$.nullValue', byNull()) - } - headers { - contentType(applicationJson()) - header('Some-Header', $(c('someValue'), p(regex('[a-zA-Z]{9}')))) - } - } + request { + method 'GET' + urlPath '/get' + body([ + duck : 123, + alpha : 'abc', + number : 123, + aBoolean : true, + date : '2017-01-01', + dateTime : '2017-01-01T01:23:45', + time : '01:02:34', + valueWithoutAMatcher: 'foo', + valueWithTypeMatch : 'string', + key : [ + 'complex.key': 'foo' + ] + ]) + bodyMatchers { + jsonPath('$.duck', byRegex("[0-9]{3}")) + jsonPath('$.duck', byEquality()) + jsonPath('$.alpha', byRegex(onlyAlphaUnicode())) + jsonPath('$.alpha', byEquality()) + jsonPath('$.number', byRegex(number())) + jsonPath('$.aBoolean', byRegex(anyBoolean())) + jsonPath('$.date', byDate()) + jsonPath('$.dateTime', byTimestamp()) + jsonPath('$.time', byTime()) + jsonPath("\$.['key'].['complex.key']", byEquality()) + } + headers { + contentType(applicationJson()) + } + } + response { + status OK() + body([ + duck : 123, + alpha : 'abc', + number : 123, + positiveInteger : 1234567890, + negativeInteger : -1234567890, + positiveDecimalNumber: 123.4567890, + negativeDecimalNumber: -123.4567890, + aBoolean : true, + date : '2017-01-01', + dateTime : '2017-01-01T01:23:45', + time : "01:02:34", + valueWithoutAMatcher : 'foo', + valueWithTypeMatch : 'string', + valueWithMin : [ + 1, 2, 3 + ], + valueWithMax : [ + 1, 2, 3 + ], + valueWithMinMax : [ + 1, 2, 3 + ], + valueWithMinEmpty : [], + valueWithMaxEmpty : [], + key : [ + 'complex.key': 'foo' + ], + nullValue : null + ]) + bodyMatchers { + // asserts the jsonpath value against manual regex + jsonPath('$.duck', byRegex("[0-9]{3}")) + // asserts the jsonpath value against the provided value + jsonPath('$.duck', byEquality()) + // asserts the jsonpath value against some default regex + jsonPath('$.alpha', byRegex(onlyAlphaUnicode())) + jsonPath('$.alpha', byEquality()) + jsonPath('$.number', byRegex(number())) + jsonPath('$.positiveInteger', byRegex(anInteger())) + jsonPath('$.negativeInteger', byRegex(anInteger())) + jsonPath('$.positiveDecimalNumber', byRegex(aDouble())) + jsonPath('$.negativeDecimalNumber', byRegex(aDouble())) + jsonPath('$.aBoolean', byRegex(anyBoolean())) + // asserts vs inbuilt time related regex + jsonPath('$.date', byDate()) + jsonPath('$.dateTime', byTimestamp()) + jsonPath('$.time', byTime()) + // asserts that the resulting type is the same as in response body + jsonPath('$.valueWithTypeMatch', byType()) + jsonPath('$.valueWithMin', byType { + // results in verification of size of array (min 1) + minOccurrence(1) + }) + jsonPath('$.valueWithMax', byType { + // results in verification of size of array (max 3) + maxOccurrence(3) + }) + jsonPath('$.valueWithMinMax', byType { + // results in verification of size of array (min 1 & max 3) + minOccurrence(1) + maxOccurrence(3) + }) + jsonPath('$.valueWithMinEmpty', byType { + // results in verification of size of array (min 0) + minOccurrence(0) + }) + jsonPath('$.valueWithMaxEmpty', byType { + // results in verification of size of array (max 0) + maxOccurrence(0) + }) + // will execute a method `assertThatValueIsANumber` + jsonPath('$.duck', byCommand('assertThatValueIsANumber($it)')) + jsonPath("\$.['key'].['complex.key']", byEquality()) + jsonPath('$.nullValue', byNull()) + } + headers { + contentType(applicationJson()) + header('Some-Header', $(c('someValue'), p(regex('[a-zA-Z]{9}')))) + } + } }