@Test
  public void testCreateNodeAndAddToIndex() throws Exception {
    RestIndex<Node> index =
        restAPI.createIndex(Node.class, "index", LuceneIndexImplementation.FULLTEXT_CONFIG);
    final Transaction tx = restAPI.beginTx();

    Node n1 = restAPI.createNode(map());
    index.add(n1, "key", "value");

    tx.success();
    tx.finish();
    Node node = index.get("key", "value").getSingle();
    assertEquals("created node found in index", n1, node);
  }
  @Test(expected = RestResultException.class)
  public void testFailingCreateNodeAndAddToIndex() throws Exception {
    RestIndex<Node> index =
        restAPI.createIndex(
            Node.class,
            "index",
            MapUtil.stringMap(IndexManager.PROVIDER, "lucene", "type", "fulltext_ _"));
    final Transaction tx = restAPI.beginTx();

    Node n1 = restAPI.createNode(map());
    index.add(n1, "key", "value");

    tx.success();
    tx.finish();
    Node node = index.get("key", "value").getSingle();
    assertEquals("created node found in index", n1, node);
  }