Source:
<code>private void testPublishAndResendLinkAction() throws Exception { feedbackPage = getFeedbackPageForInstructor(idOfInstructorWithSessions); ______TS("MANUAL: publish link clickable"); String courseId = testData.feedbackSessions.get("manualSession").getCourseId(); String sessionName = testData.feedbackSessions.get("manualSession").getFeedbackSessionName(); feedbackPage.clickAndCancel(feedbackPage.getPublishLink(courseId, sessionName)); assertFalse(BackDoor.getFeedbackSession(courseId, sessionName).isPublished()); <START> feedbackPage.verifyResendPublishedEmailButtonDoesNotExist(courseId, sessionName); <END> feedbackPage.clickAndConfirm(feedbackPage.getPublishLink(courseId, sessionName)); feedbackPage.waitForTextsForAllStatusMessagesToUserEquals(Const.StatusMessages.FEEDBACK_SESSION_PUBLISHED); assertTrue(BackDoor.getFeedbackSession(courseId, sessionName).isPublished()); feedbackPage.verifyHtmlMainContent("/instructorFeedbackPublishSuccessful.html"); ______TS("PUBLISHED: publish link hidden"); feedbackPage = getFeedbackPageForInstructor(idOfInstructorWithSessions); feedbackPage.verifyPublishLinkHidden(courseId, sessionName); feedbackPage.clickResendPublishedEmailLink(courseId, sessionName); feedbackPage.cancelResendPublishedEmailForm(); feedbackPage.clickResendPublishedEmailLink(courseId, sessionName); feedbackPage.waitForAjaxLoaderGifToDisappear(); feedbackPage.submitResendPublishedEmailForm(); feedbackPage.waitForPageToLoad(); feedbackPage.waitForTextsForAllStatusMessagesToUserEquals( Const.StatusMessages.FEEDBACK_SESSION_RESEND_EMAIL_EMPTY_RECIPIENT); feedbackPage.clickResendPublishedEmailLink(courseId, sessionName); feedbackPage.waitForAjaxLoaderGifToDisappear(); feedbackPage.fillResendPublishedEmailForm(); feedbackPage.submitResendPublishedEmailForm(); feedbackPage.waitForPageToLoad(); feedbackPage.waitForTextsForAllStatusMessagesToUserEquals( Const.StatusMessages.FEEDBACK_SESSION_RESEND_EMAIL_EMPTY_RECIPIENT); }</code><technical_language>refactoring verifyResendPublishedEmailButtonDoesNotExist() function checkIfResendPublishedEmailButtonExists return true/false depending exception. check if button exists assertTrue/False() functions</technical_language>

Target:
private void testPublishAndResendLinkAction() throws Exception { feedbackPage = getFeedbackPageForInstructor(idOfInstructorWithSessions); ______TS("MANUAL: publish link clickable"); String courseId = testData.feedbackSessions.get("manualSession").getCourseId(); String sessionName = testData.feedbackSessions.get("manualSession").getFeedbackSessionName(); feedbackPage.clickAndCancel(feedbackPage.getPublishLink(courseId, sessionName)); assertFalse(BackDoor.getFeedbackSession(courseId, sessionName).isPublished()); assertFalse(feedbackPage.checkIfResendPublishedEmailButtonExists(courseId, sessionName)); feedbackPage.clickAndConfirm(feedbackPage.getPublishLink(courseId, sessionName)); feedbackPage.waitForTextsForAllStatusMessagesToUserEquals(Const.StatusMessages.FEEDBACK_SESSION_PUBLISHED); assertTrue(BackDoor.getFeedbackSession(courseId, sessionName).isPublished()); feedbackPage.verifyHtmlMainContent("/instructorFeedbackPublishSuccessful.html"); ______TS("PUBLISHED: publish link hidden"); feedbackPage = getFeedbackPageForInstructor(idOfInstructorWithSessions); feedbackPage.verifyPublishLinkHidden(courseId, sessionName); ______TS("resend link action: PUBLISHED feedback session"); assertTrue(feedbackPage.checkIfResendPublishedEmailButtonExists(courseId, sessionName)); feedbackPage.clickResendPublishedEmailLink(courseId, sessionName); feedbackPage.cancelResendPublishedEmailForm(); feedbackPage.clickResendPublishedEmailLink(courseId, sessionName); feedbackPage.waitForAjaxLoaderGifToDisappear(); feedbackPage.submitResendPublishedEmailForm(); feedbackPage.waitForPageToLoad(); feedbackPage.waitForTextsForAllStatusMessagesToUserEquals( Const.StatusMessages.FEEDBACK_SESSION_RESEND_EMAIL_EMPTY_RECIPIENT); feedbackPage.clickResendPublishedEmailLink(courseId, sessionName); feedbackPage.waitForAjaxLoaderGifToDisappear(); feedbackPage.fillResendPublishedEmailForm(); feedbackPage.submitResendPublishedEmailForm(); feedbackPage.waitForPageToLoad(); feedbackPage.waitForTextsForAllStatusMessagesToUserEquals( Const.StatusMessages.FEEDBACK_SESSION_RESEND_EMAIL_EMPTY_RECIPIENT); }