Closed l2c0r3 closed 4 months ago
Found the solution. Unfortunately, it is not a Quarkus test (https://github.com/pact-foundation/pact-jvm/issues/1506)
@Provider("SignPdfProvider")
@Consumer("signPdfConsumer")
@PactFolder("pacts")
@ExtendWith(MockitoExtension.class)
public class SignPdfJmsProviderContractTest {
@Mock
...
@InjectMocks
SignPdfService signPdfService;
@BeforeEach
void before(PactVerificationContext context) {
context.setTarget(new MessageTestTarget());
}
@TestTemplate
@ExtendWith(PactVerificationInvocationContextProvider.class)
void pactVerificationTestTemplate(PactVerificationContext context) {
context.verifyInteraction();
}
@PactVerifyProvider("a signPdfRequest Message")
public String testASignPdfRequestMessage() {
// return Body of JMS Message
}
}
Hello everyone
I have created a contract from the message consumer:
Now I would like to have it checked the produced messages.
For that I wrote following Test:
However, I get the following error message:
java.lang.UnsupportedOperationException: Only request/response interactions can be used with an HTTP test target at au.com.dius.pact.provider.junit5.HttpTestTarget.prepareRequest(TestTarget.kt:98) at au.com.dius.pact.provider.junit5.PactVerificationExtension.beforeTestExecution(PactVerificationExtension.kt:136) at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeBeforeTestExecutionCallbacks$5(TestMethodTestDescriptor.java:191)
Dependencies:
Many thanks for your support