RxResultCursorImpl implements RxResultCursor { @Override public List<String> keys() { return runHandler.queryKeys().keys(); } RxResultCursorImpl(RunResponseHandler runHandler, PullResponseHandler pullHandler );  RxResultCursorImpl(Throwable runError, RunResponseHandler runHandler, PullResponseHandler pullHandler ); @Override List<String> keys(); @Override void installRecordConsumer( BiConsumer<Record,Throwable> recordConsumer ); @Override void request( long n ); @Override void cancel(); @Override CompletionStage<Throwable> discardAllFailureAsync(); @Override CompletionStage<Throwable> pullAllFailureAsync(); @Override CompletionStage<ResultSummary> summaryAsync(); @Override boolean isDone();  }
@Test void shouldReturnQueryKeys() throws Throwable { RunResponseHandler runHandler = newRunResponseHandler(); List<String> expected = asList( "key1", "key2", "key3" ); runHandler.onSuccess( Collections.singletonMap( "fields", value( expected ) ) ); PullResponseHandler pullHandler = mock( PullResponseHandler.class ); RxResultCursor cursor = new RxResultCursorImpl( runHandler, pullHandler ); List<String> actual = cursor.keys(); assertEquals( expected, actual ); }
@Test void shouldSupportReturnQueryKeysMultipleTimes() throws Throwable { RunResponseHandler runHandler = newRunResponseHandler(); List<String> expected = asList( "key1", "key2", "key3" ); runHandler.onSuccess( Collections.singletonMap( "fields", value( expected ) ) ); PullResponseHandler pullHandler = mock( PullResponseHandler.class ); RxResultCursor cursor = new RxResultCursorImpl( runHandler, pullHandler ); List<String> actual = cursor.keys(); assertEquals( expected, actual ); actual = cursor.keys(); assertEquals( expected, actual ); actual = cursor.keys(); assertEquals( expected, actual ); }