the second Objects lab.

TicketMachineTest.java 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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 TicketMachineTest.
  7. *
  8. * @author (your name)
  9. * @version (a version number or a date)
  10. */
  11. public class TicketMachineTest
  12. {
  13. private TicketMachine ticketMa1;
  14. private TicketMachine ticketMa2;
  15. private TicketMachine ticketMa3;
  16. private TicketMachine ticketMa4;
  17. /**
  18. * Default constructor for test class TicketMachineTest
  19. */
  20. public TicketMachineTest()
  21. {
  22. }
  23. /**
  24. * Sets up the test fixture.
  25. *
  26. * Called before every test case method.
  27. */
  28. @Before
  29. public void setUp()
  30. {
  31. ticketMa1 = new TicketMachine(500);
  32. ticketMa2 = new TicketMachine(100);
  33. ticketMa2.showPrice();
  34. ticketMa1.showPrice();
  35. ticketMa3 = new TicketMachine(500);
  36. ticketMa4 = new TicketMachine(100);
  37. ticketMa4.showPrice();
  38. ticketMa3.showPrice();
  39. ticketMa4.setPrice(50);
  40. ticketMa3.setPrice(100);
  41. ticketMa4.showPrice();
  42. ticketMa3.setPrice(100);
  43. ticketMa3.showPrice();
  44. ticketMa4.showPrice();
  45. ticketMa3.printTicket();
  46. ticketMa4.getPrice();
  47. ticketMa3.getPrice();
  48. ticketMa4.getPrompt();
  49. }
  50. /**
  51. * Tears down the test fixture.
  52. *
  53. * Called after every test case method.
  54. */
  55. @After
  56. public void tearDown()
  57. {
  58. }
  59. }