Source:
protected void testExecute() throws Exception { InstructorAttributes instructor1OfCourse1 = typicalBundle.instructors.get("instructor1OfCourse1"); String instructorId = instructor1OfCourse1.googleId; loginAsInstructor(instructorId); ______TS("Not enough parameters"); verifyHttpParameterFailure(); ______TS("Typical case, 2 courses"); logic.createCourseAndInstructor(instructorId, "icdct.tpa.id1", "New course", "UTC"); String[] submissionParams = new String[] { Const.ParamsNames.COURSE_ID, instructor1OfCourse1.courseId, }; BinCourseAction deleteAction = getAction(submissionParams); JsonResult result = getJsonResult(deleteAction); assertEquals(HttpStatus.SC_OK, result.getStatusCode()); MessageOutput msg = (MessageOutput) result.getOutput(); assertEquals("The course idOfTypicalCourse1 has been deleted. You can restore it from the Recycle Bin manually.", msg.getMessage()); List<CourseAttributes> courseList = logic.getCoursesForInstructor(instructorId); assertEquals(1, courseList.size()); assertEquals("icdct.tpa.id1", courseList.get(0).getId()); ______TS("Masquerade mode, delete last course"); loginAsAdmin(); submissionParams = new String[] { Const.ParamsNames.COURSE_ID, "icdct.tpa.id1", }; deleteAction = getAction(addUserIdToParams(instructorId, submissionParams)); result = getJsonResult(deleteAction); assertEquals(HttpStatus.SC_OK, result.getStatusCode()); msg = (MessageOutput) result.getOutput(); assertEquals("The course icdct.tpa.id1 has been deleted. You can restore it from the Recycle Bin manually.", msg.getMessage()); courseList = logic.getCoursesForInstructor(instructorId); assertEquals(0, courseList.size()); }

Target:
protected void testExecute() throws Exception { InstructorAttributes instructor1OfCourse1 = typicalBundle.instructors.get("instructor1OfCourse1"); String instructorId = instructor1OfCourse1.googleId; loginAsInstructor(instructorId); ______TS("Not enough parameters"); verifyHttpParameterFailure(); ______TS("Typical case, 2 courses. Expect 1 to be binned and 1 to stay."); String[] submissionParams = new String[] { Const.ParamsNames.COURSE_ID, instructor1OfCourse1.courseId, }; CourseAttributes courseToBeDeleted = logic.getCourse(instructor1OfCourse1.getCourseId()); logic.createCourseAndInstructor(instructorId, "icdct.tpa.id1", "New course", "UTC"); BinCourseAction binCourseAction = getAction(submissionParams); JsonResult result = getJsonResult(binCourseAction); CourseData courseData = (CourseData) result.getOutput(); assertEquals(HttpStatus.SC_OK, result.getStatusCode()); verifyCourseData(courseData, courseToBeDeleted.getId(), courseToBeDeleted.getName(), courseToBeDeleted.getTimeZone().getId()); List<CourseAttributes> courseList = logic.getCoursesForInstructor(instructorId); assertEquals(1, courseList.size()); assertEquals("icdct.tpa.id1", courseList.get(0).getId()); assertNotNull(logic.getCourse(instructor1OfCourse1.courseId).deletedAt); ______TS("Masquerade mode, delete last course"); loginAsAdmin(); submissionParams = new String[] { Const.ParamsNames.COURSE_ID, "icdct.tpa.id1", }; binCourseAction = getAction(addUserIdToParams(instructorId, submissionParams)); result = getJsonResult(binCourseAction); assertEquals(HttpStatus.SC_OK, result.getStatusCode()); courseData = (CourseData) result.getOutput(); verifyCourseData(courseData, "icdct.tpa.id1", "New course", "UTC"); assertNotNull(logic.getCourse("icdct.tpa.id1").deletedAt); }