Build a simple PhoneBook program.

PhoneBookTest.java 701B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import static org.junit.Assert.*;
  2. import org.junit.After;
  3. import org.junit.Before;
  4. import org.junit.Test;
  5. /**
  6. * The test class PhoneBookTest.
  7. *
  8. * @author (your name)
  9. * @version (a version number or a date)
  10. */
  11. public class PhoneBookTest
  12. {
  13. /**
  14. * Default constructor for test class PhoneBookTest
  15. */
  16. public PhoneBookTest()
  17. {
  18. }
  19. /**
  20. * Sets up the test fixture.
  21. *
  22. * Called before every test case method.
  23. */
  24. @Before
  25. public void setUp()
  26. {
  27. }
  28. @Test
  29. public void addTest() {
  30. PhoneBook phone = new PhoneBook();
  31. phone.add("John", "215-658-1490");
  32. assertEquals("215-658-1490", phone.lookup("John"));
  33. }
  34. }