Assert.assertEquals(v2, e.getVertex(Direction.IN));
}
@Test
public void edgeFromJsonIgnoreWeightValid() throws IOException, JSONException {
Graph g = new TinkerGraph();
ElementFactory factory = new GraphElementFactory(g);
Vertex v1 = GraphSONUtility.vertexFromJson(new JSONObject(new JSONTokener(vertexJson1)), factory, GraphSONMode.NORMAL, null);
Vertex v2 = GraphSONUtility.vertexFromJson(new JSONObject(new JSONTokener(vertexJson2)), factory, GraphSONMode.NORMAL, null);
Set<String> ignoreWeight = new HashSet<String>();
ignoreWeight.add("weight");
ElementPropertyConfig config = ElementPropertyConfig.excludeProperties(null, ignoreWeight);
GraphSONUtility utility = new GraphSONUtility(GraphSONMode.NORMAL, factory, config);
Edge e = utility.edgeFromJson(new JSONObject(new JSONTokener(edgeJson)), v1, v2);
Assert.assertSame(v1, g.getVertex(1));
Assert.assertSame(v2, g.getVertex(2));
Assert.assertSame(e, g.getEdge(7));
// tinkergraph converts id to string
Assert.assertEquals("7", e.getId());
Assert.assertNull(e.getProperty("weight"));
Assert.assertEquals("knows", e.getLabel());