@Test
public void testSingleFailedIteration() {

    task1.setStatus(Task.Status.FAILED);
    String reason = "Test";
    task1.setReasonForIncompletion(reason);
    Mockito.doReturn(Arrays.asList(task1, task2, loopTask)).when(workflow).getTasks();
    boolean success = doWhile.execute(workflow, loopTask, provider);
    Assert.assertTrue(success);
    Assert.assertEquals(loopTask.getStatus(), Task.Status.FAILED);
    Assert.assertFalse(reason.equals(loopTask.getReasonForIncompletion()));
}