@Test
public void subGraph() throws ReportException {

    Map<String, Object> virtualGraph = MapBuilder.<String, Object> builder() //
            .entry("role", "graph") //
            .entry("label", "Virtual Graph") //
            .entry("parent", getNeo4jNode(0l)) //
            .entry("nodes", singletonList(getNeo4jNode(1l))) //
            .entry("relationships", singletonList(getNeo4jRelationship(1l, "TEST"))) //
            .build();
    MapBuilder<String, Object> rowBuilder = MapBuilder.builder();
    Map<String, Object> row = rowBuilder.entry("graph", virtualGraph).build();
    Result<ExecutableRule> result = Result.builder().rows(singletonList(row)).build();
    SubGraph graph = factory.createSubGraph(result);
    assertThat(graph.getParent()).isNull();
    assertThat(graph.getNodes()).isEmpty();
    assertThat(graph.getRelationships()).isEmpty();
    Map<Long, SubGraph> subGraphs = graph.getSubGraphs();
    assertThat(subGraphs).hasSize(1);
    SubGraph subGraph = subGraphs.get(-2l);
    assertThat(subGraph.getId()).isEqualTo(-2l);
    assertThat(subGraph.getLabel()).isEqualTo("Virtual Graph");
    Node parent = subGraph.getParent();
    assertThat(parent).isNotNull();
    assertThat(parent.getId()).isEqualTo(0l);
    Map<Long, Node> nodes = subGraph.getNodes();
    assertThat(nodes).hasSize(1);
    Node node1 = nodes.get(1l);
    assertThat(node1.getId()).isEqualTo(1l);
    Map<Long, Relationship> relationships = subGraph.getRelationships();
    assertThat(relationships).hasSize(1);
    Relationship relationship1 = relationships.get(1l);
    assertThat(relationship1.getId()).isEqualTo(1l);
}