@SuppressWarnings({"unchecked", "rawtypes"})
public class TestJobImpl {
@Test
public void testJobNoTasksTransition() {
JobNoTasksCompletedTransition trans = new JobNoTasksCompletedTransition();
JobImpl mockJob = mock(JobImpl.class);
// Force checkJobCompleteSuccess to return null
Task mockTask = mock(Task.class);
Map<TaskId, Task> tasks = new HashMap<TaskId, Task>();
tasks.put(mockTask.getID(), mockTask);
mockJob.tasks = tasks;
when(mockJob.getInternalState()).thenReturn(JobStateInternal.ERROR);
JobEvent mockJobEvent = mock(JobEvent.class);
JobStateInternal state = trans.transition(mockJob, mockJobEvent);
Assert.assertEquals("Incorrect state returned from JobNoTasksCompletedTransition",
JobStateInternal.ERROR, state);
}