MotechExtenderConfigFactory implements FactoryBean<Properties> { @Override public Properties getObject() { Properties extenderConfig = new Properties(); String waitTime = System.getProperty(DEP_WAIT_TIME_ENV); if (StringUtils.hasText(waitTime)) { extenderConfig.put(DEP_WAIT_TIME_KEY, waitTime); } return extenderConfig; }  @Override Properties getObject(); @Override Class<?> getObjectType(); @Override boolean isSingleton(); static final String DEP_WAIT_TIME_ENV; static final String DEP_WAIT_TIME_KEY; }
@Test public void shouldReturnPropertiesWithTimeout() { try { System.setProperty(MotechExtenderConfigFactory.DEP_WAIT_TIME_ENV, "30000"); Properties extenderCfg = new MotechExtenderConfigFactory().getObject(); assertEquals(1, extenderCfg.size()); assertEquals("30000", extenderCfg.getProperty(MotechExtenderConfigFactory.DEP_WAIT_TIME_KEY)); } finally { System.clearProperty(MotechExtenderConfigFactory.DEP_WAIT_TIME_ENV); } }