Search code examples
javaspringspring-cloud-contract

Spring Cloud Contract not checking consumer/provider matching or not


I am using spring-boot-gradle-plugin 2.1.9.RELEASE, spring-cloud-contract-gradle-plugin 2.1.3.RELEASE and spring-cloud-dependencies Greenwich.SR3

For a contract with consumer and provider mismatching, for example

created_at: $(consumer("NOT A DATE"), producer(anyDate()))

previously error expected like:

Exception in thread "main" Assertion failed: 

assert testSide ==~ Pattern.compile(stubSide.optionalPattern())

But now I notice that same contract code won't get error as expected. It compiles and generate unit test and stubs successfully without checking wether consumer and provider side are matching with each other.

I have tried to use some older version of verifier and gradle plugin, but still compile successfully.


Solution

  • Please upgrade to Greenwich.SR4 and Spring Cloud Contract 2.1.4 (https://github.com/spring-cloud/spring-cloud-contract/commit/22d7be7e96cfa7343cc34a1376276b7c555cf1f4 and https://github.com/spring-cloud/spring-cloud-contract/issues/1200)