@Test
  public void iterableAcquiredInTransactionShouldBeProcessed() {
    try (Transaction tx = database.beginTx()) {
      for (int i = 0; i < 100; i++) {
        database.createNode();
      }
      tx.success();
    }

    BatchTransactionExecutor executor =
        new IterableInputBatchTransactionExecutor<>(
            database,
            10,
            new AllNodes(database, 10),
            new UnitOfWork<Node>() {
              @Override
              public void execute(
                  GraphDatabaseService database, Node node, int batchNumber, int stepNumber) {
                node.setProperty("name", "Name" + batchNumber + stepNumber);
              }
            });

    executor.execute();

    try (Transaction tx = database.beginTx()) {
      assertEquals("Name11", database.getNodeById(0).getProperty("name"));
      assertEquals("Name12", database.getNodeById(1).getProperty("name"));
      assertEquals("Name13", database.getNodeById(2).getProperty("name"));
      assertEquals("Name108", database.getNodeById(97).getProperty("name"));
      assertEquals("Name109", database.getNodeById(98).getProperty("name"));
      assertEquals("Name1010", database.getNodeById(99).getProperty("name"));
    }
  }
  @Test
  public void nodesShouldBeCreatedFromListOfNames() {
    List<String> nodeNames = Arrays.asList("Name1", "Name2", "Name3");

    BatchTransactionExecutor executor =
        new IterableInputBatchTransactionExecutor<>(
            database,
            2,
            nodeNames,
            new UnitOfWork<String>() {
              @Override
              public void execute(
                  GraphDatabaseService database, String nodeName, int batchNumber, int stepNumber) {
                Node node = database.createNode();
                node.setProperty("name", nodeName + batchNumber + stepNumber);
              }
            });

    executor.execute();

    try (Transaction tx = database.beginTx()) {
      assertEquals(3, countNodes(database));
      assertEquals("Name111", database.getNodeById(0).getProperty("name"));
      assertEquals("Name212", database.getNodeById(1).getProperty("name"));
      assertEquals("Name321", database.getNodeById(2).getProperty("name"));
    }
  }