@Test public void testStore_dontSetTasksToDone() { this.store_createMockStoryBusiness(); Task task1 = new Task(); task1.setId(11); task1.setState(TaskState.BLOCKED); Task task2 = new Task(); task2.setId(12); task2.setState(TaskState.BLOCKED); story1.setIteration(iteration); story1.setTasks(new HashSet<Task>(Arrays.asList(task1, task2))); expect(storyDAO.get(story1.getId())).andReturn(story1); storyDAO.store(story1); replayAll(); Story actual = storyBusiness.store(story1.getId(), story1, null, null, false); verifyAll(); for (Task t : actual.getTasks()) { assertEquals(TaskState.BLOCKED, t.getState()); } }
@Test public void testStore_tasksToDone() { Task task1 = new Task(); task1.setId(11); task1.setState(TaskState.BLOCKED); Task task2 = new Task(); task2.setId(12); task2.setState(TaskState.PENDING); story1.setIteration(iteration); story1.setTasks(new HashSet<Task>(Arrays.asList(task1, task2))); expect(storyDAO.get(story1.getId())).andReturn(story1); storyDAO.store(story1); taskBusiness.setTaskToDone(task1); taskBusiness.setTaskToDone(task2); iheBusiness.updateIterationHistory(story1.getIteration().getId()); replayAll(); storyBusiness.store(story1.getId(), story1, null, null, true); verifyAll(); }