Class Expectations
java.lang.Object
codes.grow.packages.betterstack.testing.Expectations
Evaluates the
expect object of a scenario step (SPEC section 6).-
Method Summary
Modifier and TypeMethodDescriptionChecks a step outcome.static booleandeepMatch(com.fasterxml.jackson.databind.JsonNode expected, com.fasterxml.jackson.databind.JsonNode actual) Deep JSON equality where objects inexpectedare matched as subsets and numbers compare by value (42 == 42.0).static com.fasterxml.jackson.databind.JsonNodeReturns the JSON view of a value used byequals,contains,typeandsorted.
-
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 orOpResult), ignored whenerroris seterror- the error the handler threw, or null- Returns:
- failure messages; empty when every expectation holds
-
view
Returns the JSON view of a value used byequals,contains,typeandsorted.- 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 inexpectedare matched as subsets and numbers compare by value (42 == 42.0).- Parameters:
expected- expected JSONactual- actual JSON- Returns:
- true on match
-