From 21ada1b2e038f997a36ff7b92d19d3808e4a67ea Mon Sep 17 00:00:00 2001 From: Ronald Holshausen Date: Wed, 8 Feb 2023 13:44:49 +1100 Subject: [PATCH] fix: support metadata mismatches from results from plugins --- .../kotlin/au/com/dius/pact/consumer/PluginMockServer.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/consumer/src/main/kotlin/au/com/dius/pact/consumer/PluginMockServer.kt b/consumer/src/main/kotlin/au/com/dius/pact/consumer/PluginMockServer.kt index b5247f4e2..488dd564a 100644 --- a/consumer/src/main/kotlin/au/com/dius/pact/consumer/PluginMockServer.kt +++ b/consumer/src/main/kotlin/au/com/dius/pact/consumer/PluginMockServer.kt @@ -2,6 +2,7 @@ package au.com.dius.pact.consumer import au.com.dius.pact.consumer.model.MockProviderConfig import au.com.dius.pact.core.matchers.BodyMismatch +import au.com.dius.pact.core.matchers.MetadataMismatch import au.com.dius.pact.core.model.BasePact import au.com.dius.pact.core.model.Pact import au.com.dius.pact.core.support.contains @@ -88,7 +89,11 @@ class PluginMockServer(pact: BasePact, config: MockProviderConfig) : BaseMockSer PactVerificationResult.Error(RuntimeException(results.error), PactVerificationResult.Ok(testResult)) } else { PactVerificationResult.PartialMismatch(results.mismatches.map { - BodyMismatch(it.expected, it.actual, it.mismatch, it.path, it.diff) + if (it.mismatchType == "metadata") { + MetadataMismatch(it.path, it.expected, it.actual, it.mismatch) + } else { + BodyMismatch(it.expected, it.actual, it.mismatch, it.path, it.diff) + } }) } })