@Test
public void serializeEdge() throws Exception {
final Graph g = TinkerGraph.open();
final Vertex v1 = g.addVertex();
final Vertex v2 = g.addVertex();
final Edge e = v1.addEdge("test", v2);
e.property("abc", 123);
final Iterable<Edge> iterable = g.E().toList();
final String results = SERIALIZER.serializeResponseAsString(ResponseMessage.build(msg).result(iterable).create());
final JSONObject json = new JSONObject(results);
assertNotNull(json);
assertEquals(msg.getRequestId().toString(), json.getString(SerTokens.TOKEN_REQUEST));
final JSONArray converted = json.getJSONObject(SerTokens.TOKEN_RESULT).getJSONArray(SerTokens.TOKEN_DATA);
assertNotNull(converted);
assertEquals(1, converted.length());
final JSONObject edgeAsJson = converted.optJSONObject(0);
assertNotNull(edgeAsJson);
assertEquals(((Long) e.id()).intValue(), edgeAsJson.get(GraphSONTokens.ID)); // lossy
assertEquals(((Long) v1.id()).intValue(), edgeAsJson.get(GraphSONTokens.OUT));// lossy
assertEquals(((Long) v2.id()).intValue(), edgeAsJson.get(GraphSONTokens.IN)); // lossy
assertEquals(e.label(), edgeAsJson.get(GraphSONTokens.LABEL));
assertEquals(GraphSONTokens.EDGE, edgeAsJson.get(GraphSONTokens.TYPE));
final JSONObject properties = edgeAsJson.optJSONObject(GraphSONTokens.PROPERTIES);
assertNotNull(properties);
assertEquals(123, properties.getInt("abc"));