ActionState endState = null;
if (failJob) {
e = new ActionFailedEvent(job.getId(), endTime);
endState = ActionState.FAILED;
} else {
e = new ActionCompletedEvent(job.getId(), endTime);
endState = ActionState.COMPLETED;
}
job.handleEvent(e);
Assert.assertEquals(endState, job.getState());
Assert.assertEquals(endTime, job.getLastUpdateTime());