ConfigUtil { public static Properties toProducerConfig(Config config) { val keys = new String[]{ ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, ProducerConfig.CLIENT_ID_CONFIG, ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG }; val props = new Properties(); copyProps(config, props, keys); return props; }  static Properties toConsumerConfig(Config config); static Properties toProducerConfig(Config config);  }
@Test public void testToProducerConfig() { val config = ConfigFactory.load("producer.conf"); val props = ConfigUtil.toProducerConfig(config); assertEquals(BOOTSTRAP_SERVERS, props.getProperty(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG)); assertEquals(CLIENT_ID, props.getProperty(ProducerConfig.CLIENT_ID_CONFIG)); assertEquals(KEY_SER, props.getProperty(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG)); assertEquals(VALUE_SER, props.getProperty(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG)); }