### Question:
GlobalAddressBook { public String addContact(Contact contact) { String id = idGenerator.newId(); if(addressBookMap.get(id) != null) { throw new InvalidIdException(); } contact.setId(id); addressBookMap.put(id, contact); return id; }  String addContact(Contact contact); Contact getContact(String contactId);  }### Answer:
@Test(expected = InvalidIdException.class) public void testAddContactRepeatedId() { for(int i=0 ; i<32000; i++) { Contact contact = new Contact(); addressBook.addContact(contact); } }
@Test public void testAddContact() { Contact contact = new Contact(); String contactId = addressBook.addContact(contact); assertNotNull(contactId); assertTrue(contactId.trim().length() > 0); }