1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- 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()
- {
- }
- private PhoneBook phoneBook;
-
- /**
- * Sets up the test fixture.
- *
- * Called before every test case method.
- */
- @Before
- public void setUp()
- {
- phoneBook = new PhoneBook();
- }
-
- @Test
- public void testAdd()
- {
- //plug in a String name here using methods from main class
- String name = "Ryan";
- String expectedPhoneNumber= "123-456-7890";
- phoneBook.add(name, expectedPhoneNumber);
- String actualPhoneNumber = phoneBook.lookUp(name);
-
- assertEquals(actualPhoneNumber, expectedPhoneNumber);
-
- }
-
- /**
- * Tears down the test fixture.
- *
- * Called after every test case method.
- */
- @After
- public void tearDown()
- {
- }
- }
|