com.bazaarvoice.jolt
Class Diffy

java.lang.Object
  extended by com.bazaarvoice.jolt.Diffy
Direct Known Subclasses:
ArrayOrderObliviousDiffy

public class Diffy
extends 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
static class Diffy.Result
          Contains the unmatched fields from the Diffy operation.
 
Constructor Summary
Diffy()
           
 
Method Summary
 Diffy.Result diff(Object expected, Object actual)
           
protected  Diffy.Result diffHelper(Object expected, Object actual)
           
protected  Diffy.Result diffList(List expected, List actual)
           
protected  Diffy.Result diffMap(Map<String,Object> expected, Map<String,Object> actual)
           
protected  Diffy.Result diffScalar(Object expected, Object actual)
           
protected  boolean scalarEquals(Object expected, Object actual)
          Allow subclasses to handle things like Long 0 versus Int 0.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Diffy

public Diffy()
Method Detail

diff

public Diffy.Result diff(Object expected,
                         Object actual)

diffHelper

protected Diffy.Result diffHelper(Object expected,
                                  Object actual)

diffMap

protected Diffy.Result diffMap(Map<String,Object> expected,
                               Map<String,Object> actual)

diffList

protected Diffy.Result diffList(List expected,
                                List actual)

diffScalar

protected Diffy.Result diffScalar(Object expected,
                                  Object actual)

scalarEquals

protected boolean scalarEquals(Object expected,
                               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.



Copyright © 2013. All Rights Reserved.