Configuration { public static Map<String, String> getSiblings(final String prefix) { try { lock.readLock().lock(); frozen = true; Map<String, String> map = new HashMap<String, String>(); for (Enumeration<Object> enumeration = properties.keys(); enumeration.hasMoreElements();) { String key = (String) enumeration.nextElement(); if (key.startsWith(prefix) && (prefix.endsWith("@") || key.indexOf('.', prefix.length()) == -1)) { map.put(key, (String) properties.get(key)); } } return map; } finally { lock.readLock().unlock(); } } private  Configuration(); static Locale getLocale(); static boolean isEscapingEnabled(); static String get(final String key); static Map<String, String> getSiblings(final String prefix); static Map<String, String> getChildren(final String key); static void set(final String key, final String value); static void replace(final Map<String, String> configuration); static String resolve(final String value, final Resolver resolver); static void mergeSystemProperties(final Properties properties); static void resolveProperties(final Properties properties, final Resolver... resolvers); static boolean isFrozen();  }
@Test public void foundSiblings() throws Exception { loadProperties(FileSystem.createTemporaryFile("level = info", "writer = console", "writer2 = file", "writer2.file = log.txt")); assertThat(Configuration.getSiblings("writer")).containsOnly(entry("writer", "console"), entry("writer2", "file")); }
@Test public void foundSiblingsWithAtSign() throws Exception { loadProperties(FileSystem.createTemporaryFile("level = info", "level@org.test = trace", "level@com = info")); assertThat(Configuration.getSiblings("level@")) .containsOnly(entry("level@org.test", "trace"), entry("level@com", "info")); }
@Test public void noSiblings() throws Exception { loadProperties(FileSystem.createTemporaryFile("level = info")); assertThat(Configuration.getSiblings("writer")).isEmpty(); }