ApplicationConfig { public static Properties getPropsFromResource(String resourceName) { Properties props = new Properties(); AutoCloseInputStream in = new AutoCloseInputStream( ApplicationConfig.class.getClassLoader().getResourceAsStream(resourceName)); try { props.load(in); } catch (Exception e) { String error = "Unable to find resource: '" + resourceName + "': " + e.getMessage(); throw new RuntimeException(error, e); } return props; } protected  ApplicationConfig(); static Properties getPropsFromResource(String resourceName); static Properties getPropsFromXml(String propsXml); static Properties getPropsFromXmlStream(InputStream propsXmlStream); static Properties getPropsFromXmlResource(String resourceName); static String getXmlFromProps(Properties props);  }
@Test public void testGetPropsFromResource() throws Exception { Properties props = ApplicationConfig.getPropsFromResource("test.properties"); assertNotNull(props); assertEquals(val0, props.getProperty(key0)); assertEquals(val1, props.getProperty(key1)); }