123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
-
-
- 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()
- {
- }
-
- /**
- * Tears down the test fixture.
- *
- * Called after every test case method.
- */
- @After
- public void tearDown()
- {
- }
-
- @Test
- public void addEntry()
- {
- PhoneBook phoneBoo1 = new PhoneBook();
- phoneBoo1.addEntry("nicholas", "3027387978");
- assertEquals("nicholas: 3027387978", phoneBoo1.display());
- }
-
- @Test
- public void addTwoNumberForOnePersonTest()
- {
- PhoneBook phoneBoo1 = new PhoneBook();
- phoneBoo1.addEntry("nick", "302");
- phoneBoo1.addNumberTo("nick", "103");
- assertEquals("nick: 302103", phoneBoo1.display());
- }
-
- @Test
- public void reverseLoopupTest()
- {
- PhoneBook phoneBoo1 = new PhoneBook();
- phoneBoo1.addEntry("nick", "302");
- assertEquals("nick", phoneBoo1.reverseLoopup("302"));
- }
-
- @Test
- public void lookupTest()
- {
- PhoneBook phoneBoo1 = new PhoneBook();
- phoneBoo1.addEntry("nick", "302");
- assertEquals("302", phoneBoo1.lookUp("nick"));
- }
-
- @Test
- public void RemoveRecordTest()
- {
- PhoneBook phoneBoo2 = new PhoneBook();
- phoneBoo2.addEntry("m", "302");
- phoneBoo2.removeRecord("m");
- assertEquals("", phoneBoo2.lookUp("m"));
- }
-
- @Test
- public void removePhoneNumberTest()
- {
- PhoneBook phoneBoo1 = new PhoneBook();
- phoneBoo1.addEntry("m", "123");
- phoneBoo1.addNumberTo("m", "456");
- phoneBoo1.removePhoneNumber("m", "456");
- assertEquals("123", phoneBoo1.lookUp("m"));
- }
- }
-
-
-
-
-
-
-
|