12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
-
-
- 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
- {
-
- PhoneBook testObj;
- /**
- * Default constructor for test class PhoneBookTest
- */
- public PhoneBookTest()
- {
- }
-
- /**
- * Sets up the test fixture.
- *
- * Called before every test case method.
- */
- @Before
- public void setUp()
- {
- testObj = new PhoneBook();
- }
-
- /**
- * Tears down the test fixture.
- *
- * Called after every test case method.
- */
- @After
- public void tearDown()
- {
- }
- @Test
- public void testadd(){
- String expected = "4545666667";
- //PhoneBook phoneBook = new PhoneBook();
- testObj.add("john",expected);
- String actual = testObj.lookUp("john");
- assertEquals(actual, expected);
- }
- @Test
- public void testremoveAndLookUp(){
- String expected = "5454";
- testObj.add("gei", "5454");
- assertEquals(expected,testObj.lookUp("gei"));
-
- String expectedAfterDelete = null;
- testObj.remove("gei");
- assertEquals(expectedAfterDelete, testObj.lookUp("gei"));
-
- }
- @Test
- public void testreverseLookUp(){
- String expected = "John";
- testObj.add("John", "4343");
- assertEquals(expected, testObj.reverseLookUp("4343"));
-
-
-
- }
-
- }
-
|