ESTaskStatus { public boolean taskInError() { TaskState state = getStatus().getState(); return ESTaskStatus.errorState(state); } ESTaskStatus(SerializableState state, FrameworkID frameworkID, TaskInfo taskInfo, StatePath statePath); void setStatus(TaskStatus status); TaskStatus getStatus(); TaskStatus getDefaultStatus(); TaskInfo getTaskInfo(); @Override String toString(); boolean taskInError(); static boolean errorState(TaskState state); void destroy(); static final String STATE_KEY; static final String DEFAULT_STATUS_NO_MESSAGE_SET; }
@Test public void shouldErrorWhenTaskFinishedToUpdateState() throws IOException { when(state.get(anyString())).thenReturn(ProtoTestUtil.getDefaultTaskStatus(Protos.TaskState.TASK_FINISHED)); Assert.assertTrue(status.taskInError()); }
@Test public void shouldErrorWhenTaskKilled() throws IOException { when(state.get(anyString())).thenReturn(ProtoTestUtil.getDefaultTaskStatus(Protos.TaskState.TASK_KILLED)); Assert.assertTrue(status.taskInError()); }