Andy Sun
Andy Sun

Reputation: 1

Hitting Mock Server but still getting au.com.dius.pact.consumer.PactMismatchesException: The following requests were not received:

I'm trying to write a Pact test for a new Kotlin Service.

I'm able to hit my mockServer and get a 200 response

However, I keep getting this error

au.com.dius.pact.consumer.PactMismatchesException: The following requests were not received: method: POST path: /requestAccess at au.com.dius.pact.consumer.junit.JUnitTestSupport.validateMockServerResult(JUnitTestSupport.kt:110) at au.com.dius.pact.consumer.junit5.PactConsumerTestExt.afterTestExecution(PactConsumerTestExt.kt:631)

When I run my code in IntelliJ in debug mode, I'm able to see the request hit my local server and I get a response back as well. I even see mockServer receive matchedRequests = 1, anyone have this issue before?

intellij screenshot

I've running my tests with

val pactTestRun = object : PactTestRun<Unit> { override fun run(mockServer: MockServer, context: PactTestExecutionContext?) {

as well as

val result = runConsumerTest(pact, config, pactTestRun)

Upvotes: 0

Views: 110

Answers (0)

Related Questions