Examples of PhoneBook


Examples of de.danielbechler.diff.example.phonebook.PhoneBook

  @Test
  public void testDetectsChangeForDuplicatesInList() throws Exception
  {
    final Contact joe = new Contact("Joe", "Smith");
    final PhoneBook phoneBookServer = new PhoneBook("devs");
    phoneBookServer.addContact(joe);
    final PhoneBook phoneBookMobile = new PhoneBook("devs");
    phoneBookMobile.addContact(joe);

    assertEquals(DiffNode.State.UNTOUCHED, ObjectDifferBuilder.buildDefault().compare(phoneBookMobile, phoneBookServer).getState());
    phoneBookMobile.addContact(joe);
    assertEquals(2, phoneBookMobile.getContacts().size());
    //Should be ADDED!
    //assertEquals(DiffNode.State.ADDED, ObjectDifferFactory.getInstance().compare(phoneBookMobile, phoneBookServer).getState());
    assertEquals(DiffNode.State.UNTOUCHED, ObjectDifferBuilder.buildDefault().compare(phoneBookMobile, phoneBookServer).getState());
  }
View Full Code Here

Examples of de.danielbechler.diff.example.phonebook.PhoneBook

    root.visit(new PrintingVisitor(working, base));
  }

  private static void phoneBookExample()
  {
    final PhoneBook phoneBook = new PhoneBook("Breaking Bad");

    final Contact walterWhite = new Contact("Walter", "White");
    walterWhite.setPhoneNumber("Home", new PhoneNumber("1", "505", "316-7871"));
    walterWhite.setPhoneNumber("Work", new PhoneNumber("1", "505", "456-3788"));
    phoneBook.addContact(walterWhite);

    final Contact jessePinkman = new Contact("Jesse", "Pinkman");
    jessePinkman.setPhoneNumber("Home", new PhoneNumber("1", "505", "234-4628"));
    phoneBook.addContact(jessePinkman);

    final PhoneBook modifiedPhoneBook = PhoneBook.from(phoneBook);
    modifiedPhoneBook.getContact("Jesse", "Pinkman").setMiddleName("Bruce");
    modifiedPhoneBook.getContact("Walter", "White").setMiddleName("Hartwell");

    final ObjectDiffer objectDiffer = ObjectDifferBuilder.buildDefault();
    final DiffNode root = objectDiffer.compare(modifiedPhoneBook, phoneBook);
    final DiffNode.Visitor visitor = new PrintingVisitor(modifiedPhoneBook, phoneBook);
    root.visit(visitor);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.