### Question:
SqlTask { public TaskInfo abort() { taskStateMachine.abort(); return getTaskInfo(); } private  SqlTask(
            TaskId taskId,
            URI location,
            String nodeId,
            QueryContext queryContext,
            SqlTaskExecutionFactory sqlTaskExecutionFactory,
            ExecutorService taskNotificationExecutor,
            DataSize maxBufferSize); static SqlTask createSqlTask(
            TaskId taskId,
            URI location,
            String nodeId,
            QueryContext queryContext,
            SqlTaskExecutionFactory sqlTaskExecutionFactory,
            ExecutorService taskNotificationExecutor,
            Function<SqlTask, ?> onDone,
            DataSize maxBufferSize,
            CounterStat failedTasks); boolean isOutputBufferOverutilized(); SqlTaskIoStats getIoStats(); TaskId getTaskId(); String getTaskInstanceId(); void recordHeartbeat(); TaskInfo getTaskInfo(); TaskStatus getTaskStatus(); VersionedDynamicFilterDomains acknowledgeAndGetNewDynamicFilterDomains(long callersDynamicFiltersVersion); synchronized ListenableFuture<TaskStatus> getTaskStatus(long callersCurrentVersion); synchronized ListenableFuture<TaskInfo> getTaskInfo(long callersCurrentVersion); TaskInfo updateTask(Session session, Optional<PlanFragment> fragment, List<TaskSource> sources, OutputBuffers outputBuffers, OptionalInt totalPartitions); ListenableFuture<BufferResult> getTaskResults(OutputBufferId bufferId, long startingSequenceId, DataSize maxSize); void acknowledgeTaskResults(OutputBufferId bufferId, long sequenceId); TaskInfo abortTaskResults(OutputBufferId bufferId); void failed(Throwable cause); TaskInfo cancel(); TaskInfo abort(); @Override String toString(); void addStateChangeListener(StateChangeListener<TaskState> stateChangeListener); QueryContext getQueryContext();  }### Answer:
@Test(timeOut = 30_000) public void testAbort() throws Exception { SqlTask sqlTask = createInitialTask(); assertEquals(sqlTask.getTaskStatus().getState(), TaskState.RUNNING); assertEquals(sqlTask.getTaskStatus().getVersion(), STARTING_VERSION); sqlTask.updateTask(TEST_SESSION, Optional.of(PLAN_FRAGMENT), ImmutableList.of(new TaskSource(TABLE_SCAN_NODE_ID, ImmutableSet.of(SPLIT), true)), createInitialEmptyOutputBuffers(PARTITIONED).withBuffer(OUT, 0).withNoMoreBufferIds(), OptionalInt.empty()); TaskInfo taskInfo = sqlTask.getTaskInfo(STARTING_VERSION).get(); assertEquals(taskInfo.getTaskStatus().getState(), TaskState.FLUSHING); assertEquals(taskInfo.getTaskStatus().getVersion(), STARTING_VERSION + 1); sqlTask.abortTaskResults(OUT); taskInfo = sqlTask.getTaskInfo(taskInfo.getTaskStatus().getVersion()).get(); assertEquals(taskInfo.getTaskStatus().getState(), TaskState.FINISHED); taskInfo = sqlTask.getTaskInfo(); assertEquals(taskInfo.getTaskStatus().getState(), TaskState.FINISHED); }