summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/PhoneBookTest.java26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/test/PhoneBookTest.java b/src/test/PhoneBookTest.java
new file mode 100644
index 0000000..fb898f0
--- /dev/null
+++ b/src/test/PhoneBookTest.java
@@ -0,0 +1,26 @@
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+class PhoneBookTest {
+ @Test
+ void test() {
+ PhoneBook.add(911, "police");
+ PhoneBook.add(76213, "Mom");
+ PhoneBook.add(17239, "Bob");
+
+ assertEquals("Mom", PhoneBook.find(76213));
+ assertEquals("not found", PhoneBook.find(910));
+ assertEquals("police", PhoneBook.find(911));
+
+ PhoneBook.del(910);
+ PhoneBook.del(911);
+
+ assertEquals("not found", PhoneBook.find(911));
+ assertEquals("Mom", PhoneBook.find(76213));
+
+ PhoneBook.add(76213, "daddy");
+ assertEquals("daddy", PhoneBook.find(76213));
+ }
+
+} \ No newline at end of file