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
    void callExternalDiffTool​(java.lang.String baselineCandidateName)
    Computes the differences of the baseline candidate and the baseline by calling an external diff tool.
    java.lang.String getDifferences​(com.fasterxml.jackson.databind.JsonNode original, com.fasterxml.jackson.databind.JsonNode revised)
    Computes the differences for two passed json nodes.
    java.lang.String getDifferences​(java.lang.String original, java.lang.String revised)
    Computes the differences for two passed strings.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 string
      revised - 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 node
      revised - the changed json node
      Returns:
      a formatted string with the differences