@Test
public void testExecute() throws Exception {

    // GIVEN
    final Node n1 = graphElementFactory.createNode("n1", Arrays.asList("A"),
            ImmutableMap.<String, Object>builder().put("id", 1l).put("value", "A").build());
    final Node n2 = graphElementFactory.createNode("n2", Arrays.asList("A"),
            ImmutableMap.<String, Object>builder().put("id", 2l).build());
    final Edge e1 = graphElementFactory.createEdge(n1, n2, "e1", Arrays.asList("E"),
            ImmutableMap.<String, Object>builder().put("id", 3l).put("value", "C").build());
    final Graph<Node, Edge> graph = new DefaultDirectedGraph<>(new ClassBasedEdgeFactory<>(Edge.class));
    graph.addVertex(n1);
    graph.addVertex(n2);
    graph.addEdge(e1.getSourceNode(), e1.getTargetNode(), e1);
    // WHEN
    operation.execute(connection, graph);
    // THEN
    final ArgumentCaptor<String> queryCaptor = ArgumentCaptor.forClass(String.class);
    verify(operation, times(2)).executeQuery(eq(connection), queryCaptor.capture());
    final List<String> queries = queryCaptor.getAllValues();
    assertThat(queries.get(0), containsString("MATCH (n1:A {id:1}) SET n1.value=\"A\""));
    assertThat(queries.get(1), containsString("MATCH (n1:A {id:1}),(n2:A {id:2}) MERGE (n1)-[e1:E]->(n2) SET e1.id=3,e1.value=\"C\""));
}