@ThriftConstructor
    public ThriftBufferResult(
            String taskInstanceId,
            long token,
            long nextToken,
            boolean bufferComplete,
            long bufferedBytes,
            List<ThriftSerializedPage> thriftSerializedPages)
    {
        checkArgument(!isNullOrEmpty(taskInstanceId), "taskInstanceId is null");

        this.taskInstanceId = taskInstanceId;
        this.token = token;
        this.nextToken = nextToken;
        this.bufferComplete = bufferComplete;
        this.bufferedBytes = bufferedBytes;
        this.thriftSerializedPages = ImmutableList.copyOf(requireNonNull(thriftSerializedPages, "thriftSerializedPages is null"));
    }
@Test
    public void testThriftBufferResult()
    {
        BufferResult bufferResult = new BufferResult("task-instance-id", 0, 0, false, 0, ImmutableList.of());
        ThriftBufferResult thriftBufferResult = fromBufferResult(bufferResult);
        BufferResult newBufferResult = thriftBufferResult.toBufferResult();
        assertEquals(bufferResult, newBufferResult);
    }