*/
Calendar calendar = Calendar.getInstance();
calendar.roll(Calendar.DAY_OF_MONTH, -1); // sprint finished
Sprint sprint = new Sprint();
sprint.setFinalDate(calendar.getTime());
sprint.setSprintStatus(SprintStatus.RUNNING);
sprint.setStories(new HashSet<Story>());
sprint.getStories().add(new Story("STORY 1", null, StoryStatus.DONE, null, 10));
sprint.getStories().add(new Story("STORY 2", null, StoryStatus.DONE, null, 10));
sprint.getStories().add(new Story("STORY 3", null, StoryStatus.DOING, null, 10)); // <<---
sprint.getStories().add(new Story("STORY 3", null, StoryStatus.DONE, null, 10));
sprint.getStories().add(new Story("STORY 4", null, StoryStatus.DOING, null, 10));// <<---
when(sprintDao.findSprintByStatus(SprintStatus.RUNNING)).thenReturn(sprint);
when(sprintDao.update(sprint)).thenReturn(sprint);
scheduleSprint.execute();
verify(sprintDao).findSprintByStatus(SprintStatus.RUNNING);
verify(sprintDao).update(sprint);
assertEquals(SprintStatus.FAIL, sprint.getSprintStatus());
assertEquals(new Long(30), sprint.getDonePoints());
for (Story story : sprint.getStories()) {
if (story.getStatus() != StoryStatus.DONE) {
assertEquals(StoryStatus.BACKLOG, story.getStatus());
}
}
}