Open sijinhe opened 4 years ago
Default behavior for a provider verification test is to verify all the contracts for that provider. You can use different tests, but you will have to apply filters so it only verifies the correct pact files. See https://github.com/DiUS/pact-jvm/tree/master/provider/junit#filtering-the-interactions-that-are-verified
Can I split Message Contracts Verification methods into different Test Classes? Currently I have 2 Consumers with 1 Interaction each and 1 Provider that needs to verify those 2 Contracts. In the Provider codebase I have 2 different Test Classes. I’m seeing that the first test class finds the 2 Contracts and it’s somehow instantiating the second class and calling the PactVerifyProvider method but since it wasn’t run by JUnit, some fields in that class are null.
I understand the design could be that different classes have different @PactVerifyProvider so only 1 Pact test is needed but I’m finding that those classes don’t have its @Before called, nor its Spring Context initialised.
In general I also find the use of @PactVerifyProvider across multiple classes confusing. It can only work if the annotated methods don’t need any fields from the class. And it’s also confusing to me that if there are two classes with AmpqTestTarget targets and @PactVerifyProvider each that each class calls the other classes methods.
Maybe it’s worth it to create a bug?