|
@@ -1,5 +1,4 @@
|
1
|
1
|
|
2
|
|
-
|
3
|
2
|
import static org.junit.Assert.*;
|
4
|
3
|
import org.junit.After;
|
5
|
4
|
import org.junit.Before;
|
|
@@ -29,6 +28,60 @@ public class PhoneBookTest
|
29
|
28
|
public void setUp()
|
30
|
29
|
{
|
31
|
30
|
}
|
|
31
|
+ PhoneBook phonebook = new PhoneBook();
|
|
32
|
+ @Test
|
|
33
|
+ public void addTest() {
|
|
34
|
+ //Expected
|
|
35
|
+ String expected = "Lewis Dominguez 3023005754";
|
|
36
|
+ //Actual
|
|
37
|
+ String actual = phonebook.add("Lewis Dominguez", "3023005754");
|
|
38
|
+
|
|
39
|
+ assertEquals(expected, actual);
|
|
40
|
+ }
|
|
41
|
+
|
|
42
|
+ @Test
|
|
43
|
+ public void removeTest() {
|
|
44
|
+ phonebook.add("Lewis Dominguez", "3023005754");
|
|
45
|
+ //Expected
|
|
46
|
+ String expected = "Lewis Dominguez";
|
|
47
|
+ //Actual
|
|
48
|
+ String actual = phonebook.remove("Lewis Dominguez");
|
|
49
|
+
|
|
50
|
+ assertEquals(expected, actual);
|
|
51
|
+ }
|
|
52
|
+
|
|
53
|
+ @Test
|
|
54
|
+ public void lookupTest() {
|
|
55
|
+ phonebook.add("Lewis Dominguez", "3023005754");
|
|
56
|
+ //Expected
|
|
57
|
+ String expected = "3023005754";
|
|
58
|
+ //Actual
|
|
59
|
+ String actual = phonebook.lookup("Lewis Dominguez");
|
|
60
|
+
|
|
61
|
+ assertEquals(expected, actual);
|
|
62
|
+ }
|
|
63
|
+
|
|
64
|
+ @Test
|
|
65
|
+ public void reverseLookupTest() {
|
|
66
|
+ phonebook.add("Lewis Dominguez", "3023005754");
|
|
67
|
+ //Expected
|
|
68
|
+ String expected = "Lewis Dominguez";
|
|
69
|
+ //Actual
|
|
70
|
+ String actual = phonebook.reverseLookup("3023005754");
|
|
71
|
+
|
|
72
|
+ assertEquals(expected, actual);
|
|
73
|
+ }
|
|
74
|
+
|
|
75
|
+ // @Test
|
|
76
|
+ // public void displayTest() {
|
|
77
|
+ // phonebook.add("Lewis Dominguez", "3023005754");
|
|
78
|
+ // //Expected
|
|
79
|
+ // String expected = "Lewis Dominguez -> 3023005753";
|
|
80
|
+ // //Actual
|
|
81
|
+ // String actual = phonebook.display("Lewis Dominguez 3023005754");
|
|
82
|
+
|
|
83
|
+ // assertEquals(expected, actual);
|
|
84
|
+ // }
|
32
|
85
|
|
33
|
86
|
/**
|
34
|
87
|
* Tears down the test fixture.
|