Describe the bug
Version: Spring Cloud Contract 2.2.1.RELEASE
When ignoredFiles is specified in ContractVerifierExtension and that provided ant matcher matches at least one contract file name, all tests are disabled in the generated test class.\
Issue has been encountered on Junit4 and Junit5.
Sample
reproducer: https://github.com/fstaudt/scc-ignored-files
contractToCheck.groovy and contractToIgnore.groovyconfigure<ContractVerifierExtension> {
setIgnoredFiles(listOf("contractToIgnore.groovy"))
}
ContractVerifierTest are marked as Ignored (or Disabled if extension is configured Junit5). Expected behavior is that only method validate_contractToIgnore should be marked as Ignored.
I've debugged the generation of the test class and I believe the issue lies in classes:
In both these classes, the method accept should take into account the provided parameter.\
Instead of:
public boolean accept(SingleContractMetadata singleContractMetadata) {
return this.generatedClassMetaData.configProperties
.getTestFramework() == TestFramework.JUNIT5
&& this.generatedClassMetaData.isAnyIgnored();
}
we should have:
public boolean accept(SingleContractMetadata singleContractMetadata) {
return this.generatedClassMetaData.configProperties
.getTestFramework() == TestFramework.JUNIT5
&& singleContractMetadata.contractMetadata.ignored;
}
Hi! Thanks for the analysis. Do you want to file a pull request preferably with a test? If that's the case can you try doing it against the 2.2.x branch?
Sure, I can file provide a fix with unit tests for this issue on 2.2.x branch and file a pull request.
Most helpful comment
Sure, I can file provide a fix with unit tests for this issue on 2.2.x branch and file a pull request.