-
Notifications
You must be signed in to change notification settings - Fork 43
Expand file tree
/
Copy pathRemoveTest.java
More file actions
56 lines (44 loc) · 1.28 KB
/
RemoveTest.java
File metadata and controls
56 lines (44 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package com.zipcodewilmington.phonebook;
import org.junit.Assert;
import org.junit.Test;
public class RemoveTest {
@Test
public void test1() {
// given
PhoneBook phoneBook = new PhoneBook();
String name = "John";
String phoneNumber = "302-555-4545";
phoneBook.add(name, phoneNumber);
Assert.assertTrue(phoneBook.hasEntry(name));
// when
phoneBook.remove(name);
// then
Assert.assertFalse(phoneBook.hasEntry(name));
}
@Test
public void test2() {
// given
PhoneBook phoneBook = new PhoneBook();
String name = "Joe";
String phoneNumber = "302-554-4545";
phoneBook.add(name, phoneNumber);
Assert.assertTrue(phoneBook.hasEntry(name));
// when
phoneBook.remove(name);
// then
Assert.assertFalse(phoneBook.hasEntry(name));
}
@Test
public void test3() {
// given
PhoneBook phoneBook = new PhoneBook();
String name = "Smith";
String phoneNumber = "302-554-4535";
phoneBook.add(name, phoneNumber);
Assert.assertTrue(phoneBook.hasEntry(name));
// when
phoneBook.remove(name);
// then
Assert.assertFalse(phoneBook.hasEntry(name));
}
}