yangxk1 commented on code in PR #773:
URL: https://github.com/apache/incubator-graphar/pull/773#discussion_r2626152895


##########
maven-projects/info/src/test/java/org/apache/graphar/info/GraphInfoTest.java:
##########
@@ -109,6 +110,56 @@ public void testGraphInfoBasics() {
                 illegalArgumentException.getMessage());
         // test version gar/v1
         Assert.assertEquals(1, graphInfo.getVersion().getVersion());
+        // basic tests for addVertex and removeVertex (more advanced ones 
should include adjacency
+        // list checks)
+        VertexInfo testingVertexInfo =
+                new VertexInfo("", 100, Arrays.asList(TestUtil.pg1), 
"vertex/person/", "gar/v1");
+        GraphInfo testingVertexGraphInfo =
+                new GraphInfo("graphVertexTest", new ArrayList<>(), new 
ArrayList<>(), "", "");
+        // remove unexisting vertex from an empty graph
+        
Assert.assertTrue(testingVertexGraphInfo.removeVertex(testingVertexInfo).isEmpty());
+        // add the created vertex on an empty graph
+        Optional<GraphInfo> addVertexAsNewGraph =
+                testingVertexGraphInfo.addVertexAsNew(testingVertexInfo);
+        Assert.assertTrue(addVertexAsNewGraph.isPresent());
+        testingVertexGraphInfo = addVertexAsNewGraph.get();
+        Assert.assertEquals(1, 
addVertexAsNewGraph.get().getVertexInfos().size());
+        // try to add the same vertex again
+        
Assert.assertTrue(testingVertexGraphInfo.addVertexAsNew(testingVertexInfo).isEmpty());
+        // test remove vertex
+        addVertexAsNewGraph = 
testingVertexGraphInfo.removeVertex(testingVertexInfo);
+        Assert.assertTrue(addVertexAsNewGraph.isPresent());
+        Assert.assertEquals(0, 
addVertexAsNewGraph.get().getVertexInfos().size());

Review Comment:
   ignore
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to