Added isoDate, isoTime, isoDateTime

fixes #183
This commit is contained in:
Marcin Grzejszczak
2017-01-03 18:13:06 +01:00
parent 78ebacd9c5
commit b404369341
5 changed files with 129 additions and 21 deletions

View File

@@ -993,7 +993,10 @@ class JaxRsClientMethodBuilderSpec extends Specification implements WireMockStub
hostname: $(anyHostname()),
email: $(anyEmail()),
url: $(anyUrl()),
uuid: $(anyUuid())
uuid: $(anyUuid()),
date: $(anyDate()),
dateTime: $(anyDateTime()),
time: $(anyTime())
])
headers {
contentType(applicationJson())
@@ -1009,7 +1012,10 @@ class JaxRsClientMethodBuilderSpec extends Specification implements WireMockStub
hostname: $(anyHostname()),
email: $(anyEmail()),
url: $(anyUrl()),
uuid: $(anyUuid())
uuid: $(anyUuid()),
date: $(anyDate()),
dateTime: $(anyDateTime()),
time: $(anyTime())
])
headers {
contentType(applicationJson())
@@ -1030,6 +1036,9 @@ class JaxRsClientMethodBuilderSpec extends Specification implements WireMockStub
test.contains('assertThatJson(parsedJson).field("email").matches("[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\\\.[a-zA-Z]{2,4}")')
test.contains('assertThatJson(parsedJson).field("ip").matches("([01]?\\\\d\\\\d?|2[0-4]\\\\d|25[0-5])\\\\.([01]?\\\\d\\\\d?|2[0-4]\\\\d|25[0-5])\\\\.([01]?\\\\d\\\\d?|2[0-4]\\\\d|25[0-5])\\\\.([01]?\\\\d\\\\d?|2[0-4]\\\\d|25[0-5])")')
test.contains('assertThatJson(parsedJson).field("uuid").matches("[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}")')
test.contains('assertThatJson(parsedJson).field("date").matches("(\\\\d\\\\d\\\\d\\\\d)-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])")')
test.contains('assertThatJson(parsedJson).field("dateTime").matches("([0-9]{4})-(1[0-2]|0[1-9])-(3[01]|0[1-9]|[12][0-9])T(2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])")')
test.contains('assertThatJson(parsedJson).field("time").matches("(2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])")')
!test.contains('cursor')
and:
SyntaxChecker.tryToCompile(methodBuilderName, blockBuilder.toString())

View File

@@ -1897,7 +1897,7 @@ World.'''"""
@Issue('#149')
@Unroll
def "should allow easier way of providing dynamic values"() {
def "should allow easier way of providing dynamic values for [#methodBuilderName]"() {
given:
Contract contractDsl = Contract.make {
request {
@@ -1912,7 +1912,10 @@ World.'''"""
hostname: $(anyHostname()),
email: $(anyEmail()),
url: $(anyUrl()),
uuid: $(anyUuid())
uuid: $(anyUuid()),
date: $(anyDate()),
dateTime: $(anyDateTime()),
time: $(anyTime())
])
headers {
contentType(applicationJson())
@@ -1928,7 +1931,10 @@ World.'''"""
hostname: $(anyHostname()),
email: $(anyEmail()),
url: $(anyUrl()),
uuid: $(anyUuid())
uuid: $(anyUuid()),
date: $(anyDate()),
dateTime: $(anyDateTime()),
time: $(anyTime())
])
headers {
contentType(applicationJson())
@@ -1949,6 +1955,9 @@ World.'''"""
test.contains('assertThatJson(parsedJson).field("email").matches("[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\\\.[a-zA-Z]{2,4}")')
test.contains('assertThatJson(parsedJson).field("ip").matches("([01]?\\\\d\\\\d?|2[0-4]\\\\d|25[0-5])\\\\.([01]?\\\\d\\\\d?|2[0-4]\\\\d|25[0-5])\\\\.([01]?\\\\d\\\\d?|2[0-4]\\\\d|25[0-5])\\\\.([01]?\\\\d\\\\d?|2[0-4]\\\\d|25[0-5])")')
test.contains('assertThatJson(parsedJson).field("uuid").matches("[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}")')
test.contains('assertThatJson(parsedJson).field("date").matches("(\\\\d\\\\d\\\\d\\\\d)-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])')
test.contains('assertThatJson(parsedJson).field("dateTime").matches("([0-9]{4})-(1[0-2]|0[1-9])-(3[01]|0[1-9]|[12][0-9])T(2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])')
test.contains('assertThatJson(parsedJson).field("time").matches("(2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])")')
!test.contains('cursor')
and:
SyntaxChecker.tryToCompile(methodBuilderName, blockBuilder.toString())