The ContractsTest and corresponding yml file is beeing generated correctly in the same folder. I'am getting a FileNotFoundException when running the test though.
testClass.getClass().getResource(relativePath) in fileToBytes Method is returning null value.
stacktrace:
java.lang.IllegalStateException: java.io.FileNotFoundException: test_status_tracking_update.yml
at org.springframework.cloud.contract.verifier.util.ContractVerifierUtil.fileToBytes(ContractVerifierUtil.java:83)
at org.springframework.cloud.contract.verifier.util.ContractVerifierUtil.contract(ContractVerifierUtil.java:136)
at de.test.bla.test.cdc.base.ContractsTest.validate_test_status_tracking_update(ContractsTest.java:26)
It seems that the location of the file is relative to the contracts: make sure the test file is at the same folder level as the contracts (when I try to put the file elsewhere, it was not resolved).
I have a structure like this:
And a test like this:
And it works fine