gremlin-scala icon indicating copy to clipboard operation
gremlin-scala copied to clipboard

g.V(vertexID).headOption() returning null.

Open nilay0016 opened this issue 5 years ago • 0 comments

Hi,

Issue is regarding graphs, files attached for reference. I am testing a service class that has reference database connection and the graph. I have created a test graph using TinkerGraph.open.asScala as mentioned in the document and added the vertex with properties into the graph. To mock the injected object, I am using Mockito to get a null object on mock and then return proper values on call of the object functions. Eg. val db = mock[DbConnection] Mockito.when(db.g).thenReturn(graph)

I am facing issues when i perform operation on my test graph to get vertex and return them on mockito call, eg - println("VertexID GR -:"+gr.V(vertexId).headOption()) // prints None println("VertexID GR -:"+gr.V(vertexId)) // prints -: [GraphStep(vertex,[{~label=bto, btoId=2f6a7cfe-fcd7-4e03-916b-fd1a1258b466}])] where vertexId = val vertexId = s"{~label=bto, btoId=$id1}" // created for testing.

I have added sample files for reference. Any help/suggestions are appreciated.

BtoService.txt BtoServiceTest.txt

nilay0016 avatar Mar 20 '20 10:03 nilay0016