@Test public void sendEvent() throws Exception { Event event = new Message<>(0, 1L, 2, 3L, mapper.createObjectNode()); String raw = ""; doReturn(raw).when(underTest).encodeEvent(event); underTest.sendEvent(event); ArgumentCaptor<Runnable> senderCaptor = ArgumentCaptor.forClass(Runnable.class); verify(metrics).record(eq(SEND), senderCaptor.capture()); senderCaptor.getValue().run(); verify(sender).send(raw); }
@VisibleForTesting void sendEvent(Event event) { if (event instanceof Message) { if (log.isTraceEnabled()) { log.trace("Sending Event: {}", event); } } else { log.debug("Sending Event: {}", event); } String raw = encodeEvent(event); metrics.record(SEND, () -> sender.send(raw)); }
OfframpServiceV2 implements OfframpService { @VisibleForTesting void sendEvent(Event event) { if (event instanceof Message) { if (log.isTraceEnabled()) { log.trace("Sending Event: {}", event); } } else { log.debug("Sending Event: {}", event); } String raw = encodeEvent(event); metrics.record(SEND, () -> sender.send(raw)); } }
OfframpServiceV2 implements OfframpService { @VisibleForTesting void sendEvent(Event event) { if (event instanceof Message) { if (log.isTraceEnabled()) { log.trace("Sending Event: {}", event); } } else { log.debug("Sending Event: {}", event); } String raw = encodeEvent(event); metrics.record(SEND, () -> sender.send(raw)); }  }
OfframpServiceV2 implements OfframpService { @VisibleForTesting void sendEvent(Event event) { if (event instanceof Message) { if (log.isTraceEnabled()) { log.trace("Sending Event: {}", event); } } else { log.debug("Sending Event: {}", event); } String raw = encodeEvent(event); metrics.record(SEND, () -> sender.send(raw)); }  @Override void run(); @Override void close(); @Override void onEvent(String event); }
OfframpServiceV2 implements OfframpService { @VisibleForTesting void sendEvent(Event event) { if (event instanceof Message) { if (log.isTraceEnabled()) { log.trace("Sending Event: {}", event); } } else { log.debug("Sending Event: {}", event); } String raw = encodeEvent(event); metrics.record(SEND, () -> sender.send(raw)); }  @Override void run(); @Override void close(); @Override void onEvent(String event);  }