Class MatchDifference

java.lang.Object
org.mockserver.matchers.MatchDifference

public class MatchDifference extends Object
  • Constructor Details

    • MatchDifference

      public MatchDifference(boolean detailedMatchFailures, RequestDefinition httpRequest)
  • Method Details

    • suppressMatchResultLogging

      public MatchDifference suppressMatchResultLogging()
      Mark this difference context as diagnostic-only: matchers must compute differences without logging EXPECTATION_MATCHED / EXPECTATION_NOT_MATCHED events. Used by read-only endpoints (explainUnmatched, debugMismatch) so they do not write side-effect entries into the event log.
    • isSuppressMatchResultLogging

      public boolean isSuppressMatchResultLogging()
    • collectAllDifferences

      public MatchDifference collectAllDifferences()
      Ask matchers to evaluate every field instead of stopping at the first non-matching one, so this context collects the complete set of differing fields.

      Only for read-only diagnostics that need to know how much of a request matched (notably debugMismatch, which ranks expectations by closeness). It is scoped to this one evaluation and never touches the shared matcher configuration, so it cannot slow or alter matching for any other request.

    • isCollectAllDifferences

      public boolean isCollectAllDifferences()
    • addDifference

      public MatchDifference addDifference(MockServerLogger mockServerLogger, Throwable throwable, String messageFormat, Object... arguments)
    • addDifference

      public MatchDifference addDifference(MockServerLogger mockServerLogger, String messageFormat, Object... arguments)
    • addDifference

      public MatchDifference addDifference(MatchDifference.Field fieldName, String messageFormat, Object... arguments)
    • addDifference

      public MatchDifference addDifference(String messageFormat, Object... arguments)
    • getHttpRequest

      public RequestDefinition getHttpRequest()
    • getLogCorrelationId

      public String getLogCorrelationId()
    • currentField

      protected MatchDifference currentField(MatchDifference.Field fieldName)
    • getDifferences

      public List<String> getDifferences(MatchDifference.Field fieldName)
    • getAllDifferences

      public Map<MatchDifference.Field,List<String>> getAllDifferences()
    • addDifferences

      public void addDifferences(Map<MatchDifference.Field,List<String>> differences)