|
@@ -5,6 +5,8 @@ import org.junit.Before;
|
5
|
5
|
import org.junit.Test;
|
6
|
6
|
import org.junit.experimental.theories.suppliers.TestedOn;
|
7
|
7
|
|
|
8
|
+import java.util.ArrayList;
|
|
9
|
+
|
8
|
10
|
|
9
|
11
|
/**
|
10
|
12
|
* Created by leon on 1/23/18.
|
|
@@ -12,24 +14,26 @@ import org.junit.experimental.theories.suppliers.TestedOn;
|
12
|
14
|
public class PhoneBookTest {
|
13
|
15
|
|
14
|
16
|
|
|
17
|
+
|
15
|
18
|
@Test
|
16
|
19
|
public void addTest() {
|
17
|
20
|
PhoneBook testBook = new PhoneBook();
|
18
|
21
|
testBook.addEntry("Luke", "6109998787");
|
19
|
22
|
String testNumber = testBook.lookupNumber("Luke");
|
20
|
|
- Assert.assertTrue(testNumber.equals("6109998787"));
|
21
|
|
-
|
22
|
|
- }
|
23
|
|
-
|
24
|
|
- @Test
|
25
|
|
- public void addTest1() {
|
26
|
|
- PhoneBook testBook = new PhoneBook();
|
27
|
|
- testBook.addEntry("Kate", "4846569090");
|
28
|
|
- String testNumber = testBook.lookupNumber("Kate");
|
29
|
|
- Assert.assertTrue(testNumber.equals("4846569090"));
|
|
23
|
+ Assert.assertTrue(testNumber.equals("6109998787,"));
|
30
|
24
|
|
31
|
25
|
}
|
32
|
26
|
|
|
27
|
+// @Test
|
|
28
|
+// public void addTest1() {
|
|
29
|
+// PhoneBook testBook = new PhoneBook();
|
|
30
|
+// Person expected = new Person("name", "arraylist of phone numbers");
|
|
31
|
+// testBook.addEntry("Kate", expected);
|
|
32
|
+//// Person actual = testBook.lookupNumber("Kate");
|
|
33
|
+//// Assert.assertTrue(expected.equals(actual));
|
|
34
|
+//
|
|
35
|
+// }
|
|
36
|
+//
|
33
|
37
|
@Test
|
34
|
38
|
public void removeTest1() {
|
35
|
39
|
PhoneBook testBook = new PhoneBook();
|
|
@@ -44,18 +48,9 @@ public class PhoneBookTest {
|
44
|
48
|
@Test
|
45
|
49
|
public void stringLookupTest() {
|
46
|
50
|
PhoneBook testBook = new PhoneBook();
|
47
|
|
- testBook.addEntry("Kate", "4846569090");
|
|
51
|
+ testBook.addEntry("Kate", "4846569090", "9899890099");
|
48
|
52
|
String testNumber = testBook.lookupNumber("Kate");
|
49
|
|
- Assert.assertFalse(testNumber.equals("4846587091"));
|
50
|
|
-
|
51
|
|
- }
|
52
|
|
-
|
53
|
|
- @Test
|
54
|
|
- public void stringLookupTest1() {
|
55
|
|
- PhoneBook testBook = new PhoneBook();
|
56
|
|
- testBook.addEntry("Kate", "4846569090");
|
57
|
|
- String testNumber = testBook.lookupNumber("Kate");
|
58
|
|
- Assert.assertTrue(testNumber.equals("4846569090"));
|
|
53
|
+ Assert.assertTrue(testNumber.equals("4846569090, 9899890099,"));
|
59
|
54
|
|
60
|
55
|
}
|
61
|
56
|
|
|
@@ -66,7 +61,7 @@ public class PhoneBookTest {
|
66
|
61
|
testBook.addEntry("Adam", "4864569090");
|
67
|
62
|
testBook.addEntry("Zeke", "4787869090");
|
68
|
63
|
String actual = testBook.listNames();
|
69
|
|
- String expected = "Adam\nKate\nZeke\n";
|
|
64
|
+ String expected = "Adam\nKate\nZeke";
|
70
|
65
|
Assert.assertEquals(actual, expected);
|
71
|
66
|
|
72
|
67
|
|
|
@@ -76,10 +71,10 @@ public class PhoneBookTest {
|
76
|
71
|
public void listPhonebookTest1() {
|
77
|
72
|
PhoneBook testBook = new PhoneBook();
|
78
|
73
|
testBook.addEntry("Kate", "4846569090");
|
79
|
|
- testBook.addEntry("Adam", "4864569090");
|
|
74
|
+ testBook.addEntry("Adam", "4864569090", "7879891212");
|
80
|
75
|
testBook.addEntry("Zeke", "4787869090");
|
81
|
76
|
String actual = testBook.listPhoneBook();
|
82
|
|
- String expected = "Adam: 4864569090\nKate: 4846569090\nZeke: 4787869090\n";
|
|
77
|
+ String expected = "Adam: 4864569090, 7879891212, Kate: 4846569090, Zeke: 4787869090,";
|
83
|
78
|
Assert.assertEquals(expected, actual);
|
84
|
79
|
|
85
|
80
|
|
|
@@ -93,4 +88,15 @@ public class PhoneBookTest {
|
93
|
88
|
|
94
|
89
|
}
|
95
|
90
|
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+ @Test
|
|
94
|
+ public void additionalPhoneNumberToKeyTest() {
|
|
95
|
+ PhoneBook testBook = new PhoneBook();
|
|
96
|
+ testBook.addEntry("Kate", "5659871212");
|
|
97
|
+ testBook.additionalPhoneNumberToKey("Kate", "4999999999");
|
|
98
|
+ String testNumber = testBook.lookupNumber("Kate");
|
|
99
|
+ Assert.assertTrue(testNumber.equals("5659871212, 4999999999,"));
|
|
100
|
+
|
|
101
|
+ }
|
96
|
102
|
}
|