@Test
  public void testGetFloatInRange() {
    Properties properties = new Properties();
    VerifiableProperties verifiableProperties = new VerifiableProperties(properties);
    String propertyName = "TEST";
    float defaultVal = 5.0f;
    // test for default value.
    Float result = verifiableProperties.getFloatInRange(propertyName, defaultVal, 0.0f, 10.0f);
    Assert.assertEquals(result, defaultVal, 0.001);

    // test outside range value.
    properties.setProperty(propertyName, "11.0");
    try {
      verifiableProperties.getFloatInRange(propertyName, defaultVal, 0.0f, 10.0f);
      Assert.fail("Value outside range should fail.");
    } catch (IllegalArgumentException ignored) {
    }

    // test invalid float value.
    properties.setProperty(propertyName, "string");
    try {
      verifiableProperties.getFloatInRange(propertyName, defaultVal, 0.0f, 10.0f);
      Assert.fail("Value outside range should fail.");
    } catch (NumberFormatException ignored) {
    }

    // test valid float value.
    properties.setProperty(propertyName, "9.0");
    result = verifiableProperties.getFloatInRange(propertyName, defaultVal, 0.0f, 10.0f);
    Assert.assertEquals(result, 9.0f, 0.001);
  }
Test for methods on {@link VerifiableProperties} class.
ambry-api/src/test/java/com/github/ambry/config/VerifiablePropertiesTest.java