### Question:
Person { public void addFriend(String friend) { if (!friends.contains(friend)) friends.add(friend); } Person();  Person(String name); List<String> getFriends(); void addFriend(String friend); @Override String toString();  }### Answer:
@Test public void testAddFriend() throws Exception { Person p = new Person("Joe"); p.addFriend("Ralph"); p.addFriend("Kate"); p.addFriend("Ralph"); assertThat(p.getFriends()).hasSize(2).containsExactly("Ralph", "Kate"); }