public class CypherQueryTest2 extends AbstractCypherTest
{
@Test
public void testDSL()
{
assertQueryEquals( CYPHER + "START john=node(0) RETURN john", new CypherQuery()
{{
starts( nodesById( "john", 0 ) ).returns( identifier( "john" ) );
}}.toString() );
assertQueryEquals( CYPHER + "START john=node(0) MATCH r=(john)-[:KNOWS*1..3]->(x) RETURN x", new CypherQuery()
{{
starts( nodesById( "john", 0 ) ).
match( path( "r", node( "john" )
.out( "KNOWS" )
.hops( 1, 3 )
.node( "x" ) ) ).
returns( identifier( "x" ) );
}}.toString() );
assertQueryEquals( CYPHER + "START n=node(3,1) WHERE (n.age<30 and n.name=\"Tobias\") or not(n" +
".name=\"Tobias\") RETURN n", new CypherQuery()
{{
starts( nodesById( "n", 3, 1 ) ).
where( identifier( "n" ).property( "age" ).lt( 30 ).and( identifier( "n" ).string( "name" )
.eq( "Tobias" ) )
.or( not( identifier( "n" ).string( "name" ).eq( "Tobias" ) ) ) ).