AmpqTestTarget not finding @PactVerifyProvider, JUnit5, Java 11
See original GitHub issueHi, i am having the same issue as mentioned here https://github.com/DiUS/pact-jvm/issues/763.
Using:
<dependency>
<groupId>au.com.dius</groupId>
<artifactId>pact-jvm-provider-junit5_2.12</artifactId>
<version>3.6.14</version>
</dependency>
And :
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<configuration>
<useSystemClassLoader>false</useSystemClassLoader>
</configuration>
My test looks like this:
@Provider("user-service")
@PactBroker
public class UserPactTest {
@TestTemplate
@ExtendWith({PactVerificationInvocationContextProvider.class})
public void pactVerificationTestTemplate(PactVerificationContext context) {
context.verifyInteraction();
}
@BeforeEach
public void setUp(PactVerificationContext context) {
context.setTarget(new AmpqTestTarget(Collections.singletonList("my.package.pact")));
}
@PactVerifyProvider("user created message")
public String verifyUserCreatedMessage() throws JsonProcessingException {
// some code that just returns string from object with object mapper
}
}
I’ve tried multiple version of surefire plugin, tried using empty constructor for AmpqTestTarget but everything ends with:
user created message No annotated methods were found for interaction 'user created message'. You need to provide a method annotated with @PactVerifyProvider("user created message") that returns the message contents.
The test doesnt work from both IDE(Intellij) and maven. I just cant get it to work so any help would be appreciated.
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
AmpqTestTarget not finding @PactVerifyProvider, JUnit5 ...
Hi, i am having the same issue as mentioned here #763. Using: au.com.dius pact-jvm-provider-junit5_2.12 3.6.14 And : org.apache.maven.plug.
Read more >AmpqTestTarget - javadoc.io
This target will look for methods with a @PactVerifyProvider annotation where the value is the description of the interaction.
Read more >Having trouble in verifying the PACT from provider side using ...
I have to do PACT verification in java + ...
Read more >Pact Junit 5 Extension | Pact Docs
For writing Pact verification tests with JUnit 5, there is an JUnit 5 ... The Java packages to scan to find classes with...
Read more >au.com.dius.pact.provider : junit5 : 4.1.1 - Maven Central
This will generate a test for each interaction found for the pact files for ... **NOTE: JUnit 5 tests do not use `@TargetRequestFilter`**...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thank you very much for your help. I was finally able to fix it. Problem was the dependency. I was using:
Instead of :
No idea where i found the first one. Thanks again.
I upgraded a service to Java 11 + Junit 5, got the same problem. In my case it was because of a trailing star in the packages list:
which had to be replaced with (no star at end of package):