### Question:
GlobalAddressBook { public String addContact(Contact contact) { String id = Integer.toString(nextId); nextId++; contact.setId(id); addressBookMap.put(id, contact); return id; }  String addContact(Contact contact); List<Contact> getAll(); Contact getContact(String contactId);  }### Answer:
@Test public void testAddContact() { GlobalAddressBook addressBook = new GlobalAddressBook(); Contact contact = new Contact(); contact.setFirstName("Pedro"); addressBook.addContact(contact); List<Contact> contacts = addressBook.getAll(); assertEquals(1, contacts.size()); assertEquals("Pedro", contacts.get(0).getFirstName()); }
@Test public void testAddContactVerifyId() { GlobalAddressBook addressBook = new GlobalAddressBook(); Contact contact = new Contact(); String contactId = addressBook.addContact(contact); assertNotNull(contactId); assertTrue(contactId.trim().length() > 0); }