LevelDBWriteBatch implements AutoCloseable { @Override public void close() { checkWriteBatchOpen(); LevelDBNative.leveldb_writebatch_destroy(writeBatch); writeBatch = null; } LevelDBWriteBatch(); @Override void close(); void clear(); void put(byte[] key, byte[] value); void delete(byte[] key);  }
@Test public void create_and_close() { LevelDBWriteBatch writeBatch = new LevelDBWriteBatch(); writeBatch.close(); }
@Test(expected = LevelDBException.class) public void create_and_close_twice() { LevelDBWriteBatch writeBatch = new LevelDBWriteBatch(); writeBatch.close(); writeBatch.close(); }