-
Notifications
You must be signed in to change notification settings - Fork 22
Add Optional test, remove invalid assertions from tests #70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -181,21 +181,15 @@ public void testHeader(){ | |
| Header header = queryResult.getHeader(); | ||
|
|
||
| List<String> schemaNames = header.getSchemaNames(); | ||
| List<Header.ResultSetColumnTypes> schemaTypes = header.getSchemaTypes(); | ||
|
|
||
| Assert.assertNotNull(schemaNames); | ||
| Assert.assertNotNull(schemaTypes); | ||
|
|
||
| Assert.assertEquals(3, schemaNames.size()); | ||
| Assert.assertEquals(3, schemaTypes.size()); | ||
|
|
||
| Assert.assertEquals("a", schemaNames.get(0)); | ||
| Assert.assertEquals("r", schemaNames.get(1)); | ||
| Assert.assertEquals("a.age", schemaNames.get(2)); | ||
|
|
||
| Assert.assertEquals(COLUMN_NODE, schemaTypes.get(0)); | ||
| Assert.assertEquals(COLUMN_RELATION, schemaTypes.get(1)); | ||
| Assert.assertEquals(COLUMN_SCALAR, schemaTypes.get(2)); | ||
|
|
||
| } | ||
|
|
||
|
|
@@ -368,17 +362,11 @@ public void testMultiThread(){ | |
| Assert.assertNotNull(resultSet.getHeader()); | ||
| Header header = resultSet.getHeader(); | ||
| List<String> schemaNames = header.getSchemaNames(); | ||
| List<Header.ResultSetColumnTypes> schemaTypes = header.getSchemaTypes(); | ||
| Assert.assertNotNull(schemaNames); | ||
| Assert.assertNotNull(schemaTypes); | ||
| Assert.assertEquals(3, schemaNames.size()); | ||
| Assert.assertEquals(3, schemaTypes.size()); | ||
| Assert.assertEquals("a", schemaNames.get(0)); | ||
| Assert.assertEquals("r", schemaNames.get(1)); | ||
| Assert.assertEquals("a.age", schemaNames.get(2)); | ||
| Assert.assertEquals(COLUMN_NODE, schemaTypes.get(0)); | ||
| Assert.assertEquals(COLUMN_RELATION, schemaTypes.get(1)); | ||
| Assert.assertEquals(COLUMN_SCALAR, schemaTypes.get(2)); | ||
|
Comment on lines
-379
to
-381
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove line 368 and all other lines using schemaTypes |
||
| Assert.assertEquals(1, resultSet.size()); | ||
| Assert.assertTrue(resultSet.hasNext()); | ||
| Record record = resultSet.next(); | ||
|
|
@@ -413,15 +401,10 @@ public void testMultiThread(){ | |
| Assert.assertNotNull(resultSet.getHeader()); | ||
| Header header = resultSet.getHeader(); | ||
| List<String> schemaNames = header.getSchemaNames(); | ||
| List<Header.ResultSetColumnTypes> schemaTypes = header.getSchemaTypes(); | ||
| Assert.assertNotNull(schemaNames); | ||
| Assert.assertNotNull(schemaTypes); | ||
| Assert.assertEquals(2, schemaNames.size()); | ||
| Assert.assertEquals(2, schemaTypes.size()); | ||
| Assert.assertEquals("a", schemaNames.get(0)); | ||
| Assert.assertEquals("r", schemaNames.get(1)); | ||
| Assert.assertEquals(COLUMN_NODE, schemaTypes.get(0)); | ||
| Assert.assertEquals(COLUMN_RELATION, schemaTypes.get(1)); | ||
|
Comment on lines
-423
to
-424
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove line 410 and all the lines using schema types |
||
| Assert.assertEquals(1, resultSet.size()); | ||
| Assert.assertTrue(resultSet.hasNext()); | ||
| Record record = resultSet.next(); | ||
|
|
@@ -462,15 +445,10 @@ public void testAdditionToProcedures(){ | |
| Assert.assertNotNull(resultSet.getHeader()); | ||
| Header header = resultSet.getHeader(); | ||
| List<String> schemaNames = header.getSchemaNames(); | ||
| List<Header.ResultSetColumnTypes> schemaTypes = header.getSchemaTypes(); | ||
| Assert.assertNotNull(schemaNames); | ||
| Assert.assertNotNull(schemaTypes); | ||
| Assert.assertEquals(2, schemaNames.size()); | ||
| Assert.assertEquals(2, schemaTypes.size()); | ||
| Assert.assertEquals("a", schemaNames.get(0)); | ||
| Assert.assertEquals("r", schemaNames.get(1)); | ||
| Assert.assertEquals(COLUMN_NODE, schemaTypes.get(0)); | ||
| Assert.assertEquals(COLUMN_RELATION, schemaTypes.get(1)); | ||
|
Comment on lines
-472
to
-473
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove line 457 and all line using schemaTypes |
||
| Assert.assertEquals(1, resultSet.size()); | ||
| Assert.assertTrue(resultSet.hasNext()); | ||
| Record record = resultSet.next(); | ||
|
|
@@ -497,15 +475,10 @@ public void testAdditionToProcedures(){ | |
| Assert.assertNotNull(resultSet.getHeader()); | ||
| header = resultSet.getHeader(); | ||
| schemaNames = header.getSchemaNames(); | ||
| schemaTypes = header.getSchemaTypes(); | ||
| Assert.assertNotNull(schemaNames); | ||
| Assert.assertNotNull(schemaTypes); | ||
| Assert.assertEquals(2, schemaNames.size()); | ||
| Assert.assertEquals(2, schemaTypes.size()); | ||
| Assert.assertEquals("a", schemaNames.get(0)); | ||
| Assert.assertEquals("r", schemaNames.get(1)); | ||
| Assert.assertEquals(COLUMN_NODE, schemaTypes.get(0)); | ||
| Assert.assertEquals(COLUMN_RELATION, schemaTypes.get(1)); | ||
|
Comment on lines
-507
to
-508
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove line 490 and all lines using schemaTypes |
||
| Assert.assertEquals(1, resultSet.size()); | ||
| Assert.assertTrue(resultSet.hasNext()); | ||
| record = resultSet.next(); | ||
|
|
@@ -572,18 +545,10 @@ public void testMultiExec(){ | |
|
|
||
|
|
||
| List<String> schemaNames = header.getSchemaNames(); | ||
| List<Header.ResultSetColumnTypes> schemaTypes = header.getSchemaTypes(); | ||
|
|
||
| Assert.assertNotNull(schemaNames); | ||
| Assert.assertNotNull(schemaTypes); | ||
|
|
||
| Assert.assertEquals(1, schemaNames.size()); | ||
| Assert.assertEquals(1, schemaTypes.size()); | ||
|
|
||
| Assert.assertEquals("n", schemaNames.get(0)); | ||
|
|
||
| Assert.assertEquals(COLUMN_NODE, schemaTypes.get(0)); | ||
|
|
||
|
Comment on lines
-585
to
-586
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove line 563 and all lines using schemaTypes |
||
| Property nameProperty = new Property("name", "a"); | ||
|
|
||
| Node expectedNode = new Node(); | ||
|
|
@@ -606,18 +571,10 @@ public void testMultiExec(){ | |
|
|
||
|
|
||
| schemaNames = header.getSchemaNames(); | ||
| schemaTypes = header.getSchemaTypes(); | ||
|
|
||
| Assert.assertNotNull(schemaNames); | ||
| Assert.assertNotNull(schemaTypes); | ||
|
|
||
| Assert.assertEquals(1, schemaNames.size()); | ||
| Assert.assertEquals(1, schemaTypes.size()); | ||
|
|
||
| Assert.assertEquals("label", schemaNames.get(0)); | ||
|
|
||
| Assert.assertEquals(COLUMN_SCALAR, schemaTypes.get(0)); | ||
|
|
||
| Assert.assertEquals(1, resultSet.size()); | ||
| Assert.assertTrue(resultSet.hasNext()); | ||
| record = resultSet.next(); | ||
|
|
@@ -816,16 +773,9 @@ public void testArraySupport() { | |
|
|
||
|
|
||
| List<String> schemaNames = header.getSchemaNames(); | ||
| List<Header.ResultSetColumnTypes> schemaTypes = header.getSchemaTypes(); | ||
|
|
||
| Assert.assertNotNull(schemaNames); | ||
| Assert.assertNotNull(schemaTypes); | ||
|
|
||
| Assert.assertEquals(1, schemaNames.size()); | ||
| Assert.assertEquals(1, schemaTypes.size()); | ||
|
|
||
| Assert.assertEquals("x", schemaNames.get(0)); | ||
| Assert.assertEquals(COLUMN_SCALAR, schemaTypes.get(0)); | ||
|
|
||
| // check record | ||
| Assert.assertEquals(1, resultSet.size()); | ||
|
|
@@ -846,16 +796,9 @@ public void testArraySupport() { | |
|
|
||
|
|
||
| schemaNames = header.getSchemaNames(); | ||
| schemaTypes = header.getSchemaTypes(); | ||
|
|
||
| Assert.assertNotNull(schemaNames); | ||
| Assert.assertNotNull(schemaTypes); | ||
|
|
||
| Assert.assertEquals(1, schemaNames.size()); | ||
| Assert.assertEquals(1, schemaTypes.size()); | ||
|
|
||
| Assert.assertEquals("x", schemaNames.get(0)); | ||
| Assert.assertEquals(COLUMN_SCALAR, schemaTypes.get(0)); | ||
|
|
||
| // check record | ||
| Assert.assertEquals(1, resultSet.size()); | ||
|
|
@@ -875,16 +818,9 @@ record = resultSet.next(); | |
|
|
||
|
|
||
| schemaNames = header.getSchemaNames(); | ||
| schemaTypes = header.getSchemaTypes(); | ||
|
|
||
| Assert.assertNotNull(schemaNames); | ||
| Assert.assertNotNull(schemaTypes); | ||
|
|
||
| Assert.assertEquals(1, schemaNames.size()); | ||
| Assert.assertEquals(1, schemaTypes.size()); | ||
|
|
||
| Assert.assertEquals("x", schemaNames.get(0)); | ||
| Assert.assertEquals(COLUMN_SCALAR, schemaTypes.get(0)); | ||
|
|
||
| // check record | ||
| Assert.assertEquals(3, resultSet.size()); | ||
|
|
@@ -960,4 +896,49 @@ public void testParameters(){ | |
| } | ||
| } | ||
|
|
||
| @Test | ||
| public void testNullGraphEntities() { | ||
| // Create two nodes connected by a single outgoing edge. | ||
| Assert.assertNotNull(api.query("social", "CREATE (:L)-[:E]->(:L2)")); | ||
| // Test a query that produces 1 record with 3 null values. | ||
| ResultSet resultSet = api.query("social", "OPTIONAL MATCH (a:NONEXISTENT)-[e]->(b) RETURN a, e, b"); | ||
| Assert.assertEquals(1, resultSet.size()); | ||
| Assert.assertTrue(resultSet.hasNext()); | ||
| Record record = resultSet.next(); | ||
| Assert.assertFalse(resultSet.hasNext()); | ||
| Assert.assertEquals(Arrays.asList(null, null, null), record.values()); | ||
|
|
||
| // Test a query that produces 2 records, with 2 null values in the second. | ||
| resultSet = api.query("social", "MATCH (a) OPTIONAL MATCH (a)-[e]->(b) RETURN a, e, b ORDER BY ID(a)"); | ||
| Assert.assertEquals(2, resultSet.size()); | ||
| record = resultSet.next(); | ||
| Assert.assertEquals(3, record.size()); | ||
|
|
||
| Assert.assertNotNull(record.getValue(0)); | ||
| Assert.assertNotNull(record.getValue(1)); | ||
| Assert.assertNotNull(record.getValue(2)); | ||
|
|
||
| record = resultSet.next(); | ||
| Assert.assertEquals(3, record.size()); | ||
|
|
||
| Assert.assertNotNull(record.getValue(0)); | ||
| Assert.assertNull(record.getValue(1)); | ||
| Assert.assertNull(record.getValue(2)); | ||
|
|
||
| // Test a query that produces 2 records, the first containing a path and the second containing a null value. | ||
| resultSet = api.query("social", "MATCH (a) OPTIONAL MATCH p = (a)-[e]->(b) RETURN p"); | ||
| Assert.assertEquals(2, resultSet.size()); | ||
| record = resultSet.next(); | ||
| Assert.assertEquals(1, record.size()); | ||
|
|
||
| Object path = record.getValue(0); | ||
| Assert.assertNotNull(record.getValue(0)); | ||
|
|
||
| record = resultSet.next(); | ||
| Assert.assertEquals(1, record.size()); | ||
|
|
||
| path = record.getValue(0); | ||
| Assert.assertNull(record.getValue(0)); | ||
|
|
||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove line 184
please annotate getSchemaTypes as
@deprecatedboth in the interface and the implemented class, with explenation why it is deprecated