@SuppressWarnings("unchecked")
@Test
public void sendEncodedEvent_UpdateMetrics_Success() throws InvalidKeyException {

  RecordMetadata metadata = new RecordMetadata(null, 0, 0, 0, Long.valueOf(0), 0, 1);
  Exception exception = null;
  when(kafkaProducer.send(any(ProducerRecord.class), any(Callback.class))).thenAnswer(invocation -> {
    ((Callback) invocation.getArgument(1)).onCompletion(metadata, exception);
    return future;
  });
  underTest.sendEncodedEvent(new Event<>(null, null), null);
  verify(metrics).markSuccessMetrics(ROAD_NAME, 1);
}