PodLogToEventPublisher implements PodLogHandler { @Override public void handle(String message, String containerName) { LOG.trace("forwarding message '{}' from the container '{}'", message, containerName); eventsPublisher.sendRuntimeLogEvent( String.format(LOG_MESSAGE_FORMAT, containerName, message), ZonedDateTime.now().toString(), identity); } PodLogToEventPublisher(RuntimeEventsPublisher eventsPublisher, RuntimeIdentity identity); @Override void handle(String message, String containerName);  }
@Test public void sendMessageToPublisher() { PodLogHandler handler = new PodLogToEventPublisher(eventsPublisher, identity); handler.handle("message", "containerName"); ArgumentCaptor<String> messageCaptor = ArgumentCaptor.forClass(String.class); verify(eventsPublisher) .sendRuntimeLogEvent( messageCaptor.capture(), any(String.class), any(RuntimeIdentity.class)); String capturedMessage = messageCaptor.getValue(); assertTrue(capturedMessage.contains("message")); assertTrue(capturedMessage.contains("containerName")); }