private static Config loadFromFile(Properties properties) {
        validateSuffixInSystemProperty(SYSPROP_MEMBER_CONFIG);

        XmlConfigLocator xmlConfigLocator = new XmlConfigLocator();
        YamlConfigLocator yamlConfigLocator = new YamlConfigLocator();

        if (xmlConfigLocator.locateFromSystemProperty()) {
            // 1. Try loading XML config from the configuration provided in system property
            return new XmlConfigBuilder(xmlConfigLocator).setProperties(properties).build();
        } else if (yamlConfigLocator.locateFromSystemProperty()) {
            // 2. Try loading YAML config from the configuration provided in system property
            return new YamlConfigBuilder(yamlConfigLocator).setProperties(properties).build();
        } else if (xmlConfigLocator.locateInWorkDirOrOnClasspath()) {
            // 3. Try loading XML config from the working directory or from the classpath
            return new XmlConfigBuilder(xmlConfigLocator).setProperties(properties).build();
        } else if (yamlConfigLocator.locateInWorkDirOrOnClasspath()) {
            // 4. Try loading YAML config from the working directory or from the classpath
            return new YamlConfigBuilder(yamlConfigLocator).setProperties(properties).build();
        } else {
            // 5. Loading the default XML configuration file
            xmlConfigLocator.locateDefault();
            return new XmlConfigBuilder(xmlConfigLocator).setProperties(properties).build();
        }
    }
@Test
    public void testLoadFromFile() throws IOException {
        File file = createTempFile("foo", "cfg.xml");
        file.deleteOnExit();

        String randStr = randomString();
        String xml = getSimpleXmlConfigStr("license-key", randStr);

        Writer writer = new PrintWriter(file);
        writer.write(xml);
        writer.close();

        Config cfg = Config.loadFromFile(file);
        assertEquals(randStr, cfg.getLicenseKey());
    }