AppConstants extends Properties implements Serializable { public static void removeInstance() { removeInstance(AppConstants.class.getClassLoader()); } private  AppConstants(ClassLoader classLoader); static AppConstants getInstance(); static synchronized AppConstants getInstance(final ClassLoader cl); static void removeInstance(); static synchronized void removeInstance(final ClassLoader cl); @Override String get(Object key); @Override String getProperty(String key); String getUnresolvedProperty(String key); String getResolvedProperty(String key); StringTokenizer getTokenizedProperty(String key); StringTokenizer getTokenizedProperty(String key, String defaults); Properties getAppConstants(String keyBase); Properties getAppConstants(String keyBase, boolean useSystemProperties, boolean useEnvironmentVariables); @Deprecated @Override synchronized Object put(Object key, Object value); @Override Object setProperty(String key, String value); Object setProperty(String key, boolean value); void put(String key, String value); @Deprecated String toXml(); @Deprecated String toXml(boolean resolve); String getString(String key, String dfault); boolean getBoolean(String key, boolean dfault); int getInt(String key, int dfault); long getLong(String key, long dfault); double getDouble(String key, double dfault); void setVariableExpander(VariableExpander expander); VariableExpander getVariableExpander(); static final String APPLICATION_SERVER_TYPE_PROPERTY; }
@Test public void removeInstance() { AppConstants old = AppConstants.getInstance(); old.put("dummy-key", "1"); AppConstants.removeInstance(); assertFalse("should not contain key [dummy-key]", AppConstants.getInstance().contains("dummy-key")); }
@Test(expected=IllegalStateException.class) public void callRemoveInstanceWithoutClassLoader() { AppConstants.removeInstance(null); }