|
@@ -2,6 +2,8 @@ package com.zipcodewilmington.phonebook;
|
2
|
2
|
|
3
|
3
|
import com.sun.xml.internal.ws.policy.AssertionSet;
|
4
|
4
|
import org.junit.*;
|
|
5
|
+
|
|
6
|
+import java.util.ArrayList;
|
5
|
7
|
import java.util.TreeMap;
|
6
|
8
|
|
7
|
9
|
/**
|
|
@@ -17,25 +19,22 @@ public class PhoneBookTest {
|
17
|
19
|
private TreeMap<String, String> phoneBook = new TreeMap<String, String>();
|
18
|
20
|
|
19
|
21
|
|
20
|
|
-
|
21
|
|
-
|
22
|
22
|
@Test
|
23
|
23
|
public void testlookUpNameToGetAccompanyingPhoneNumber() {
|
24
|
24
|
testPhoneBook.addEntry("Rodrigo", "233-123-3445");
|
25
|
25
|
testPhoneBook.addEntry("Elena", "234-123-3344");
|
26
|
26
|
testPhoneBook.addEntry("Robert", "332-233-7821");
|
27
|
27
|
String expected = "332-233-7821";
|
28
|
|
- System.out.print(testPhoneBook.lookupNameToGetAccompanyingPhoneNumber("Robert"));
|
29
|
|
- String actual = testPhoneBook.lookupNameToGetAccompanyingPhoneNumber("Robert");
|
|
28
|
+ String actual = testPhoneBook.lookupNameToGetAccompanyingPhoneNumber("Robert").get(0);
|
30
|
29
|
Assert.assertEquals("should return Robert's phone number", expected, actual);
|
31
|
30
|
|
32
|
31
|
}
|
33
|
32
|
@Test
|
34
|
|
- public void testAddEntry() {
|
35
|
|
- String expected ="233-123-3445";
|
36
|
|
- String actual = testPhoneBook.addEntry("Rodrigo", "233-123-3445");
|
37
|
|
- System.out.println(actual + " " + expected);
|
38
|
|
- Assert.assertEquals(expected, actual);
|
|
33
|
+ public void testAddEntry() {
|
|
34
|
+ testPhoneBook.addEntry("Rodrigo", "233-123-3445");
|
|
35
|
+ String expected = "233-123-3445";
|
|
36
|
+ String actual = testPhoneBook.lookupNameToGetAccompanyingPhoneNumber("Rodrigo").get(0);
|
|
37
|
+ Assert.assertEquals(actual, expected);
|
39
|
38
|
}
|
40
|
39
|
@Test
|
41
|
40
|
public void testRemoveEntry(){
|
|
@@ -69,9 +68,8 @@ public class PhoneBookTest {
|
69
|
68
|
testPhoneBook.addEntry("Rodrigo", "233-123-3445");
|
70
|
69
|
testPhoneBook.addEntry("Elena", "234-123-3344");
|
71
|
70
|
testPhoneBook.addEntry("Robert", "332-233-7821");
|
72
|
|
- String phoneNumber= "234-123-3344";
|
|
71
|
+ String actual= testPhoneBook.reverseLookup("234-123-3344");
|
73
|
72
|
String expected = "Elena";
|
74
|
|
- String actual = testPhoneBook.reverseLookup( "234-123-3344");
|
75
|
73
|
Assert.assertEquals("should return who the phone number is assigned to ", expected, actual);
|
76
|
74
|
}
|
77
|
75
|
}
|