@Test
  public void testAddToIndex() {
    final MatrixDataGraph matrixDataGraph = new MatrixDataGraph(getGraphDatabase());
    matrixDataGraph.createNodespace();
    final RestNode neoNode = restAPI.getNodeById(matrixDataGraph.getNeoNode().getId());

    final Transaction tx = restAPI.beginTx();
    restAPI.index().forNodes("heroes").add(neoNode, "indexname", "Neo2");
    Node n1 = restAPI.createNode(map("name", "Apoc"));
    final Index<Node> index = restAPI.index().forNodes("heroes");
    index.add(n1, "indexname", "Apoc");
    final Node indexResult =
        getGraphDatabase().index().forNodes("heroes").get("indexname", "Neo2").getSingle();
    assertNull(indexResult);
    final IndexHits<Node> heroes = index.query("indexname:Apoc");
    tx.success();
    tx.finish();
    assertEquals("1 hero", 1, heroes.size());
    IndexManager realIndex = getGraphDatabase().index();
    Index<Node> goodGuys = realIndex.forNodes("heroes");
    IndexHits<Node> hits = goodGuys.get("indexname", "Apoc");
    Node apoc = hits.getSingle();

    assertEquals("Apoc indexed", apoc, heroes.iterator().next());
  }