123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- import static org.junit.Assert.*;
- import org.junit.After;
- import org.junit.Before;
- import org.junit.Test;
- import java.util.TreeMap;
- import java.util.Map;
- import java.util.ArrayList;
-
- public class PhoneBookTest {
- PhoneBook pb = new PhoneBook();
- ArrayList<String> numbers = new ArrayList<String>();
- @Test
- public void addTest(){
-
- String entry = pb.add("Kris", "666-666-6666");
- int actual = pb.getSize();
-
- assertEquals(1, actual);
- }
-
- @Test
- public void removeTest(){
- pb.add("Emily", "777-777-7777");
- pb.add("Karl", "888-888-8888");
- pb.add("Chad", "999-999-9999");
- String entry = pb.remove("Emily");
-
- assertEquals(false, pb.keyExists("Emily"));
- }
-
- @Test
- public void lookupTest(){
- pb.add("Karl", "888-888-8888");
- String entry = pb.lookup("Karl");
-
- assertEquals("888-888-8888",pb.lookup("Karl"));
- }
-
- @Test
- public void reverseLookupTest(){
- pb.add("Chad", "999-999-9999");
- String entry = pb.reverseLookup("Chad");
-
- assertEquals("Chad",pb.reverseLookup("999-999-9999"));
- }
-
- }
|