@Test public void testPropertyLoader() { PropertyLoader.getInstance().init("TraverserTests.properties"); Assert.assertNotNull(PropertyLoader.getInstance().getProperty("FileTraverser.basePath")); Assert.assertNotNull(PropertyLoader.getInstance().getProperty("HDFSTraverser.basePath")); PropertyLoader.getInstance().setProperty("test", "test1"); Assert.assertEquals(PropertyLoader.getInstance().getProperty("test"), "test1"); System.setProperty("test1", "test2"); Assert.assertEquals(PropertyLoader.getInstance().getProperty("test1"), "test2"); Assert.assertNull(PropertyLoader.getInstance().getProperty("test2")); try { PropertyLoader.getInstance().init(null); Assert.fail(); } catch(IllegalArgumentException e) { } try { PropertyLoader.getInstance().init("abc"); Assert.fail(); } catch(Exception e) { } }
private PropertyLoader() { }
PropertyLoader { private PropertyLoader() { } }
PropertyLoader { private PropertyLoader() { } private  PropertyLoader(); }
PropertyLoader { private PropertyLoader() { } private  PropertyLoader(); static PropertyLoader getInstance(); void init(String path); String getProperty(String key); void setProperty(String key, String value); Set<Object> getKeySet(); }
PropertyLoader { private PropertyLoader() { } private  PropertyLoader(); static PropertyLoader getInstance(); void init(String path); String getProperty(String key); void setProperty(String key, String value); Set<Object> getKeySet();  }