KafkaSenderExporter { @Activate public void activate(Config config, BundleContext context, Map<String, String> properties) { sender = KafkaSender.newBuilder() .bootstrapServers(config.bootstrapServers()) .encoding(config.encoding()) .messageMaxBytes(config.messageMaxBytes()) .overrides(getOverrides(properties)) .topic(config.topic()) .build(); reg = context.registerService(Sender.class, sender, new Hashtable<String, String>(properties)); }  @Activate void activate(Config config, BundleContext context, Map<String, String> properties); @Deactivate void deactive();  }
@Test public void testConfig() { KafkaSenderExporter exporter = new KafkaSenderExporter(); Map<String, String> properties = new HashMap<String, String>(); properties.put("kafka.myprop", "myvalue"); BundleContext context = mock(BundleContext.class); Config config = mock(Config.class); when(config.bootstrapServers()).thenReturn("server1"); when(config.encoding()).thenReturn(Encoding.JSON); when(config.topic()).thenReturn("mytopic"); exporter.activate(config, context, properties); }