Source:
public void testFeedbackSessionClosedMailAction() throws Exception { ______TS("typical case, testing mime messages"); FeedbackSessionAttributes session1 = dataBundle.feedbackSessions.get("session1InCourse1"); session1.setTimeZone(0); session1.setStartTime(TimeHelper.getDateOffsetToCurrentTime(-1)); session1.setEndTime(TimeHelper.getDateOffsetToCurrentTime(0)); fsLogic.updateFeedbackSession(session1); HashMap<String, String> paramMap = createParamMapForAction(session1); String course1Name = CoursesLogic.inst().getCourse(session1.getCourseId()).getName(); EmailAction fsClosedAction = new FeedbackSessionClosedMailAction(paramMap); int course1InstructorCount = 5; List<EmailWrapper> preparedEmails = fsClosedAction.getPreparedEmailsAndPerformSuccessOperations(); assertEquals(course1InstructorCount, preparedEmails.size()); for (EmailWrapper email : preparedEmails) { assertEquals(String.format(EmailType.FEEDBACK_CLOSED.getSubject(), course1Name, session1.getFeedbackSessionName()), email.getSubject()); } FeedbackSessionAttributes session2 = dataBundle.feedbackSessions.get("session2InCourse2"); session2.setTimeZone(0); session2.setStartTime(TimeHelper.getDateOffsetToCurrentTime(-1)); session2.setEndTime(TimeHelper.getDateOffsetToCurrentTime(0)); fsLogic.updateFeedbackSession(session2); verifyPresentInDatastore(session2); FeedbackSessionAttributes session3 = dataBundle.feedbackSessions.get("session2InCourse1"); session3.setTimeZone(0); session3.setStartTime(TimeHelper.getDateOffsetToCurrentTime(-1)); session3.setEndTime(TimeHelper.getDateOffsetToCurrentTime(0)); session3.setClosingEmailEnabled(false); fsLogic.updateFeedbackSession(session3); verifyPresentInDatastore(session3); paramMap = createParamMapForAction(session2); fsClosedAction = new FeedbackSessionClosingMailAction(paramMap); preparedEmails = fsClosedAction.getPreparedEmailsAndPerformSuccessOperations(); assertTrue(preparedEmails.isEmpty()); }

Target:
public void testFeedbackSessionClosedMailAction() throws Exception { ______TS("typical case, testing mime messages"); FeedbackSessionAttributes session1 = dataBundle.feedbackSessions.get("session1InCourse1"); session1.setTimeZone(0); session1.setStartTime(TimeHelper.getDateOffsetToCurrentTime(-1)); session1.setEndTime(TimeHelper.getDateOffsetToCurrentTime(0)); fsLogic.updateFeedbackSession(session1); HashMap<String, String> paramMap = createParamMapForAction(session1); String course1Name = CoursesLogic.inst().getCourse(session1.getCourseId()).getName(); EmailAction fsClosedAction = new FeedbackSessionClosedMailAction(paramMap); int course1InstructorCount = 5; int course1StudentCount = 5; List<EmailWrapper> preparedEmails = fsClosedAction.getPreparedEmailsAndPerformSuccessOperations(); assertEquals(course1InstructorCount + course1StudentCount, preparedEmails.size()); for (EmailWrapper email : preparedEmails) { assertEquals(String.format(EmailType.FEEDBACK_CLOSED.getSubject(), course1Name, session1.getFeedbackSessionName()), email.getSubject()); } FeedbackSessionAttributes session2 = dataBundle.feedbackSessions.get("session2InCourse2"); session2.setTimeZone(0); session2.setStartTime(TimeHelper.getDateOffsetToCurrentTime(-1)); session2.setEndTime(TimeHelper.getDateOffsetToCurrentTime(0)); fsLogic.updateFeedbackSession(session2); verifyPresentInDatastore(session2); FeedbackSessionAttributes session3 = dataBundle.feedbackSessions.get("session2InCourse1"); session3.setTimeZone(0); session3.setStartTime(TimeHelper.getDateOffsetToCurrentTime(-1)); session3.setEndTime(TimeHelper.getDateOffsetToCurrentTime(0)); session3.setClosingEmailEnabled(false); fsLogic.updateFeedbackSession(session3); verifyPresentInDatastore(session3); paramMap = createParamMapForAction(session2); fsClosedAction = new FeedbackSessionClosingMailAction(paramMap); preparedEmails = fsClosedAction.getPreparedEmailsAndPerformSuccessOperations(); assertTrue(preparedEmails.isEmpty()); }