Chapter 2 of the BlueJ book. Walk through many of the chapters exercises.

TicketMachineTest.java 887B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. package NaiveTicket;
  2. import static org.junit.Assert.*;
  3. import org.junit.After;
  4. import org.junit.Before;
  5. import org.junit.Test;
  6. /**
  7. * The test class TicketMachineTest.
  8. *
  9. * @author (your name)
  10. * @version (a version number or a date)
  11. */
  12. public class TicketMachineTest
  13. {
  14. /**
  15. * Default constructor for test class TicketMachineTest
  16. */
  17. public TicketMachineTest()
  18. {
  19. }
  20. /**
  21. * Sets up the test fixture.
  22. *
  23. * Called before every test case method.
  24. */
  25. @Before
  26. public void setUp()
  27. {
  28. }
  29. /**
  30. * Tears down the test fixture.
  31. *
  32. * Called after every test case method.
  33. */
  34. @After
  35. public void tearDown()
  36. {
  37. }
  38. @Test
  39. public void testBalance()
  40. {
  41. NaiveTicket.TicketMachine ticketMa2 = new NaiveTicket.TicketMachine(666);
  42. assertEquals(0, ticketMa2.getBalance());
  43. }
  44. }