LevelDB implements AutoCloseable { public String property(String property) { checkDatabaseOpen(); return LevelDBNative.leveldb_property_value(levelDB, property); } LevelDB(String levelDBDirectory, LevelDBOptions options); void close(); byte[] get(byte[] key, LevelDBReadOptions readOptions); void put(byte[] key, byte[] value, LevelDBWriteOptions writeOptions); void write(LevelDBWriteBatch writeBatch, LevelDBWriteOptions writeOptions); void delete(byte[] key, LevelDBWriteOptions writeOptions); String property(String property); long[] approximateSizes(Range ...ranges); void compactRange(byte[] startKey, byte[] limitKey); static void repair(String levelDBDirectory, LevelDBOptions options); static void destroy(String levelDBDirectory, LevelDBOptions options); static int majorVersion(); static int minorVersion();  }
@Test public void get_unknown_property() { try(LevelDBOptions options = new LevelDBOptions()) { options.setCreateIfMissing(true); try (LevelDB levelDB = new LevelDB(testFolder.getRoot().getAbsolutePath(), options)) { String result = levelDB.property("unknown-property"); Assert.assertEquals(null, result); } } }
@Test public void get_known_property() { try(LevelDBOptions options = new LevelDBOptions()) { options.setCreateIfMissing(true); try (LevelDB levelDB = new LevelDB(testFolder.getRoot().getAbsolutePath(), options)) { String result = levelDB.property("leveldb.stats"); Assert.assertNotEquals(null, result); } } }