Open
Description
In the below class, java-object-diff is just printing. How to iterate all the changes.?
Property at path '/name' has changed from [ Tommy C. Smart ] to [
Tommy Smart ]
public class DiffTest {
public static void main(String... args) {
House h1 = new House("TN");
House h2 = new House("KA");
House h3 = new House("CLT");
House h4 = new House("MUM");
List<House> oldHouses = new ArrayList<House>();
oldHouses.add(h1);
List<House> newHouses = new ArrayList<House>();
newHouses.add(h2);
newHouses.add(h3);
newHouses.add(h1);
List<String> specializations = Arrays.asList("Maths", "Science");
List<String> specializations1 = Arrays.asList("Science", "Geography");
Address address = new Address("Bangalore");
Address address2 = new Address("Charlotte");
final Person tommyOld = new Person("tommy", "Tommy Smart", address, specializations);
final Person tommyNew = new Person("tommy", "Tommy C. Smart", address2, specializations1);
tommyOld.setMinor(true);
tommyNew.setMinor(false);
tommyNew.setWife("Amy");
tommyOld.setHouses(oldHouses);
tommyNew.setHouses(newHouses);
final ObjectDiffer objectDiffer = ObjectDifferBuilder.buildDefault();
final DiffNode root = objectDiffer.compare(tommyOld, tommyNew);
final DiffNode.Visitor visitor = new PrintingVisitor(tommyOld, tommyNew);
root.visit(visitor);
}
}
Metadata
Metadata
Assignees
Labels
No labels