Java 类com.typesafe.config.ConfigException.Missing 实例源码

项目:-deprecated-hlp-candidate    文件:ConfigurationTest.java   
@Test
public void testInvalidLevelDBConfig() throws Exception {
    missingKeys((k) -> {
                if ("database".equals(k)) return "datadir";
                else return 100;
            },
            "database", "cacheSize").forEach(badConfig -> {
        ConfigObject config = ConfigValueFactory.fromMap(Collections.emptyMap()).withValue("leveldb", badConfig);
        expectConfigError(Missing.class, () -> new LevelDBStoreFactory(config.toConfig()));
    });

    expectConfigError(WrongType.class, () -> new LevelDBStoreFactory(asConf("database: data, cacheSize: abc")));
}
项目:-deprecated-hlp-candidate    文件:ConfigurationTest.java   
@Test
public void testInvalidPruneSettings() throws Exception {
    expectConfigError(Missing.class, () -> new PrunerSettingsFactory(asConf("{ pruning: {} }")));

    missingKeys((s) -> 1,
            "pruneAfterEvery",
            "pruneOnlyLowerThanHeight",
            "doNotPruneTopBlocks",
            "pruneFrom").forEach((badConfig) -> {
        ConfigObject config = ConfigValueFactory.fromMap(Collections.emptyMap()).withValue("pruning", badConfig);
        expectConfigError(Missing.class, () -> new PrunerSettingsFactory(config.toConfig()));
    });
}
项目:-deprecated-hlp-candidate    文件:ConfigurationTest.java   
public void testInvalidBlockchainConfig() throws Exception {
    expectConfigError(Missing.class, () -> new CoreAssemblyFactory.ValidatorConfigFactory(asConf("")));
    expectConfigError(WrongType.class, () -> new CoreAssemblyFactory.ValidatorConfigFactory(asConf("blockchain: 1")));
    expectConfigError(Missing.class, () -> new CoreAssemblyFactory.ValidatorConfigFactory(asConf("blockchain: {}")));
    expectConfigError(BadValue.class, () -> new CoreAssemblyFactory.ValidatorConfigFactory(asConf("blockchain: {chain: slartibartfast}")));
}