123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
-
- import static org.junit.Assert.*;
- import org.junit.After;
- import org.junit.Before;
- import org.junit.Test;
-
- /**
- * The test class PhoneBookTest.
- *
- * @author (your name)
- * @version (a version number or a date)
- */
- public class PhoneBookTest
- {
- /**
- * Default constructor for test class PhoneBookTest
- */
- public PhoneBookTest()
- {
- }
-
- /**
- * Sets up the test fixture.
- *
- * Called before every test case method.
- */
- @Before
- public void setUp()
- {
- }
- PhoneBook phonebook = new PhoneBook();
- @Test
- public void addTest() {
- //Expected
- String expected = "Lewis Dominguez 3023005754";
- //Actual
- String actual = phonebook.add("Lewis Dominguez", "3023005754");
-
- assertEquals(expected, actual);
- }
-
- @Test
- public void removeTest() {
- phonebook.add("Lewis Dominguez", "3023005754");
- //Expected
- String expected = "Lewis Dominguez";
- //Actual
- String actual = phonebook.remove("Lewis Dominguez");
-
- assertEquals(expected, actual);
- }
-
- @Test
- public void lookupTest() {
- phonebook.add("Lewis Dominguez", "3023005754");
- //Expected
- String expected = "3023005754";
- //Actual
- String actual = phonebook.lookup("Lewis Dominguez");
-
- assertEquals(expected, actual);
- }
-
- @Test
- public void reverseLookupTest() {
- phonebook.add("Lewis Dominguez", "3023005754");
- //Expected
- String expected = "Lewis Dominguez";
- //Actual
- String actual = phonebook.reverseLookup("3023005754");
-
- assertEquals(expected, actual);
- }
-
- // @Test
- // public void displayTest() {
- // phonebook.add("Lewis Dominguez", "3023005754");
- // //Expected
- // String expected = "Lewis Dominguez -> 3023005753";
- // //Actual
- // String actual = phonebook.display("Lewis Dominguez 3023005754");
-
- // assertEquals(expected, actual);
- // }
-
- /**
- * Tears down the test fixture.
- *
- * Called after every test case method.
- */
- @After
- public void tearDown()
- {
- }
- }
|