diff --git a/src/main/java/com/falkordb/impl/resultset/ResultSetImpl.java b/src/main/java/com/falkordb/impl/resultset/ResultSetImpl.java index b7f4c90..6c77cf8 100644 --- a/src/main/java/com/falkordb/impl/resultset/ResultSetImpl.java +++ b/src/main/java/com/falkordb/impl/resultset/ResultSetImpl.java @@ -335,7 +335,6 @@ public String toString() { @Override public Iterator iterator() { - // TODO Auto-generated method stub return results.iterator(); } } diff --git a/src/test/java/com/falkordb/GraphAPITest.java b/src/test/java/com/falkordb/GraphAPITest.java index 9ea268f..0eb0533 100644 --- a/src/test/java/com/falkordb/GraphAPITest.java +++ b/src/test/java/com/falkordb/GraphAPITest.java @@ -52,7 +52,7 @@ public void testCreateNode() { try { iterator.next(); - Assert.fail(); + fail("Expected NoSuchElementException was not thrown."); } catch (NoSuchElementException ignored) { } } @@ -102,7 +102,7 @@ public void testDeleteNodes() { Assert.assertNotNull(client.query("CREATE (:person{name:'roi',age:32})")); Assert.assertNotNull(client.query( - "MATCH (a:person), (b:person) WHERE (a.name = 'roi' AND b.name='amit') CREATE (a)-[:knows]->(a)")); + "MATCH (a:person), (b:person) WHERE (a.name = 'roi' AND b.name='amit') CREATE (a)-[:knows]->(b)")); deleteResult = client.query("MATCH (a:person) WHERE (a.name = 'roi') DELETE a"); Assert.assertFalse(deleteResult.iterator().hasNext()); @@ -155,9 +155,8 @@ public void testIndex() { try { client.query("CREATE INDEX ON :person(age)"); - fail(); + fail("Expected Exception was not thrown."); } catch (Exception e) { - // TODO: handle exception } ResultSet deleteExistingIndexResult = client.query("DROP INDEX ON :person(age)"); @@ -182,7 +181,6 @@ public void testHeader() { Assert.assertEquals("HeaderImpl{" + "schemaTypes=[COLUMN_SCALAR, COLUMN_SCALAR, COLUMN_SCALAR], " + "schemaNames=[a, r, a.age]}", header.toString()); - // Assert.assertEquals(-1901778507, header.hashCode()); List schemaNames = header.getSchemaNames(); @@ -934,7 +932,7 @@ public void testSimpleReadOnlyWithTimeOut() { "WITH 1000000 as n RETURN reduce(f = 1, x IN range(1, n) | f * x) AS result", 1L); - Assert.fail(); // should timeout + fail("Expected Timeout Exception was not thrown."); } catch (GraphException e) { Assert.assertTrue(e.getMessage().contains("Query timed out")); } diff --git a/src/test/java/com/falkordb/TransactionTest.java b/src/test/java/com/falkordb/TransactionTest.java index 9709b85..f2599cd 100644 --- a/src/test/java/com/falkordb/TransactionTest.java +++ b/src/test/java/com/falkordb/TransactionTest.java @@ -190,8 +190,9 @@ public void testMultiExecWithReadOnlyQueries(){ Assert.assertEquals(1, resultSet.getStatistics().nodesCreated()); Assert.assertEquals(1, resultSet.getStatistics().propertiesSet()); - // Graph read-only query result Assert.assertEquals(ResultSetImpl.class, results.get(4).getClass()); + + // Graph read-only query result resultSet = (ResultSet) results.get(3); Assert.assertNotNull(resultSet.getHeader()); diff --git a/src/test/java/com/falkordb/graph_entities/PathTest.java b/src/test/java/com/falkordb/graph_entities/PathTest.java index 93587ef..5d9f649 100644 --- a/src/test/java/com/falkordb/graph_entities/PathTest.java +++ b/src/test/java/com/falkordb/graph_entities/PathTest.java @@ -14,7 +14,7 @@ public class PathTest { private Node buildNode(int id){ Node n = new Node(); - n.setId(0); + n.setId(id); return n; } diff --git a/src/test/java/com/falkordb/test/utils/PathBuilder.java b/src/test/java/com/falkordb/test/utils/PathBuilder.java index 63c906e..1f1c7f0 100644 --- a/src/test/java/com/falkordb/test/utils/PathBuilder.java +++ b/src/test/java/com/falkordb/test/utils/PathBuilder.java @@ -10,25 +10,26 @@ public final class PathBuilder{ private final List nodes; private final List edges; - private Class currentAppendClass; + private Class currentAppendClass = Node.class; public PathBuilder() { - this.nodes = new ArrayList<>(0); - this.edges = new ArrayList<>(0); - currentAppendClass = Node.class; + this(0); } public PathBuilder(int nodesCount){ - nodes = new ArrayList<>(nodesCount); - edges = new ArrayList<>(nodesCount-1 >= 0 ? nodesCount -1 : 0); - currentAppendClass = Node.class; + this.nodes = new ArrayList<>(nodesCount); + this.edges = new ArrayList<>(nodesCount > 0 ? nodesCount - 1 : 0); } public PathBuilder append(Object object){ Class c = object.getClass(); - if(!currentAppendClass.equals(c)) throw new IllegalArgumentException("Path Builder expected " + currentAppendClass.getSimpleName() + " but was " + c.getSimpleName()); - if(c.equals(Node.class)) return appendNode((Node)object); - else return appendEdge((Edge)object); + if(!currentAppendClass.equals(c)){ + throw new IllegalArgumentException("Path Builder expected " + currentAppendClass.getSimpleName() + " but was " + c.getSimpleName()); + } + if(c.equals(Node.class)) { + return appendNode((Node)object); + } + return appendEdge((Edge)object); } private PathBuilder appendEdge(Edge edge) { @@ -44,7 +45,9 @@ private PathBuilder appendNode(Node node){ } public Path build(){ - if(nodes.size() != edges.size() + 1) throw new IllegalArgumentException("Path builder nodes count should be edge count + 1"); + if(nodes.size() != edges.size() + 1){ + throw new IllegalArgumentException("Path builder nodes count should be edge count + 1"); + } return new Path(nodes, edges); } }