Source:
public void testAdditionOfTaskToTaskQueue() throws Exception { FeedbackSessionClosedCallback.resetTaskCount(); ______TS("typical case, 0 sessions closed"); fsLogic.scheduleFeedbackSessionClosedEmails(); if (!FeedbackSessionClosedCallback.verifyTaskCount(0)) { assertEquals(FeedbackSessionClosedCallback.taskCount, 0); } ______TS("typical case, two sessions closed, " + "1 session closed with disabled closing reminder."); FeedbackSessionAttributes session1 = dataBundle.feedbackSessions .get("session1InCourse1"); session1.setTimeZone(0); session1.setStartTime(TimeHelper.getDateOffsetToCurrentTime(-2)); session1.setEndTime(TimeHelper.getDateOffsetToCurrentTime(0)); fsLogic.updateFeedbackSession(session1); verifyPresentInDatastore(session1); FeedbackSessionAttributes session2 = dataBundle.feedbackSessions .get("session2InCourse2"); session2.setTimeZone(0); session2.setStartTime(TimeHelper.getDateOffsetToCurrentTime(-2)); session2.setEndTime(TimeHelper.getDateOffsetToCurrentTime(0)); fsLogic.updateFeedbackSession(session2); verifyPresentInDatastore(session2); FeedbackSessionAttributes session3 = dataBundle.feedbackSessions .get("session2InCourse1"); session3.setTimeZone(0); session3.setStartTime(TimeHelper.getDateOffsetToCurrentTime(-2)); session3.setEndTime(TimeHelper.getDateOffsetToCurrentTime(0)); session3.setClosingEmailEnabled(false); fsLogic.updateFeedbackSession(session3); verifyPresentInDatastore(session3); int counter = 0; while (counter != 10) { FeedbackSessionClosedCallback.resetTaskCount(); fsLogic.scheduleFeedbackSessionClosedEmails(); if (FeedbackSessionClosedCallback.verifyTaskCount(2)) { break; } counter++; } if (counter == 10) { assertEquals(FeedbackSessionClosedCallback.taskCount, 2); } }

Target:
public void testAdditionOfTaskToTaskQueue() throws Exception { FeedbackSessionClosedCallback.resetTaskCount(); ______TS("typical case, 0 sessions closed"); fsLogic.scheduleFeedbackSessionClosedEmails(); if (!FeedbackSessionClosedCallback.verifyTaskCount(0)) { assertEquals(FeedbackSessionClosedCallback.taskCount, 0); } ______TS("typical case, two sessions closed, 1 session closed with disabled closing reminder."); FeedbackSessionAttributes session1 = dataBundle.feedbackSessions.get("session1InCourse1"); session1.setTimeZone(0); session1.setStartTime(TimeHelper.getDateOffsetToCurrentTime(-2)); session1.setEndTime(TimeHelper.getDateOffsetToCurrentTime(0)); fsLogic.updateFeedbackSession(session1); verifyPresentInDatastore(session1); FeedbackSessionAttributes session2 = dataBundle.feedbackSessions.get("session2InCourse2"); session2.setTimeZone(0); session2.setStartTime(TimeHelper.getDateOffsetToCurrentTime(-2)); session2.setEndTime(TimeHelper.getDateOffsetToCurrentTime(0)); fsLogic.updateFeedbackSession(session2); verifyPresentInDatastore(session2); FeedbackSessionAttributes session3 = dataBundle.feedbackSessions.get("session2InCourse1"); session3.setTimeZone(0); session3.setStartTime(TimeHelper.getDateOffsetToCurrentTime(-2)); session3.setEndTime(TimeHelper.getDateOffsetToCurrentTime(0)); session3.setClosingEmailEnabled(false); fsLogic.updateFeedbackSession(session3); verifyPresentInDatastore(session3); int counter = 0; while (counter != 10) { FeedbackSessionClosedCallback.resetTaskCount(); fsLogic.scheduleFeedbackSessionClosedEmails(); if (FeedbackSessionClosedCallback.verifyTaskCount(1)) { break; } counter++; } if (counter == 10) { assertEquals(FeedbackSessionClosedCallback.taskCount, 1); } }