Package org.japprove.verifier
Class JsonVerifier
java.lang.Object
org.japprove.verifier.Verifier
org.japprove.verifier.JsonVerifier
public class JsonVerifier extends Verifier
The
JsonVerifier provides a method to verify JSON objects within Approval Tests. With its
ignore method it is also possible to ignore specific elements of a JSON object.-
Constructor Summary
Constructors Constructor Description JsonVerifier(ApprovalTestingEngine approvalTestingEngine) -
Method Summary
Modifier and Type Method Description JsonVerifierignore(java.lang.String jsonPath)Receives a JSONPath that should be ignored on the verification process.voidverify(com.fasterxml.jackson.databind.JsonNode data)Receives a JsonNode that should be verified within an Approval Test.
-
Constructor Details
-
Method Details
-
verify
public void verify(com.fasterxml.jackson.databind.JsonNode data)Receives a JsonNode that should be verified within an Approval Test.Within the verification process, a baseline candidate is created in the baseline candidate's directory and compared to a
baseline(if exists). In the case the versions are equal, the test passes. If no baseline exists, aVersionNotApprovedErroris thrown. If there is a baseline that is not equal to the current version, aVerificationFailedErroris thrown.- Parameters:
data- The JsonNode that should be verified
-
ignore
Receives a JSONPath that should be ignored on the verification process.- Parameters:
jsonPath- a JSONPath that should be ignored on the verification process- Returns:
- the JsonVerifier
-