private static void metricsConfig(XmlGenerator gen, Config config) {
        MetricsConfig metricsConfig = config.getMetricsConfig();
        gen.open("metrics", "enabled", metricsConfig.isEnabled())
                .open("management-center", "enabled", metricsConfig.getManagementCenterConfig().isEnabled())
                .node("retention-seconds", metricsConfig.getManagementCenterConfig().getRetentionSeconds())
                .close()
                .open("jmx", "enabled", metricsConfig.getJmxConfig().isEnabled())
                .close()
                .node("collection-frequency-seconds", metricsConfig.getCollectionFrequencySeconds())
                .close();
    }
@Test
    public void testMetricsConfig() {
        Config config = new Config();

        config.getMetricsConfig()
                .setEnabled(false)
                .setCollectionFrequencySeconds(10);

        config.getMetricsConfig().getManagementCenterConfig()
                .setEnabled(false)
                .setRetentionSeconds(11);

        config.getMetricsConfig().getJmxConfig()
                .setEnabled(false);

        MetricsConfig generatedConfig = getNewConfigViaXMLGenerator(config).getMetricsConfig();
        assertTrue(generatedConfig + " should be compatible with " + config.getMetricsConfig(),
                new MetricsConfigChecker().check(config.getMetricsConfig(), generatedConfig));
    }