Enrolling Students


Courses don't earn any revenue for the school unless students enroll in them. Much of the student information system will require you to be able to work with more than one student at a time. You will want to store groups, or collections, of students and later execute operations against the students in these collections.


CourseSession will need to store a new attributea collection of Student objects. You will want to bolster your CourseSession creation test so that it says something about this new attribute. If you have just created a new course session, you haven't yet enrolled any students in it. What can you assert against an empty course session?

Modify testCreate so that it contains the bolded assertion:

 public void testCreate() {    CourseSession session = new CourseSession("ENGL", "101");    assertEquals("ENGL", session.getDepartment());    assertEquals("101", session.getNumber());    assertEquals(0, session.getNumberOfStudents()); } 



Agile Java. Crafting Code with Test-Driven Development
Agile Javaв„ў: Crafting Code with Test-Driven Development
ISBN: 0131482394
EAN: 2147483647
Year: 2003
Pages: 391
Authors: Jeff Langr

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net