package com.proofpoint.testing;

import static com.google.common.collect.Maps.fromProperties;
import static com.google.common.io.Resources.getResource;

import java.io.IOException;
import java.util.Map;
import java.util.Properties;

public final class ConfigurationUtils
{
    private ConfigurationUtils()
    {
    }

    /**
     * Load a properties file from the class path and return as a Map suitable for a configuration factory.
     */
    public static Map<String, String> loadPropertiesFromClasspath(String path) throws IOException
    {
        Properties properties = new Properties();
        properties.load(getResource(ConfigurationUtils.class, path).openStream());
        return fromProperties(properties);
    }
}

Add a config loader for the classpath.
Add a config loader for the classpath.

Allows loading a properties object from the classpath and expose the
result as a Map suitable for a Configuration factory.
