use of org.neo4j.driver.v1.Statement in project cypher-for-gremlin by opencypher.
the class GremlinServerStatementResultTest method map.
@Test
public void map() {
List<Map<String, Object>> results = Arrays.asList(getRow(1), getRow(2));
StatementResult statementResult = new GremlinServerDriver.GremlinServerStatementResult(serverInfo, statement, results.iterator());
assertThat(statementResult.list(r -> r.get(KEY2).asString())).containsExactly("value1", "value2");
}
use of org.neo4j.driver.v1.Statement in project cypher-for-gremlin by opencypher.
the class GremlinServerStatementResultTest method create.
@Test
public void create() {
List<Map<String, Object>> results = Arrays.asList(getRow(1), getRow(2), getRow(3));
StatementResult statementResult = new GremlinServerDriver.GremlinServerStatementResult(serverInfo, statement, results.iterator());
assertThat(statementResult.keys()).containsExactly(KEY1, KEY2);
assertThat(statementResult.peek().get(KEY1).asInt()).isEqualTo(1);
assertThat(statementResult.hasNext()).isTrue();
assertThat(statementResult.next().get(KEY1).asInt()).isEqualTo(1);
assertThat(statementResult.hasNext()).isTrue();
assertThat(statementResult.next().get(KEY1).asInt()).isEqualTo(2);
assertThat(statementResult.hasNext()).isTrue();
// see org.neo4j.driver.internal.InternalStatementResult#list()
assertThat(statementResult.list()).hasSize(1);
assertThat(statementResult.hasNext()).isFalse();
assertThat(statementResult.summary().server()).isEqualTo(serverInfo);
}
use of org.neo4j.driver.v1.Statement in project cypher-for-gremlin by opencypher.
the class GremlinServerStatementResultTest method singleZero.
@Test(expected = NoSuchRecordException.class)
public void singleZero() {
StatementResult statementResult = new GremlinServerDriver.GremlinServerStatementResult(serverInfo, statement, new ArrayList<Map<String, Object>>().iterator());
statementResult.single();
}
Aggregations