Package com.bazaarvoice.jolt
Class Diffy
- java.lang.Object
-
- com.bazaarvoice.jolt.Diffy
-
- Direct Known Subclasses:
ArrayOrderObliviousDiffy
public class Diffy extends java.lang.Object
JSON Diff tool that will walk two "JSON" objects simultaneously and identify mismatches. Algorithm : 1) make a copy of both input objects 2) walk both objects and _remove_ items that match 3) return what is left of the two objects in the Result In the case a full / "sucessful" match, Diffy returns a Result object with isEmpty() == true.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Diffy.Result
Contains the unmatched fields from the Diffy operation.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Diffy.Result
diff(java.lang.Object expected, java.lang.Object actual)
protected Diffy.Result
diffHelper(java.lang.Object expected, java.lang.Object actual)
protected Diffy.Result
diffList(java.util.List<java.lang.Object> expected, java.util.List<java.lang.Object> actual)
protected Diffy.Result
diffMap(java.util.Map<java.lang.String,java.lang.Object> expected, java.util.Map<java.lang.String,java.lang.Object> actual)
protected Diffy.Result
diffScalar(java.lang.Object expected, java.lang.Object actual)
protected boolean
scalarEquals(java.lang.Object expected, java.lang.Object actual)
Allow subclasses to handle things like Long 0 versus Int 0.
-
-
-
Field Detail
-
jsonUtil
private final JsonUtil jsonUtil
-
-
Constructor Detail
-
Diffy
public Diffy()
-
Diffy
public Diffy(JsonUtil jsonUtil)
Pass in a custom jsonUtil to use for the cloneJson method.
-
-
Method Detail
-
diff
public Diffy.Result diff(java.lang.Object expected, java.lang.Object actual)
-
diffHelper
protected Diffy.Result diffHelper(java.lang.Object expected, java.lang.Object actual)
-
diffMap
protected Diffy.Result diffMap(java.util.Map<java.lang.String,java.lang.Object> expected, java.util.Map<java.lang.String,java.lang.Object> actual)
-
diffList
protected Diffy.Result diffList(java.util.List<java.lang.Object> expected, java.util.List<java.lang.Object> actual)
-
diffScalar
protected Diffy.Result diffScalar(java.lang.Object expected, java.lang.Object actual)
-
scalarEquals
protected boolean scalarEquals(java.lang.Object expected, java.lang.Object actual)
Allow subclasses to handle things like Long 0 versus Int 0. They should be the same, but the .equals doesn't handle it.
-
-