Enum Class StructuralMatchMode

java.lang.Object
java.lang.Enum<StructuralMatchMode>
dev.dokimos.core.evaluators.StructuralMatchMode
All Implemented Interfaces:
Serializable, Comparable<StructuralMatchMode>, Constable

public enum StructuralMatchMode extends Enum<StructuralMatchMode>
Controls how StructuralMatchEvaluator compares an expected JSON structure against an actual one.

Both modes are numeric-value-aware: a number compares by value, not by representation, so 5 and 5.0 (and 1.0 versus 1.00) always match in either mode. The modes differ only on how they treat object field sets and array ordering.

  • Enum Constant Details

    • STRICT

      public static final StructuralMatchMode STRICT
      Strict comparison (the eval-safe default).
      • Objects must have the exact same set of fields — an extra field in the actual output is a mismatch and penalizes the score.
      • Arrays must match element-for-element in the same order.
      • A null value and a missing field are distinct.
    • LENIENT

      public static final StructuralMatchMode LENIENT
      Lenient comparison.
      • Extra fields in the actual output are ignored (the actual may be a superset of the expected object).
      • Array order is ignored, but multiplicity is not — arrays are compared as multisets, so [1, 1, 2] does not match [1, 2].
      • A null value and a missing field are treated as equal.
  • Method Details

    • values

      public static StructuralMatchMode[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static StructuralMatchMode valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null