pact-foundation / pact-jvm

JVM version of Pact. Enables consumer driven contract testing, providing a mock service and DSL for the consumer project, and interaction playback and verification for the service provider project.
https://docs.pact.io
Apache License 2.0
1.08k stars 479 forks source link

Enhance Unexpected request error message format #1497

Open SergeyPirogov opened 2 years ago

SergeyPirogov commented 2 years ago

Hello, would be nice to make Unexpected request error message format better, readable to get better understanding why is it not matched

Response. Status code: 500, body: { "error": "Unexpected request : \tmethod: POST\n\tpath: \/extresinventory\/api\/v1\/api\/locality\/all\n\tquery: {}\n\theaders: {Accept-encoding=[gzip,deflate], Accept=[application\/json, application\/*+json], Connection=[Keep-Alive], Host=[localhost:9999], User-agent=[Apache-HttpClient\/4.5.11 (Java\/11.0.10)], Content-type=[application\/json], Content-length=[133]}\n\tmatchers: MatchingRules(rules={})\n\tgenerators: Generators(categories={})\n\tbody: PRESENT({\"id\":\"0b775ded-44bf-4231-a805-cca92c5967fc\",\"params\":{\"resource\":{\"id\":\"0\"},\"host\":\"http:\/\/localhost:9999\/extresinventory\/api\/v1\/\"}})" }

I could try to provide a PR for this, but I need help to find the place where this check is performed

mefellows commented 2 years ago

Have you looked at the reporters for this?

SergeyPirogov commented 2 years ago

@mefellows no, could you please point me to the right place?

mefellows commented 2 years ago

https://docs.pact.io/implementation_guides/jvm/provider/junit/#enabling-additional-reports-via-annotations-on-the-test-classes