private static void removeEntry(InOut in, AddressBook book) { String name = in.nextLine("Enter name: "); String key = in.nextLine("Enter key: "); String value = book.remove(name, key); if (value == null) in.message("entry not found"); else in.message("Removed entry with value: " + value); }
@Test(expected = NoSuchElementException.class) public void RemoveTester3() { dir.put("Bob", "Phone", "2"); assertNull(dir.remove("Me", "Phone")); }
@Test(expected = NoSuchElementException.class) public void RemoveTester2() { assertNull(dir.remove("Me", "Phone")); }
@Test(expected = NoSuchElementException.class) public void RemoveTester() { dir.put("Horstmann", "Phone", "2"); dir.remove("Horstmann", "Phone"); assertNull(dir.get("Horstmann", "Phone")); }