Fixed flakey test

This commit is contained in:
Marcin Grzejszczak
2018-10-08 11:43:01 +02:00
parent 4d6cd416b5
commit 4e301c7d9a
5 changed files with 15 additions and 5 deletions

View File

@@ -107,8 +107,10 @@ class ContractSpec extends Specification {
request.with {
property = value(consumer(regex("[0-9]{5}")))
}
def value = Integer.valueOf(property.serverValue as String)
then:
(property.serverValue as String).matches(/[0-9]{5}/)
value >= 0
value <= 99_999
}
def 'should set a description'() {

View File

@@ -14,7 +14,9 @@ class InputSpec extends Specification {
input.with {
property = $(consumer(regex("[0-9]{5}")))
}
def value = Integer.valueOf(property.serverValue as String)
then:
(property.serverValue as String).matches(/[0-9]{5}/)
value >= 0
value <= 99_999
}
}

View File

@@ -14,7 +14,9 @@ class OutputMessageSpec extends Specification {
input.with {
property = $(consumer(regex("[0-9]{5}")))
}
def value = Integer.valueOf(property.serverValue as String)
then:
(property.serverValue as String).matches(/[0-9]{5}/)
value >= 0
value <= 99_999
}
}

View File

@@ -31,7 +31,9 @@ class RequestSpec extends Specification {
request.with {
property = value(consumer(regex("[0-9]{5}")))
}
def value = Integer.valueOf(property.serverValue as String)
then:
(property.serverValue as String).matches(/[0-9]{5}/)
value >= 0
value <= 99_999
}
}

View File

@@ -34,8 +34,10 @@ class ResponseSpec extends Specification {
request.with {
property = value(producer(regex("[0-9]{5}")))
}
def value = Integer.valueOf(property.clientValue as String)
then:
(property.clientValue as String).matches(/[0-9]{5}/)
value >= 0
value <= 99_999
(property.serverValue as Pattern).pattern() == '[0-9]{5}'
}
}