### Question:
GroundingService { public static EventGrounding createEventGrounding(String kafkaHost, int kafkaPort, EventSchema eventSchema) { EventGrounding eventGrounding = new EventGrounding(); KafkaTransportProtocol transportProtocol = new KafkaTransportProtocol(); transportProtocol.setBrokerHostname(kafkaHost); transportProtocol.setKafkaPort(kafkaPort); String topic = "org.apache.streampipes.connect." + UUID.randomUUID().toString(); TopicDefinition topicDefinition = new SimpleTopicDefinition(topic); transportProtocol.setTopicDefinition(topicDefinition); eventGrounding.setTransportProtocol(transportProtocol); eventGrounding.setTransportFormats(Collections .singletonList(TransportFormatGenerator.getTransportFormat())); return eventGrounding; }  static String extractBroker(AdapterDescription adapterDescription); static String extractTopic(AdapterDescription adapterDescription); static EventGrounding createEventGrounding(String kafkaHost, int kafkaPort, EventSchema eventSchema);  }### Answer:
@Test public void createEventGroundingTest() { when(SpConfig.getSpConfig(anyString())).thenReturn(new MockSpConfig("")); BackendConfig backendConfig = mock(BackendConfig.INSTANCE.getClass()); when(backendConfig.getMessagingSettings()).thenReturn(MessagingSettings.fromDefault()); Whitebox.setInternalState(BackendConfig.class, "INSTANCE", backendConfig); EventGrounding eventGrounding = GroundingService.createEventGrounding("localhost", 1, null); assertEquals("localhost", eventGrounding.getTransportProtocol().getBrokerHostname()); assertEquals(1, ((KafkaTransportProtocol)eventGrounding.getTransportProtocol()).getKafkaPort()); assertTrue(eventGrounding.getTransportProtocol().getTopicDefinition().getActualTopicName().startsWith("org.apache.streampipes.connect")); }