@Test
    public void shouldLoadVerticesRDDWithInputRDD() {
        final JavaSparkContext sparkContext = getSparkContext();

        // load vertices with inputRDD config
        final Configuration sparkGraphConfiguration = new BaseConfiguration();
        sparkGraphConfiguration.setProperty(Constants.GREMLIN_HADOOP_GRAPH_READER, ExampleInputRDD.class.getCanonicalName());
        JavaPairRDD<Object, VertexWritable> verticesRDD = SparkIOUtil.loadVertices(sparkGraphConfiguration, sparkContext);
        assertEquals(4, verticesRDD.count());
        assertEquals(123, verticesRDD.values()
            .map(vertexWritable -> (int) vertexWritable.get().values("age").next())
            .reduce(Integer::sum).longValue());

        // load vertices with inputRDD object
        verticesRDD = SparkIOUtil.loadVertices(new ExampleInputRDD(), new BaseConfiguration(), sparkContext);
        assertEquals(4, verticesRDD.count());
        assertEquals(123, verticesRDD.values()
            .map(vertexWritable -> (int) vertexWritable.get().values("age").next())
            .reduce(Integer::sum).longValue());

        sparkContext.stop();
    }
@author Boxuan Li (https://li-boxuan.com)
spark-gremlin/src/test/java/org/apache/tinkerpop/gremlin/spark/structure/io/SparkRDDLoadTest.java