// ------------------------------------------------------------------------- /** * This test class shows how one might specify acceptance criteria for an * assignment using a series of test cases. * * @author Stephen Edwards * @version Feb 22, 2013 */ public class TimeTableTests extends junit.framework.TestCase { //~ Instance/static variables ............................................. private Appointment app1; private Appointment app2; //~ Methods ............................................................... // ---------------------------------------------------------- /** * Sets up the test fixture. * Called automatically before every test case method. */ protected void setUp() { int hour = 10; String description = "CS 1114"; app1 = new Appointment(hour, description); hour = 13; description = "MATH 1506"; app2 = new Appointment(hour, description); } // ---------------------------------------------------------- /** * Test a TimeTable holding some appointments. */ public void testTimeTable() { TimeTable timetable = new TimeTable(); timetable.addAppointment(1, app1); timetable.addAppointment(3, app1); timetable.addAppointment(5, app1); timetable.addAppointment(1, app2); timetable.addAppointment(3, app2); timetable.addAppointment(5, app2); assertSame(app1, timetable.appointmentFor(3, 10)); assertSame(app2, timetable.appointmentFor(3, 13)); } }