Class Expectations

java.lang.Object
codes.grow.packages.skywalking.testing.Expectations

public final class Expectations extends Object
Evaluates the expect object of a scenario step (SPEC section 6).
  • Method Summary

    Modifier and Type
    Method
    Description
    static List<String>
    check(com.fasterxml.jackson.databind.JsonNode expect, Object result, Throwable error)
    Checks a step outcome.
    static boolean
    deepMatch(com.fasterxml.jackson.databind.JsonNode expected, com.fasterxml.jackson.databind.JsonNode actual)
    Deep JSON equality where objects in expected are matched as subsets and numbers compare by value (42 == 42.0).
    static com.fasterxml.jackson.databind.JsonNode
    view(Object value)
    Returns the JSON view of a value used by equals, contains, type and sorted.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • check

      public static List<String> check(com.fasterxml.jackson.databind.JsonNode expect, Object result, Throwable error)
      Checks a step outcome.
      Parameters:
      expect - expectations (variables substituted)
      result - handler result (plain value or OpResult), ignored when error is set
      error - the error the handler threw, or null
      Returns:
      failure messages; empty when every expectation holds
    • view

      public static com.fasterxml.jackson.databind.JsonNode view(Object value)
      Returns the JSON view of a value used by equals, contains, type and sorted.
      Parameters:
      value - any value
      Returns:
      the JSON tree; objects Jackson cannot serialise become their toString
    • deepMatch

      public static boolean deepMatch(com.fasterxml.jackson.databind.JsonNode expected, com.fasterxml.jackson.databind.JsonNode actual)
      Deep JSON equality where objects in expected are matched as subsets and numbers compare by value (42 == 42.0).
      Parameters:
      expected - expected JSON
      actual - actual JSON
      Returns:
      true on match