@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"))); }
@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())); }); }
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}"))); }