|
@@ -1,8 +1,4 @@
|
1
|
|
-
|
2
|
|
-
|
3
|
|
-import static org.junit.Assert.*;
|
4
|
|
-import org.junit.After;
|
5
|
|
-import org.junit.Before;
|
|
1
|
+import org.junit.Assert;
|
6
|
2
|
import org.junit.Test;
|
7
|
3
|
|
8
|
4
|
/**
|
|
@@ -13,30 +9,35 @@ import org.junit.Test;
|
13
|
9
|
*/
|
14
|
10
|
public class PhoneBookTest
|
15
|
11
|
{
|
16
|
|
- /**
|
17
|
|
- * Default constructor for test class PhoneBookTest
|
18
|
|
- */
|
19
|
|
- public PhoneBookTest()
|
20
|
|
- {
|
|
12
|
+ @Test
|
|
13
|
+ public void addEntryTest(){
|
|
14
|
+ //Given
|
|
15
|
+ PhoneBook phoneBook = new PhoneBook();
|
|
16
|
+ String name = "Zebra";
|
|
17
|
+ String phoneNumber = "111-222-333";
|
|
18
|
+ String expected = "Zebra , 111-222-333";
|
|
19
|
+ //When
|
|
20
|
+ phoneBook.addEntry(name,phoneNumber);
|
|
21
|
+
|
|
22
|
+ //Then
|
|
23
|
+ Assert.assertEquals(1,phoneBook.size());
|
|
24
|
+
|
21
|
25
|
}
|
22
|
|
-
|
23
|
|
- /**
|
24
|
|
- * Sets up the test fixture.
|
25
|
|
- *
|
26
|
|
- * Called before every test case method.
|
27
|
|
- */
|
28
|
|
- @Before
|
29
|
|
- public void setUp()
|
30
|
|
- {
|
31
|
|
- }
|
32
|
|
-
|
33
|
|
- /**
|
34
|
|
- * Tears down the test fixture.
|
35
|
|
- *
|
36
|
|
- * Called after every test case method.
|
37
|
|
- */
|
38
|
|
- @After
|
39
|
|
- public void tearDown()
|
40
|
|
- {
|
|
26
|
+ @Test
|
|
27
|
+ public void removeEntry(){
|
|
28
|
+ //Given
|
|
29
|
+ PhoneBook phoneBook = new PhoneBook();
|
|
30
|
+ String name = "Zebra";
|
|
31
|
+ String expected = "";
|
|
32
|
+ //when
|
|
33
|
+ phoneBook.removeEntry(name);
|
|
34
|
+ //Then
|
|
35
|
+ Assert.assertEquals(0, phoneBook.size());
|
41
|
36
|
}
|
|
37
|
+
|
|
38
|
+ public String lookUp(){
|
|
39
|
+ return null;
|
|
40
|
+ }
|
|
41
|
+
|
|
42
|
+
|
42
|
43
|
}
|