ESTaskStatus { public void setStatus(TaskStatus status) throws IllegalStateException { try { LOGGER.debug("Writing task status to zk: [" + status.getState() + "] " + status.getTaskId().getValue()); statePath.mkdir(getKey()); state.set(getKey(), status); } catch (IOException e) { throw new IllegalStateException("Unable to write task status to zookeeper", e); } } 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(expected = IllegalStateException.class) public void testHandleSetException() throws IllegalStateException, IOException { doThrow(IOException.class).when(state).set(anyString(), any()); status.setStatus(taskStatus); }