PropertyHelper { public static String getPropertyIgnoringCase(Properties p, String key, String defaultValue) { String value = defaultValue; for (Object keyObj : p.keySet()) { String propKey = keyObj.toString(); if (propKey.equalsIgnoreCase(key)) { value = p.getProperty(propKey); } } return value; }  static Properties getPropertySubset(Properties p, String prefix); static Properties getPropertySubset(Properties p, String prefix, boolean ignoreCase); static String getPropertyIgnoringCase(Properties p, String key, String defaultValue); static Map<String, String> asMap(Properties p); static String getPropertyIgnoringCase(Properties p, String key); static Properties loadQuietly(final File file); static Properties loadQuietly(final String resource); static Properties loadQuietly(final ClassLoader cl, final String resource); static Properties loadQuietly(final URL resource); static Properties loadQuietly(final InputStream in); static Properties loadQuietly(PropertyInputStream e); static Properties load(PropertyInputStream e);  }
@Test public void testGetPropertyIgnoringCasePropertiesStringString() { assertEquals("a.value", getPropertyIgnoringCase(createTestSample(), "A.KEY", "defaultValue")); assertEquals("defaultValue", getPropertyIgnoringCase(createTestSample(), "BLAH", "defaultValue")); }
@Test public void testGetPropertyIgnoringCasePropertiesString() { assertEquals("a.value", getPropertyIgnoringCase(createTestSample(), "A.KEY")); assertNull(getPropertyIgnoringCase(createTestSample(), "BLAH")); }