Regular |
|
Joined: Tue Oct 12, 2004 9:02 am Posts: 66 Location: Italy
|
This test case fails!
public void testUserCourse() {
boolean enter = false;
Teacher teacher = (Teacher) userService.login("prof", "prof");
Course course = courseService.load(new Long(11));
for(Iterator it = teacher.getCourses().iterator(); it.hasNext(); ) {
Course temp = (Course) it.next();
if(temp.equals(course)) {
enter = true;
}
}
assertTrue(enter);
}
equals compare only the property description in the Course bean.
But debugging i have seen that when i do temp.equals(course)
the property description is set to null.
course.getDescription() is not null before the for.
getCourses is lazy initialized!
Any suggestion?
|
|