@Test
public void testCreateEdge() throws NoSuchClassException {

    // GIVEN
    final String nodeAId = "a";
    final List<String> nodeALabels = Arrays.asList("A");
    final Map<String, Object> nodeAAttributes = ImmutableMap.<String, Object>builder().put("id", 1l).put("value", "foo").build();
    final String nodeBId = "b";
    final List<String> nodeBLabels = Arrays.asList("A");
    final Map<String, Object> nodeBAttributes = ImmutableMap.<String, Object>builder().put("id", 2l).put("value", "boo").build();
    final String edgeId = "e";
    final List<String> edgeLabels = Arrays.asList("edge");
    final Map<String, Object> edgeAttributes = ImmutableMap.<String, Object>builder().put("value", "moo").build();
    final Node nodeA = factory.createNode(nodeAId, nodeALabels, nodeAAttributes);
    final Node nodeB = factory.createNode(nodeBId, nodeBLabels, nodeBAttributes);
    // WHEN
    final Edge edge = factory.createEdge(nodeA, nodeB, edgeId, edgeLabels, edgeAttributes);
    // THEN
    assertThat(edge, notNullValue());
    assertThat(edge.getId(), equalTo(edgeId));
    assertThat(edge.getLabels(), equalTo(edgeLabels));
    assertThat(edge.getAttributes().size(), equalTo(1));
    assertThat(edge.getSourceNode(), equalTo(nodeA));
    assertThat(edge.getTargetNode(), equalTo(nodeB));
    final Attribute idAttribute = edge.getAttributes().get(0);
    assertThat(idAttribute.getName(), equalTo("value"));
    assertThat(idAttribute.getValue(), equalTo("moo"));
    assertThat(idAttribute.isId(), equalTo(Boolean.FALSE));
}