AbstractConfig { public Map<String, Object> originalsWithPrefix(String prefix) { Map<String, Object> result = new RecordingMap<>(); for (Map.Entry<String, ?> entry : originals.entrySet()) { if (entry.getKey() .startsWith(prefix) && entry.getKey() .length() > prefix.length()) { result.put(entry.getKey() .substring(prefix.length()), entry.getValue()); } } return result; } @SuppressWarnings("unchecked")  AbstractConfig(ConfigDef definition, Map<?, ?> originals, boolean doLog);  AbstractConfig(ConfigDef definition, Map<?, ?> originals);  AbstractConfig(Map<String, Object> parsedConfig); void ignore(String key); Short getShort(String key); Integer getInt(String key); Long getLong(String key); Double getDouble(String key); @SuppressWarnings("unchecked") List<String> getList(String key); Boolean getBoolean(String key); String getString(String key); Password getPassword(String key); Class<?> getClass(String key); Set<String> unused(); Map<String, Object> originals(); Map<String, String> originalsStrings(); Map<String, Object> originalsWithPrefix(String prefix); Map<String, ?> values(); void logUnused(); T getConfiguredInstance(String key, Class<T> t); List<T> getConfiguredInstances(String key, Class<T> t); @Override boolean equals(Object o); @Override int hashCode();  }
@Test public void testOriginalsWithPrefix() { Properties props = new Properties(); props.put("foo.bar", "abc"); props.put("setting", "def"); TestConfig config = new TestConfig(props); Map<String, Object> expected = new HashMap<>(); expected.put("bar", "abc"); assertEquals(expected, config.originalsWithPrefix("foo.")); }