MainTest.java 980B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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 MainTest.
  7. *
  8. * @author (your name)
  9. * @version (a version number or a date)
  10. */
  11. public class MainTest extends Main
  12. {
  13. String userInput = in.nextLine();
  14. @Test
  15. public void MainTest()
  16. {userInput = "Alice";
  17. String expected = "Hello Alice!";
  18. String actual = (""+userInput);
  19. assertEquals(expected, actual);
  20. }
  21. @Test
  22. public void SecondTest()
  23. {userInput = "Alice";
  24. String expected = "Hello Bob!";
  25. String actual = (""+userInput);
  26. assertEquals(expected, actual);
  27. }
  28. /**
  29. * Sets up the test fixture.
  30. *
  31. * Called before every test case method.
  32. */
  33. @Before
  34. public void setUp()
  35. {
  36. }
  37. /**
  38. * Tears down the test fixture.
  39. *
  40. * Called after every test case method.
  41. */
  42. @After
  43. public void tearDown()
  44. {
  45. }
  46. }