Package org.japprove.differ
Class Differ
java.lang.Object
org.japprove.differ.Differ
public class Differ
extends java.lang.Object
A central class that is responsible for computing differences of two strings or json nodes. It is
also possible to call an external diff tool.
-
Constructor Summary
Constructors Constructor Description Differ(ApprovalTestingEngine approvalTestingEngine, java.lang.String pathToDiffTool) -
Method Summary
Modifier and Type Method Description voidcallExternalDiffTool(java.lang.String baselineCandidateName)Computes the differences of the baseline candidate and the baseline by calling an external diff tool.java.lang.StringgetDifferences(com.fasterxml.jackson.databind.JsonNode original, com.fasterxml.jackson.databind.JsonNode revised)Computes the differences for two passed json nodes.java.lang.StringgetDifferences(java.lang.String original, java.lang.String revised)Computes the differences for two passed strings.
-
Constructor Details
-
Method Details
-
callExternalDiffTool
public void callExternalDiffTool(java.lang.String baselineCandidateName)Computes the differences of the baseline candidate and the baseline by calling an external diff tool.- Parameters:
baselineCandidateName- the name of the baseline candidate for which the differences should be computed
-
getDifferences
public java.lang.String getDifferences(java.lang.String original, java.lang.String revised)Computes the differences for two passed strings.- Parameters:
original- the original stringrevised- the changed string- Returns:
- a formatted string with the differences
-
getDifferences
public java.lang.String getDifferences(com.fasterxml.jackson.databind.JsonNode original, com.fasterxml.jackson.databind.JsonNode revised)Computes the differences for two passed json nodes.- Parameters:
original- the original json noderevised- the changed json node- Returns:
- a formatted string with the differences
-