public static Config loadFromStream(InputStream source) {
        return loadFromStream(source, System.getProperties());
    }
@Test
    public void testLoadFromStream() {
        InputStream xmlStream = new ByteArrayInputStream(
                getSimpleXmlConfigStr(
                        "instance-name", "hz-instance-name",
                        "cluster-name", "${cluster.name}"
                ).getBytes()
        );

        InputStream yamlStream = new ByteArrayInputStream(
                getSimpleYamlConfigStr(
                        "instance-name", "hz-instance-name",
                        "cluster-name", "${cluster.name}"
                ).getBytes()
        );

        String clusterName = randomName();
        Properties properties = new Properties();
        properties.setProperty("cluster.name", clusterName);

        Config cfg = Config.loadFromStream(xmlStream, properties);

        assertEquals(clusterName, cfg.getClusterName());
        assertEquals("hz-instance-name", cfg.getInstanceName());

        clusterName = randomName();
        properties.setProperty("cluster.name", clusterName);
        cfg = Config.loadFromStream(yamlStream, properties);

        assertEquals(clusterName, cfg.getClusterName());
        assertEquals("hz-instance-name", cfg.getInstanceName());

        // test for stream with > 4KB content
        final int instanceNameLen = 1 << 14;
        String instanceName = String.join("", Collections.nCopies(instanceNameLen, "x"));
        // wrap with BufferedInputStream (which is not resettable), so that ConfigStream
        // behaviour kicks in.
        yamlStream = new BufferedInputStream(new ByteArrayInputStream(
                getSimpleYamlConfigStr("instance-name", instanceName).getBytes())
        );

        cfg = Config.loadFromStream(yamlStream);
        assertEquals(instanceName, cfg.getInstanceName());
    }