1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
-
-
- 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
- {
- @Test
- public void phoneBooktest(){
- PhoneBook yellowPages = new PhoneBook();
-
-
- }
-
- @Test
- public void addTest(){
- //Given
- PhoneBook yellowPages = new PhoneBook();
- yellowPages.add("Jenny", "123-867-5309");
-
- //Then:
- String actual = yellowPages.lookUp("Jenny");
- String expected = "123-867-5309";
-
- //Assert:
-
- assertEquals(expected, actual);
-
- }
-
- @Test
- public void removeTest() {
- //Given:
- PhoneBook yellowPages = new PhoneBook();
- yellowPages.add("Jenny", "123-867-5309");
- yellowPages.remove("Jenny");
- //Then:
- int actual = yellowPages.getSize();
- int expected = 0;
- //Assert:
- assertEquals(expected, actual);
-
- }
-
- @Test
- public void reverseLookUpTest() {
- //Given:
- PhoneBook yellowPages = new PhoneBook();
- yellowPages.add("Jenny", "123-867-5309");
- //Then:
- String actual = yellowPages.reverseLookUp("123-867-5309");
- String expected = "Jenny";
- //Assert:
- assertEquals(expected, actual);
-
- }
-
- @Test
- public void displayTest(){
- //Given:
-
- PhoneBook yellowPages = new PhoneBook();
- yellowPages.add("Jenny", "123-867-5309");
-
-
- //Then:
-
- String actual = yellowPages.display();
- String expected ="Jenny : 123-867-5309";
-
- //Assert:
- assertEquals(expected, actual);
- }
- }
|