private static String getProperty(String name, Configuration configuration) {
    return Optional.of(configuration.getStringArray(relaxPropertyName(name)))

        .filter(values -> values.length > 0)

        .map(Arrays::stream)

        .map(stream -> stream.collect(Collectors.joining(",")))

        .orElse(null);
  }
@Test
  public void assertPropertyPriorities()
      throws IOException {
    Map<String, Object> baseProperties = new HashMap<>();
    Map<String, String> mockedEnvironmentVariables = new HashMap<>();

    String configFile2 = File.createTempFile("pinot-configuration-test-2", ".properties").getAbsolutePath();
    String configFile3 = File.createTempFile("pinot-configuration-test-3", ".properties").getAbsolutePath();

    baseProperties.put("controller.host", "cli-argument-controller-host");
    baseProperties.put("config.paths", "classpath:/pinot-configuration-1.properties");
    mockedEnvironmentVariables.put("CONFIG_PATHS", configFile2 + "," + configFile3);

    copyClasspathResource("/pinot-configuration-2.properties", configFile2);
    copyClasspathResource("/pinot-configuration-3.properties", configFile3);

    PinotConfiguration configuration = new PinotConfiguration(baseProperties, mockedEnvironmentVariables);

    // Tests that cli arguments have the highest priority.
    Assert.assertEquals(configuration.getProperty("controller.host"), "cli-argument-controller-host");

    // Tests that config.paths properties provided through cli arguments are prioritized.
    Assert.assertEquals(configuration.getProperty("controller.cluster-name"), "config-path-1-cluster-name");

    // Tests that config.paths properties provided through environment variables are available.
    Assert.assertEquals(configuration.getProperty("controller.timeout"), "config-path-2-timeout");

    // Tests a priority of a property available in both config files of a config.paths array.
    Assert.assertEquals(configuration.getProperty("controller.config-paths-multi-value-test-1"),
        "config-path-2-config-paths-multi-value-test-1");

    // Tests properties provided through the last config file of a config.paths array.
    Assert.assertEquals(configuration.getProperty("controller.config-paths-multi-value-test-2"),
        "config-path-3-config-paths-multi-value-test-2");
  }