Guest User

Untitled

a guest
Nov 27th, 2017
351
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. public class JaversTest {
  2.  
  3. public static void main(String[] args) {
  4. User u1 = new User();
  5. User u2 = new User();
  6.  
  7. Email e1 = new Email();
  8. e1.setId("id1");
  9. e1.setMail("Vikrant5mahajan@gmail.com");
  10.  
  11. Email e2 = new Email();
  12. e2.setId("id1");
  13. e2.setMail("Vikrant6mahajan@gmail.com");
  14.  
  15. u1.setEmails(Collections.singletonList(e1));
  16. u2.setEmails(Collections.singletonList(e2));
  17.  
  18. Javers javers = JaversBuilder.javers().build();
  19. Diff diff = javers.compare(e1, e2);
  20. System.out.println(diff.prettyPrint());
  21. }
  22.  
  23. @Data
  24. public static class User {
  25. List<Email> emails = new ArrayList<>();
  26. }
  27.  
  28. @Data
  29. public static class Email {
  30. @Id
  31. String id;
  32. String mail;
  33. }
  34. }
  35.  
  36. 1. ValueChange{globalId:'com.practo.test.api.diff.JaversTest$Email/id1', property:'mail', oldVal:'Vikrant5mahajan@gmail.com', newVal:'Vikrant6mahajan@gmail.com'}
Add Comment
Please, Sign In to add comment