Skip to content

Not printing all the changes. #195

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
manojp1988 opened this issue Nov 27, 2017 · 0 comments
Open

Not printing all the changes. #195

manojp1988 opened this issue Nov 27, 2017 · 0 comments

Comments

@manojp1988
Copy link

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);
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant