Hi guys, maybe you can help me. i am trying to und...
# pact-jvm
s
Hi guys, maybe you can help me. i am trying to understand what should i change in my
provider
test.
Copy code
@Provider("provider-adapter")
@PactFolder("pacts")
class ProviderContractTest {

  @TestTemplate
  @ExtendWith(PactVerificationInvocationContextProvider::class)
  fun testTemplate(pact: Pact?, interaction: Interaction?, context: PactVerificationContext?) {
    context?.verifyInteraction()
  }

  @BeforeEach
  fun before(context: PactVerificationContext?) {
    context?.target = MessageTestTarget()
  }

  @State("ProviderState")
  fun providerState() {

  }

  @Suppress("unused")
  @PactVerifyProvider("some test")
  private fun verifyProvider(): String {
    return "{ \"name\" : \"test\"}"
  }
  
}
After test run i am getting the following message:
Copy code
Only message interactions can be used with an AMPQ test target
java.lang.UnsupportedOperationException: Only message interactions can be used with an AMPQ test target
	at au.com.dius.pact.provider.junit5.MessageTestTarget.prepareRequest(TestTarget.kt:184)
	at au.com.dius.pact.provider.junit5.PactVerificationExtension.beforeTestExecution(PactVerificationExtension.kt:117)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeBeforeTestExecutionCallbacks$5(TestMethodTestDescriptor.java:188)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeBeforeMethodsOrCallbacksUntilExceptionOccurs$6(TestMethodTestDescriptor.java:199)
u
You have set
context?.target = MessageTestTarget()
, but the pact files being verified must contain HTTP interactions.
s
@uglyog thanks for you reply. hmm but don’t see http interactions instructions in pact file.
message has been deleted
u
You're loading from a directory with
@PactFolder("pacts")
It will load all matching pacts from that directory
s
yes, but i only have this pact file there.