Source:
private void testGetCoursesForStudentAccount() throws Exception { ______TS("student having two courses"); StudentAttributes studentInTwoCourses = dataBundle.students .get("student2InCourse1"); List<CourseAttributes> courseList = coursesLogic .getCoursesForStudentAccount(studentInTwoCourses.googleId); CourseAttributes.sortById(courseList); assertEquals(2, courseList.size()); CourseAttributes course1 = dataBundle.courses.get("typicalCourse1"); int temp = 0; for (CourseAttributes course : courseList) { if (course.compareTo(course1) == 0) { temp = 1; break; } } assertEquals(1, temp); CourseAttributes course2 = dataBundle.courses.get("typicalCourse2"); temp = 0; for (CourseAttributes course : courseList) { if (course.compareTo(course2) == 0) { temp = 1; break; } } assertEquals(1, temp); ______TS("student having one course"); StudentAttributes studentInOneCourse = dataBundle.students .get("student1InCourse1"); courseList = coursesLogic.getCoursesForStudentAccount(studentInOneCourse.googleId); assertEquals(1, courseList.size()); course1 = dataBundle.courses.get("typicalCourse1"); assertEquals(course1.getId(), courseList.get(0).getId()); assertEquals(course1.getName(), courseList.get(0).getName()); ______TS("non-existent student"); try { coursesLogic.getCoursesForStudentAccount("non-existent-student"); signalFailureToDetectException(); } catch (EntityDoesNotExistException e) { AssertHelper.assertContains("does not exist", e.getMessage()); } ______TS("null parameter"); try { coursesLogic.getCoursesForStudentAccount(null); signalFailureToDetectException(); } catch (AssertionError e) { assertEquals(Const.StatusCodes.DBLEVEL_NULL_INPUT, e.getMessage()); } }

Target:
private void testGetCoursesForStudentAccount() throws Exception { ______TS("student having two courses"); StudentAttributes studentInTwoCourses = dataBundle.students .get("student2InCourse1"); List<CourseAttributes> courseList = coursesLogic .getCoursesForStudentAccount(studentInTwoCourses.googleId); CourseAttributes.sortById(courseList); assertEquals(2, courseList.size()); CourseAttributes course1 = dataBundle.courses.get("typicalCourse1"); CourseAttributes course2 = dataBundle.courses.get("typicalCourse2"); List<CourseAttributes> courses = new ArrayList<CourseAttributes>(); courses.add(course1); courses.add(course2); CourseAttributes.sortById(courses); assertEquals(courses.get(0).getId(), courseList.get(0).getId()); assertEquals(courses.get(0).getName(), courseList.get(0).getName()); assertEquals(courses.get(1).getId(), courseList.get(1).getId()); assertEquals(courses.get(1).getName(), courseList.get(1).getName()); ______TS("student having one course"); StudentAttributes studentInOneCourse = dataBundle.students .get("student1InCourse1"); courseList = coursesLogic.getCoursesForStudentAccount(studentInOneCourse.googleId); assertEquals(1, courseList.size()); course1 = dataBundle.courses.get("typicalCourse1"); assertEquals(course1.getId(), courseList.get(0).getId()); assertEquals(course1.getName(), courseList.get(0).getName()); ______TS("non-existent student"); try { coursesLogic.getCoursesForStudentAccount("non-existent-student"); signalFailureToDetectException(); } catch (EntityDoesNotExistException e) { AssertHelper.assertContains("does not exist", e.getMessage()); } ______TS("null parameter"); try { coursesLogic.getCoursesForStudentAccount(null); signalFailureToDetectException(); } catch (AssertionError e) { assertEquals(Const.StatusCodes.DBLEVEL_NULL_INPUT, e.getMessage()); } }