コード例 #1
0
  @Test
  public void exampleQuery() throws Exception {
    // START SNIPPET: JavaQuery
    ExecutionEngine engine = new ExecutionEngine(db);
    ExecutionResult result = engine.execute("start n=node(0) where 1=1 return n");

    assertThat(result.columns(), hasItem("n"));
    Iterator<Node> n_column = result.columnAs("n");
    assertThat(asIterable(n_column), hasItem(db.getNodeById(0)));
    assertThat(result.toString(), containsString("Node[0]"));
    // END SNIPPET: JavaQuery
  }
コード例 #2
0
 @Test
 public void testColumnAreInTheRightOrder() throws Exception {
   createTenNodes();
   String q =
       "start one=node(1), two=node(2), three=node(3), four=node(4), five=node(5), six=node(6), "
           + "seven=node(7), eight=node(8), nine=node(9), ten=node(10) "
           + "return one, two, three, four, five, six, seven, eight, nine, ten";
   ExecutionResult result = engine.execute(q);
   assertThat(
       result.toString(),
       matchesPattern("one.*two.*three.*four.*five.*six.*seven.*eight.*nine.*ten"));
 }