@Test public void testGetLocatorCacheTimeUnit() { expect(iniFile.getStringValue(LocatorConfigurationImpl.LOCATOR_CACHE_TIMEUNIT_KEY)) .andReturn("hours"); control.replay(); TimeUnit locatorCacheTimeUnit = locatorConfigurationImpl.getLocatorCacheTimeUnit(); control.verify(); assertThat(locatorCacheTimeUnit).isEqualTo(TimeUnit.HOURS); }
@Test public void testGetLocatorUrl() throws Exception { String host = "10.69.1.23"; expect(iniFile.getStringValue(LocatorConfigurationImpl.LOCATOR_HOST_KEY)).andReturn(host); control.replay(); String locatorUrl = locatorConfigurationImpl.getLocatorUrl(); control.verify(); assertThat(locatorUrl).isEqualTo("http://" + host + ":8084/obm-locator/"); }
@Test(expected = ConfigurationException.class) public void testGetLocatorUrlThrowsConfigurationException() throws Exception { expect(iniFile.getStringValue(LocatorConfigurationImpl.LOCATOR_HOST_KEY)).andReturn(null); control.replay(); try { locatorConfigurationImpl.getLocatorUrl(); } catch (Exception e) { control.verify(); throw e; } }
@Test public void testGetLocatorClientTimeoutInSeconds() { int expectedLocatorClientTimeoutInSeconds = 10; expect( iniFile.getIntValue( LocatorConfigurationImpl.LOCATOR_CLIENT_TIMEOUT_KEY, LocatorConfigurationImpl.LOCATOR_CLIENT_TIMEOUT_DEFAULT)) .andReturn(expectedLocatorClientTimeoutInSeconds); control.replay(); int locatorClientTimeoutInSeconds = locatorConfigurationImpl.getLocatorClientTimeoutInSeconds(); control.verify(); assertThat(locatorClientTimeoutInSeconds).isEqualTo(expectedLocatorClientTimeoutInSeconds); }
@Test public void testGetLocatorCacheTimeout() { int expectedLocatorCacheTimeout = 10; expect( iniFile.getIntValue( LocatorConfigurationImpl.LOCATOR_CACHE_TIMEOUT_KEY, LocatorConfigurationImpl.LOCATOR_CACHE_TIMEOUT_DEFAULT)) .andReturn(expectedLocatorCacheTimeout); control.replay(); int locatorCacheTimeout = locatorConfigurationImpl.getLocatorCacheTimeout(); control.verify(); assertThat(locatorCacheTimeout).isEqualTo(expectedLocatorCacheTimeout); }