Class JsonComparison

java.lang.Object
org.springframework.test.json.JsonComparison

public final class JsonComparison extends Object
A comparison of two JSON strings as returned from a JsonComparator.
Since:
6.2
Author:
Phillip Webb
  • Method Details

    • match

      public static JsonComparison match()
      Factory method to create a new JsonComparison when the JSON strings match.
      Returns:
      a new JsonComparison instance
    • mismatch

      public static JsonComparison mismatch(String message)
      Factory method to create a new JsonComparison when the JSON strings do not match.
      Parameters:
      message - a message describing the mismatch
      Returns:
      a new JsonComparison instance
    • getResult

      public JsonComparison.Result getResult()
      Return the result of the comparison.
    • getMessage

      @Nullable public String getMessage()
      Return a message describing the comparison.