TierModule extends AbstractModule { @VisibleForTesting static TierConfig parseTierConfig(String config) { checkArgument(!Strings.isNullOrEmpty(config), "configuration cannot be empty"); try { return new ObjectMapper().readValue(config, TierConfig.class); } catch (IOException e) { LOG.error("Error parsing tier configuration file."); throw Throwables.propagate(e); } } TierModule(); @VisibleForTesting  TierModule(TierConfig tierConfig);   }
@Test(expected = IllegalArgumentException.class) public void testEmptyTierConfigFile() { parseTierConfig(""); }
@Test public void testTierConfigFile() { assertEquals( ImmutableMap.of("revocable", REVOCABLE_TIER), parseTierConfig( "{\"tiers\":{" + "\"revocable\": {\"revocable\": true, \"preemptible\": true}" + "}}") .getTiers()); }
@Test(expected = RuntimeException.class) public void testTierConfigExtraKeysNotAllowed() { parseTierConfig("{\"tiers\":{\"revocable\": {\"revocable\": true, \"foo\": false}}}"); }