11package com .redislabs .redisgraph ;
22
3+ import java .lang .reflect .Method ;
4+
35import org .junit .Assert ;
46import org .junit .Before ;
57import org .junit .Test ;
68
79import com .redislabs .redisgraph .Statistics .Label ;
810
11+ import redis .clients .jedis .Jedis ;
12+
913public class RedisGraphAPITest {
1014 RedisGraphAPI api ;
1115
@@ -14,15 +18,18 @@ public RedisGraphAPITest() {
1418 }
1519
1620 @ Before
17- public void flushDB () {
18- api .deleteGraph ();
21+ public void flushDB () throws Exception {
22+ // api.deleteGraph(); - TODO add this back once we implement this API
23+
24+ Method method = RedisGraphAPI .class .getDeclaredMethod ("_conn" );
25+ method .setAccessible (true );
26+ ((Jedis )method .invoke (api )).flushDB ();
1927 }
20-
2128
2229 @ Test
2330 public void testCreateNode () throws Exception {
2431 // Create a node
25- ResultSet result = api .query ("CREATE ({name:\" roi\" ,age:32})" );
32+ ResultSet result = api .query ("CREATE ({name:' roi' ,age:32})" );
2633 Assert .assertFalse (result .hasNext ());
2734
2835 Assert .assertEquals (1 , result .getStatistics ().nodesCreated ());
@@ -36,7 +43,7 @@ public void testCreateNode() throws Exception {
3643 @ Test
3744 public void testCreateLabeledNode () throws Exception {
3845 // Create a node with a label
39- ResultSet result = api .query ("CREATE (:human{name:\" danny\" ,age:12})" );
46+ ResultSet result = api .query ("CREATE (:human{name:' danny' ,age:12})" );
4047 Assert .assertFalse (result .hasNext ());
4148
4249 Assert .assertEquals ("1" , result .getStatistics ().getStringValue (Label .NODES_CREATED ));
0 commit comments