diff --git a/specs/spring-cloud-contract-spec/src/test/groovy/org/springframework/cloud/contract/spec/internal/ContractSpec.groovy b/specs/spring-cloud-contract-spec/src/test/groovy/org/springframework/cloud/contract/spec/internal/ContractSpec.groovy index b54cc0a04e..0f52513ac7 100644 --- a/specs/spring-cloud-contract-spec/src/test/groovy/org/springframework/cloud/contract/spec/internal/ContractSpec.groovy +++ b/specs/spring-cloud-contract-spec/src/test/groovy/org/springframework/cloud/contract/spec/internal/ContractSpec.groovy @@ -16,7 +16,7 @@ package org.springframework.cloud.contract.spec.internal - +import spock.lang.Issue import spock.lang.Specification import org.springframework.cloud.contract.spec.Contract @@ -445,4 +445,23 @@ then: expect: contract != null } + + @Issue("1200") + def 'should fail when regex do not match the concrete value'() { + when: + Contract.make { + request { + method 'GET' + url '/any' + } + response { + status OK() + body([ + time: $(p(regex(iso8601WithOffset())),c( "thisIsNotADate")) + ]) + } + } + then: + thrown(IllegalStateException) + } }