-
Notifications
You must be signed in to change notification settings - Fork 43
Expand file tree
/
Copy pathReverseLookupTest.java
More file actions
55 lines (44 loc) · 1.46 KB
/
Copy pathReverseLookupTest.java
File metadata and controls
55 lines (44 loc) · 1.46 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
package com.zipcodewilmington.phonebook;
import org.junit.Assert;
import org.junit.Test;
public class ReverseLookupTest {
@Test
public void test1() {
// given
PhoneBook phoneBook = new PhoneBook();
String expectedName = "John";
String phoneNumber = "302-555-4545";
phoneBook.add(expectedName, phoneNumber);
Assert.assertTrue(phoneBook.hasEntry(expectedName));
// when
String actualName = phoneBook.reverseLookup(phoneNumber);
// then
Assert.assertEquals(expectedName, actualName);
}
@Test
public void test2() {
// given
PhoneBook phoneBook = new PhoneBook();
String expectedName = "Joe";
String phoneNumber = "302-554-4545";
phoneBook.add(expectedName, phoneNumber);
Assert.assertTrue(phoneBook.hasEntry(expectedName));
// when
String actualName = phoneBook.reverseLookup(phoneNumber);
// then
Assert.assertEquals(expectedName, actualName);
}
@Test
public void test3() {
// given
PhoneBook phoneBook = new PhoneBook();
String expectedName = "Smith";
String phoneNumber = "302-554-4535";
phoneBook.add(expectedName, phoneNumber);
Assert.assertTrue(phoneBook.hasEntry(expectedName));
// when
String actualName = phoneBook.reverseLookup(phoneNumber);
// then
Assert.assertEquals(expectedName, actualName);
}
}