Source:
<code>public void testArchiveAction() throws Exception { InstructorAttributes instructor1CS1101 = testData.instructors.get("instructor1CS1101"); ______TS("archive action success"); String courseId = "CCAddUiTest.CS1101"; InstructorAttributes instructorWithNullArchiveStatus = BackDoor.getInstructorByGoogleId(instructor1CS1101.googleId, instructor1CS1101.courseId); assertNull(instructorWithNullArchiveStatus.isArchived); coursesPage.archiveCourse(courseId); coursesPage.verifyHtmlMainContent("/instructorCoursesArchiveSuccessful.html"); instructorWithNullArchiveStatus = BackDoor.getInstructorByGoogleId(instructor1CS1101.googleId, instructor1CS1101.courseId); assertTrue(instructorWithNullArchiveStatus.isArchived.booleanValue()); ______TS("archive status of another instructor from same course not affected"); instructorId = testData.accounts.get("OtherInstructorWithoutCourses").googleId; coursesPage = getCoursesPage(); coursesPage.verifyHtmlMainContent("/instructorArchiveStatusNotAffected.html"); ______TS("unarchive action success"); instructorId = testData.accounts.get("instructorWithCourses").googleId; coursesPage = getCoursesPage(); coursesPage.unarchiveCourse(courseId); <START> coursesPage.waitForAjaxLoadCoursesSuccess(); <END> coursesPage.verifyHtmlMainContent("/instructorCoursesUnarchiveSuccessful.html"); ______TS("archive action failed"); String anotherCourseId = "CCAddUiTest.CS2104"; BackDoor.deleteCourse(anotherCourseId); coursesPage.archiveCourse(anotherCourseId); coursesPage.verifyContains("You are not authorized to view this page."); ______TS("unarchive action failed"); coursesPage = getCoursesPage(); coursesPage.archiveCourse(courseId); BackDoor.deleteCourse(courseId); coursesPage.unarchiveCourse(courseId); coursesPage.verifyContains("You are not authorized to view this page."); }</code><technical_language>If this (waiting un-archiving a course) is needed, wait clicking archive too</technical_language>

Target:
public void testArchiveAction() throws Exception { InstructorAttributes instructor1CS1101 = testData.instructors.get("instructor1CS1101"); ______TS("archive action success"); String courseId = "CCAddUiTest.CS1101"; InstructorAttributes instructorWithNullArchiveStatus = BackDoor.getInstructorByGoogleId(instructor1CS1101.googleId, instructor1CS1101.courseId); assertNull(instructorWithNullArchiveStatus.isArchived); coursesPage.archiveCourse(courseId); coursesPage.waitForAjaxLoadCoursesSuccess(); coursesPage.verifyHtmlMainContent("/instructorCoursesArchiveSuccessful.html"); instructorWithNullArchiveStatus = BackDoor.getInstructorByGoogleId(instructor1CS1101.googleId, instructor1CS1101.courseId); assertTrue(instructorWithNullArchiveStatus.isArchived.booleanValue()); ______TS("archive status of another instructor from same course not affected"); instructorId = testData.accounts.get("OtherInstructorWithoutCourses").googleId; coursesPage = getCoursesPage(); coursesPage.verifyHtmlMainContent("/instructorArchiveStatusNotAffected.html"); ______TS("unarchive action success"); instructorId = testData.accounts.get("instructorWithCourses").googleId; coursesPage = getCoursesPage(); coursesPage.unarchiveCourse(courseId); coursesPage.waitForAjaxLoadCoursesSuccess(); coursesPage.verifyHtmlMainContent("/instructorCoursesUnarchiveSuccessful.html"); ______TS("archive action failed"); String anotherCourseId = "CCAddUiTest.CS2104"; BackDoor.deleteCourse(anotherCourseId); coursesPage.archiveCourse(anotherCourseId); coursesPage.verifyContains("You are not authorized to view this page."); ______TS("unarchive action failed"); coursesPage = getCoursesPage(); coursesPage.archiveCourse(courseId); BackDoor.deleteCourse(courseId); coursesPage.unarchiveCourse(courseId); coursesPage.verifyContains("You are not authorized to view this page."); }