### Question:
DbAddressBook implements GlobalAddressBook { @Override public String addContact(Contact contact) { return addressBookDao.addContact(contact); }  @Override String addContact(Contact contact); @Override Contact getContact(String contactId); AddressBookDao getAddressBookDao(); void setAddressBookDao(AddressBookDao addressBookDao); @Override List<Contact> getAll(); @Override void deleteContact(String id);  }### Answer:
@Test public void testAddContact() { expectedContact.setFirstName("Pedro"); when(mockAddressBookDao.addContact(expectedContact)).thenReturn("newId"); String contactId = addressBook.addContact(expectedContact); assertEquals("newId", contactId); }
@Test public void testAddSimpleContact() { expectedContact.setFirstName("Pedro"); when(mockAddressBookDao.addContact(any(Contact.class))).thenReturn("expectedId"); String contactId = addressBook.addContact(expectedContact); assertEquals("expectedId", contactId); }
@Test public void testAddWithoutFirstName() { expectedContact.setSurname("Ballesteros"); try { addressBook.addContact(expectedContact); fail("InvalidContactException expected."); } catch(InvalidContactException ex) { } }