CompatibleConfigFileFormat implements ConfigFile { @Override public String readValue(String key) { return readValue(key, ""); } CompatibleConfigFileFormat(ObjectMapper objectMapper, File configFile); @Override synchronized void writeValue(String key, String value); @Override String readValue(String key); @Override boolean contains(String key); @Override synchronized String readValue(String key, String defaultValue); @Override synchronized void deleteValue(String key);  }
@Test public void testReadValueLegacyFile() { final CompatibleConfigFileFormat compatibleConfigFileFormat = new CompatibleConfigFileFormat(new ObjectMapper(), tmpLegacy); assertEquals("x86", compatibleConfigFileFormat.readValue("ARCH")); assertEquals("1.7.33", compatibleConfigFileFormat.readValue("VERSION")); }
@Test public void testReadValueLegacyFileContainsEquals() { final CompatibleConfigFileFormat compatibleConfigFileFormat = new CompatibleConfigFileFormat(new ObjectMapper(), tmpLegacy); assertEquals("test=test", compatibleConfigFileFormat.readValue("TEST")); }
@Test public void testReadValueLegacyFileUnexisting() { final CompatibleConfigFileFormat compatibleConfigFileFormat = new CompatibleConfigFileFormat(new ObjectMapper(), tmpLegacy); assertEquals("", compatibleConfigFileFormat.readValue("unexisting")); assertEquals("default", compatibleConfigFileFormat.readValue("unexisting", "default")); }
@Test public void testReadValueJsonFile() { final CompatibleConfigFileFormat compatibleConfigFileFormat = new CompatibleConfigFileFormat(new ObjectMapper(), tmpNew); assertEquals("I386", compatibleConfigFileFormat.readValue("architecture")); assertEquals("1.7.35", compatibleConfigFileFormat.readValue("version")); }
@Test public void testReadValueJsonFileUnexisting() { final CompatibleConfigFileFormat compatibleConfigFileFormat = new CompatibleConfigFileFormat(new ObjectMapper(), tmpNew); assertEquals("", compatibleConfigFileFormat.readValue("unexisting")); assertEquals("default", compatibleConfigFileFormat.readValue("unexisting", "default")); }