Skip to content

Not printing all the changes. #195

Open
@manojp1988

Description

@manojp1988

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

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions