123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- import org.junit.Assert;
- import org.junit.Test;
- import java.util.Map;
- import java.util.TreeMap;
-
- /**
- * The test class PhoneBookTest.
- *
- * @author (your name)
- * @version (a version number or a date)
- */
- public class PhoneBookTest
- {
- @Test
- public void addEntryTest(){
- //Given
- PhoneBook phoneBook = new PhoneBook();
- String name = "Zebra";
- String phoneNumber = "111-222-333";
- String expected = "Zebra , 111-222-333";
- //When
- phoneBook.addEntry(name,phoneNumber);
-
- //Then
- Assert.assertEquals(1,phoneBook.size());
-
- }
- @Test
- public void removeEntry(){
- //Given
- PhoneBook phoneBook = new PhoneBook();
- String name = "Zebra";
- String expected = "";
- //when
- phoneBook.removeEntry(name);
- //Then
- Assert.assertEquals(0, phoneBook.size());
- }
-
-
-
- @Test
- public void lookUp(){
- PhoneBook phoneBook = new PhoneBook();
- String name = "Zebra";
- String expected = "111-222-333";
- phoneBook.addEntry(name,expected);
- //when
- String actual = phoneBook.lookUp(name);
- //then
- Assert.assertEquals(expected,actual);
- }
-
- @Test
- public void reverseLoopUp(){
- PhoneBook phoneBook = new PhoneBook();
- String phoneNumber = "111-222-333";
- String expected = "Zebra";
- //when
- // String actual = phoneBook.reverseLookUp(phoneNumber);
- //then
- // Assert.assertEquals(expected,actual);
- }
-
- @Test
- public void display(){
- }
- }
|