Package org.vaelen.contactmanager.model

Examples of org.vaelen.contactmanager.model.Contact


    createContact("Riker", "William", "Serial Number: SC-231-427\nCurrent Post: USS Titan NCC-80102 (Captain)\nPrevious Posts:\n\tUSS Enterprise NCC-1701-E (First Officer)\n\tUSS Enterprise NCC-1701-D (First Officer)\n\tUSS Hood NCC-42296 (First Officer)\n\tUSS Potemkin NCC-18253\n\tUSS Pegasus NCC-53847 (Conn Officer)", "riker@starfleet.com", "555-555-5555");
  }
 
  /** This method creates a Contact object to use for testing purposes. */
  private void createContact(String lastName, String firstName, String notes, String email, String phone) {
    Contact contact = new Contact();
    String contactId = UUID.randomUUID().toString();
    contact.setContactId(contactId);
    contact.setFirstName(firstName);
    contact.setLastName(lastName);
    contact.setNotes(notes);
   
    String phoneId = UUID.randomUUID().toString();
    PhoneNumber phoneNumber = new PhoneNumber();
    phoneNumber.setPhoneId(phoneId);
    phoneNumber.setContactId(contactId);
    phoneNumber.setPhoneNumber(phone);
    Set<PhoneNumber> phoneSet = new LinkedHashSet<PhoneNumber>();
    phoneSet.add(phoneNumber);
    contact.setPhoneNumbers(phoneSet);
   
    String emailId = UUID.randomUUID().toString();
    EmailAddress emailAddress = new EmailAddress();
    emailAddress.setEmailId(emailId);
    emailAddress.setContactId(contactId);
    emailAddress.setEmailAddress(email);
    Set<EmailAddress> emailSet = new LinkedHashSet<EmailAddress>();
    emailSet.add(emailAddress);
    contact.setEmailAddresses(emailSet);
   
    contact.setContactId(contactId);
    contactMap.put(contactId, contact);
    debug("Test Contact Created. First Name: %s, Last Name: %s, Contact ID: %s", firstName, lastName, contactId);
  }
View Full Code Here


    Assert.assertEquals("Contact List Is The Wrong Size", emailAddressCount, contacts.size());
  }
 
  @Test
  public void loadContact() {
    Contact contact = repository.loadContact(contactId);
    Assert.assertNotNull("Contact Was Null", contact);
  }
View Full Code Here

 
  @Test
  public void saveContact() {
    String note = String.format("Updated Last: %tc", new Date());
   
    Contact contact = repository.loadContact(contactId);
    Assert.assertNotNull("Contact Was Null Before Save", contact);
   
    contact.setNotes(note);
    repository.saveContact(contact);
   
    contact = repository.loadContact(contactId);
    Assert.assertNotNull("Contact Was Null After Save", contact);
    Assert.assertNotNull("Contact Was Not Saved, Notes Are Not There", contact.getNotes());
    Assert.assertEquals("Contact Was Not Saved, Notes Are Different", note, contact.getNotes());
  }
View Full Code Here

  }
 
  @RequestMapping("/contact/{contactId}.xml")
  public ModelAndView loadContact(@PathVariable("contactId") String contactId) {
    try {
      Contact contact = contactRepository.loadContact(contactId);
      ModelAndView modelAndView = new ModelAndView("content");
      modelAndView.addObject(contact);
      return modelAndView;
    } catch (Exception ex) {
      return new ModelAndView("error", "message", ex);
View Full Code Here

TOP

Related Classes of org.vaelen.contactmanager.model.Contact

Copyright © 2018 www.massapicom. 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.