public static Option<String> getRawValueWithAltKeys(Configuration conf,
                                                      ConfigProperty<?> configProperty) {
    String value = conf.get(configProperty.key());
    if (value != null) {
      return Option.of(value);
    }
    for (String alternative : configProperty.getAlternatives()) {
      String altValue = conf.get(alternative);
      if (altValue != null) {
        LOG.warn(String.format("The configuration key '%s' has been deprecated "
                + "and may be removed in the future. Please use the new key '%s' instead.",
            alternative, configProperty.key()));
        return Option.of(altValue);
      }
    }
    return Option.empty();
  }
@Test
  public void testGetRawValueWithAltKeysFromHadoopConf() {
    Configuration conf = new Configuration();
    assertEquals(Option.empty(), getRawValueWithAltKeys(conf, TEST_BOOLEAN_CONFIG_PROPERTY));

    boolean setValue = !Boolean.parseBoolean(TEST_BOOLEAN_CONFIG_PROPERTY.defaultValue());
    conf.setBoolean(TEST_BOOLEAN_CONFIG_PROPERTY.key(), setValue);
    assertEquals(Option.of(String.valueOf(setValue)),
        getRawValueWithAltKeys(conf, TEST_BOOLEAN_CONFIG_PROPERTY));

    conf = new Configuration();
    conf.setBoolean(TEST_BOOLEAN_CONFIG_PROPERTY.getAlternatives().get(0), setValue);
    assertEquals(Option.of(String.valueOf(setValue)),
        getRawValueWithAltKeys(conf, TEST_BOOLEAN_CONFIG_PROPERTY));
  }