### Question:
DBConfigFromFile { public static DBOptions readFromFile(String dbFileName, List<ColumnFamilyDescriptor> cfDescs) throws IOException { Preconditions.checkNotNull(dbFileName); Preconditions.checkNotNull(cfDescs); Preconditions.checkArgument(cfDescs.size() > 0); Env env = Env.getDefault(); DBOptions options = null; File configLocation = getConfigLocation(); if(configLocation != null && StringUtil.isNotBlank(configLocation.toString())){ Path optionsFile = Paths.get(configLocation.toString(), getOptionsFileNameFromDB(dbFileName)); if (optionsFile.toFile().exists()) { options = new DBOptions(); try { OptionsUtil.loadOptionsFromFile(optionsFile.toString(), env, options, cfDescs, true); } catch (RocksDBException rdEx) { RDBTable.toIOException("Unable to find/open Options file.", rdEx); } } } return options; } private  DBConfigFromFile(); static File getConfigLocation(); static String getOptionsFileNameFromDB(String dbFileName); static DBOptions readFromFile(String dbFileName,
      List<ColumnFamilyDescriptor> cfDescs); static final String CONFIG_DIR; }### Answer:
@Test public void readFromFile() throws IOException { final List<String> families = Arrays.asList(StringUtils.bytes2String(RocksDB.DEFAULT_COLUMN_FAMILY), "First", "Second", "Third", "Fourth", "Fifth", "Sixth"); final List<ColumnFamilyDescriptor> columnFamilyDescriptors = new ArrayList<>(); for (String family : families) { columnFamilyDescriptors.add( new ColumnFamilyDescriptor(family.getBytes(StandardCharsets.UTF_8), new ColumnFamilyOptions())); } final DBOptions options = DBConfigFromFile.readFromFile(DB_FILE, columnFamilyDescriptors); Assert.assertNotNull(options); Assert.assertEquals(551615L, options.maxManifestFileSize()); Assert.assertEquals(1000L, options.keepLogFileNum()); Assert.assertEquals(1048576, options.writableFileMaxBufferSize()); }
@Test public void readFromFileInvalidConfig() throws IOException { final List<String> families = Arrays.asList(StringUtils.bytes2String(RocksDB.DEFAULT_COLUMN_FAMILY), "First", "Second", "Third", "Fourth", "Fifth", "Sixth"); final List<ColumnFamilyDescriptor> columnFamilyDescriptors = new ArrayList<>(); for (String family : families) { columnFamilyDescriptors.add( new ColumnFamilyDescriptor(family.getBytes(StandardCharsets.UTF_8), new ColumnFamilyOptions())); } final DBOptions options = DBConfigFromFile.readFromFile("badfile.db.ini", columnFamilyDescriptors); Assert.assertNull(options); }