...
Code Block |
---|
PersonName personName = new PersonName("David", "Lee", "Roth"); String kerbName = "dlr"; String emailAddress = kerbName + "@mit.edu"; int pidm = 12212871; int mitId = 90002312; Student student = new Student(String.valueOf(pidm), String.valueOf(mitId), kerbName, personName, emailAddress); Calendar now = Calendar.getInstance(); student.setCitizenship(new Citizenship("US", "United States")); student.setEthnicity(new StudentEthnicity()); Calendar birthDate = Calendar.getInstance(); birthDate.set(Calendar.YEAR, birthDate.get(Calendar.YEAR) - 20); // Born 20 years ago student.setBirthDate(birthDate.getTime()); student.setDeceased(false); student.setGender(Gender.FEMALE); student.setStudentHolds(new ArrayList<StudentHold>()); student.setVersion(1l); student.setCreateBy("testuser"); student.setCreateDate(now.getTime()); student.setModifyBy("testuser2"); student.setModifyDate(now.getTime()); // Enrollment profile: Set enrollProfiles = new HashSet(); // ... more code that builds enrollment profile objects... student.setStudentEnrollProfiles(enrollProfiles); |
Test Builder Package / Module Location
I originally thought that the test builder factory classes would go into the csf-test module, as they are intended to be helper classes for unit tests. However, because the builder classes use the domain classes, this setup would cause circular dependencies - for example, csf-common-legacy would depend on csf-test, and csf-test would depend on csf-common-legacy. Because of this, it seems to make sense to place the builder classes close to the domain objects they are building. So the CoreDataFactory could go into csf-common-legacy in a new package in the domain area: edu.mit.common.domain.builders