import static org.junit.Assert.*; import org.junit.After; import org.junit.Before; import org.junit.Test; import java.util.*; import java.util.stream.Collectors; /** * The test class PhoneBookTest. * * @author (your name) * @version (a version number or a date) */ public class PhoneBookTest { TreeMap phonebook = new TreeMap<>(); PhoneBook pb = new PhoneBook(phonebook); @Test public void testAdd() { String name = "Ryan"; String phoneNumber= "123-456-7890"; pb.add(name, phoneNumber); assertFalse(phonebook.isEmpty()); } @Test public void testRemove() { String name = "Ryan"; String phoneNumber= "123-456-7890"; String name1 = "Marcus"; String phoneNumber1= "650-789-1234"; pb.add(name, phoneNumber); pb.remove(name); assertTrue(phonebook.isEmpty()); } @Test public void testRemoveRecord() { String name = "Ryan"; String phoneNumber= "123-456-7890"; pb.add(name, phoneNumber); pb.remove(name); assertTrue(phonebook.isEmpty()); } @Test public void testLookup() { String name = "Ryan"; String phoneNumber= "123-456-7890"; pb.add(name, phoneNumber); Collection expected = phonebook.values(); assertEquals(expected, pb.lookup(name)); } @Test public void testReverseLookup() { String name = "Ryan"; String phoneNumber= "123-456-7890"; pb.add(name, phoneNumber); Collection expected = phonebook.keySet(); assertEquals(expected, pb.reverseLookup(phoneNumber)); } @Test public void testDisplay() { String name = "Ryan"; String phoneNumber= "123-456-7890"; pb.add(name, phoneNumber); TreeMap expected = phonebook; assertEquals(expected, pb.display()); } }