Source:
<code>private void testCopyQuestion() throws Exception { ______TS("Success case: copy questions successfully"); feedbackEditPage.clickCopyButton(); feedbackEditPage.waitForCopyTableToLoad(); assertFalse("Unable to submit when there are no questions selected", feedbackEditPage.isCopySubmitButtonEnabled()); feedbackEditPage.verifyHtmlPart(By.id("copyModal"), "/instructorFeedbackCopyQuestionModal.html"); feedbackEditPage.clickCopyTableAtRow(0); assertTrue("Can click after selecting", feedbackEditPage.isCopySubmitButtonEnabled()); feedbackEditPage.clickCopySubmitButton(); feedbackEditPage.verifyHtmlMainContent("/instructorFeedbackCopyQuestionSuccess.html"); ______TS("Success case: copy multiple questions successfully"); int numQuestionEditForms = feedbackEditPage.getNumberOfQuestionEditForms(); feedbackEditPage.clickCopyButton(); feedbackEditPage.waitForCopyTableToLoad(); feedbackEditPage.clickCopyTableAtRow(0); feedbackEditPage.clickCopyTableAtRow(1); feedbackEditPage.clickCopySubmitButton(); assertEquals(numQuestionEditForms + 2, feedbackEditPage.getNumberOfQuestionEditForms()); ______TS("No copiable questions"); feedbackEditPage = getFeedbackEditPageOfCourseWithoutQuestions(); feedbackEditPage.clickCopyButton(); feedbackEditPage.waitForCopyErrorMessageToLoad(); assertEquals("There are no questions to be copied.", feedbackEditPage.getCopyErrorMessageText()); assertFalse("Should not be able to submit if there are no questions", feedbackEditPage.isCopySubmitButtonEnabled()); ______TS("Fails gracefully with an error message"); feedbackEditPage = getFeedbackEditPage(); <START> feedbackEditPage.changeActionLinkOnCopyButton("invalid URL"); <END> feedbackEditPage.clickCopyButton(); feedbackEditPage.waitForCopyErrorMessageToLoad(); assertEquals("Error retrieving questions. Please close the dialog window and try again.", feedbackEditPage.getCopyErrorMessageText()); assertFalse("Should not be able to submit if loading failed", feedbackEditPage.isCopySubmitButtonEnabled()); String questionId = getFeedbackQuestionWithRetry(courseId, feedbackSessionName, 4).getId(); BackDoor.deleteFeedbackQuestion(questionId); questionId = getFeedbackQuestionWithRetry(courseId, feedbackSessionName, 3).getId(); BackDoor.deleteFeedbackQuestion(questionId); }</code><technical_language>related gender type</technical_language>

Target:
private void testCopyQuestion() throws Exception { ______TS("Success case: copy questions successfully"); feedbackEditPage.clickCopyButton(); feedbackEditPage.waitForCopyTableToLoad(); assertFalse("Unable to submit when there are no questions selected", feedbackEditPage.isCopySubmitButtonEnabled()); feedbackEditPage.verifyHtmlPart(By.id("copyModal"), "/instructorFeedbackCopyQuestionModal.html"); feedbackEditPage.clickCopyTableAtRow(0); assertTrue("Can click after selecting", feedbackEditPage.isCopySubmitButtonEnabled()); feedbackEditPage.clickCopySubmitButton(); feedbackEditPage.verifyHtmlMainContent("/instructorFeedbackCopyQuestionSuccess.html"); ______TS("Success case: copy multiple questions successfully"); int numQuestionEditForms = feedbackEditPage.getNumberOfQuestionEditForms(); feedbackEditPage.clickCopyButton(); feedbackEditPage.waitForCopyTableToLoad(); feedbackEditPage.clickCopyTableAtRow(0); feedbackEditPage.clickCopyTableAtRow(1); feedbackEditPage.clickCopySubmitButton(); assertEquals(numQuestionEditForms + 2, feedbackEditPage.getNumberOfQuestionEditForms()); ______TS("No copiable questions"); feedbackEditPage = getFeedbackEditPageOfCourseWithoutQuestions(); feedbackEditPage.clickCopyButton(); feedbackEditPage.waitForCopyErrorMessageToLoad(); assertEquals("There are no questions to be copied.", feedbackEditPage.getCopyErrorMessageText()); assertFalse("Should not be able to submit if there are no questions", feedbackEditPage.isCopySubmitButtonEnabled()); ______TS("Fails gracefully with an error message"); feedbackEditPage = getFeedbackEditPage(); feedbackEditPage.changeActionLinkOnCopyButton("INVALID URL"); feedbackEditPage.clickCopyButton(); feedbackEditPage.waitForCopyErrorMessageToLoad(); assertEquals("Error retrieving questions. Please close the dialog window and try again.", feedbackEditPage.getCopyErrorMessageText()); assertFalse("Should not be able to submit if loading failed", feedbackEditPage.isCopySubmitButtonEnabled()); String questionId = getFeedbackQuestionWithRetry(courseId, feedbackSessionName, 4).getId(); BackDoor.deleteFeedbackQuestion(questionId); questionId = getFeedbackQuestionWithRetry(courseId, feedbackSessionName, 3).getId(); BackDoor.deleteFeedbackQuestion(questionId); }