ZKConfigBuilder { public static ZKConfig getZKConfig(Config config) { ZKConfig zkConfig = new ZKConfig(); zkConfig.zkQuorum = config.getString("zkConfig.zkQuorum"); zkConfig.zkRoot = config.getString("zkConfig.zkRoot"); zkConfig.zkSessionTimeoutMs = config.hasPath("zkConfig.zkSessionTimeoutMs") ? config.getInt("zkConfig.zkSessionTimeoutMs") : 10000; zkConfig.connectionTimeoutMs = config.hasPath("zkConfig.connectionTimeoutMs") ? config.getInt("zkConfig.connectionTimeoutMs") : 10000; zkConfig.zkRetryTimes = config.hasPath("zkConfig.zkRetryTimes") ? config.getInt("zkConfig.zkRetryTimes") : 3; zkConfig.zkRetryInterval = config.hasPath("zkConfig.zkRetryInterval") ? config.getInt("zkConfig.zkRetryInterval") : 3000; return zkConfig; }  static ZKConfig getZKConfig(Config config);  }
@Test public void testZKConfigBuilder() { Config config = ConfigFactory.load(); ZKConfig zKConfig = ZKConfigBuilder.getZKConfig(config); Assert.assertEquals("localhost:2181", zKConfig.zkQuorum); Assert.assertEquals("/alert", zKConfig.zkRoot); Assert.assertEquals(10000, zKConfig.zkSessionTimeoutMs); Assert.assertEquals(10000, zKConfig.connectionTimeoutMs); Assert.assertEquals(3, zKConfig.zkRetryTimes); Assert.assertEquals(3000, zKConfig.zkRetryInterval); }