コード例 #1
0
  @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/");
  }
コード例 #2
0
  @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);
  }
コード例 #3
0
  @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;
    }
  }