MapConfiguration extends AbstractConfiguration { @Override public String getProperty(String key) { if (containsKey(key)) { return configMap.get(key); } else { super.missingMessage(key); throw new NoSuchElementException(doesNotMapMessage(key)); } } MapConfiguration();  MapConfiguration(Map<String, String> configMap);  MapConfiguration(Configuration config); @Override Configuration subset(String prefix); @Override Configuration strippedSubset(String prefix); static MapConfiguration merge(Configuration ... configs); @Override boolean isEmpty(); @Override boolean containsKey(String key); @Override void setProperty(String key, String value); @Override void clear(); @Override void clearProperty(String key); @Override Iterable<String> getKeys(); @Override String getProperty(String key); @Override String getProperty(String key, String defaultValue); @Override String toString();  }
@Test public void testGetMissingProperty() { Throwable t = assertThrows(NoSuchElementException.class, () -> config.getProperty("x")); assertEquals(config.doesNotMapMessage("x"), t.getMessage()); }
@Test public void testGetPropertyWithDefault() { assertEquals("z", config.getProperty("x", "z")); }