TupleSink implements ITupleSink { @Override public Tuple getNextTuple() throws TexeraException { if (cursor == CLOSED) { return null; } if (cursor >= predicate.getLimit() + predicate.getOffset()) { return null; } Tuple resultTuple = null; while (true) { resultTuple = inputOperator.getNextTuple(); if (resultTuple == null) { return null; } cursor++; if (cursor > predicate.getOffset()) { break; } } return new Tuple.Builder(resultTuple) .removeIfExists(SchemaConstants.PAYLOAD).build(); } TupleSink();  TupleSink(TupleSinkPredicate predicate); void setInputOperator(IOperator inputOperator); IOperator getInputOperator(); @Override Schema getOutputSchema(); @Override void open(); @Override void close(); @Override void processTuples(); @Override Tuple getNextTuple(); List<Tuple> collectAllTuples(); @Override Schema transformToOutputSchema(Schema... inputSchema);  }
@Test public void testGetNextTuple() throws Exception { TupleSink tupleSink = new TupleSink(); tupleSink.setInputOperator(inputOperator); tupleSink.open(); Tuple tuple = tupleSink.getNextTuple(); Assert.assertEquals("test1", tuple.getField("content").getValue()); tupleSink.close(); }