@Test
  public void testPublishMessageToBadListener() throws Exception {
    CountDownLatch latch = new CountDownLatch(1);
    TopicListener listener = (topic, message) -> {
      latch.countDown();
      throw new RuntimeException("Exception thrown from TopicListener");
    };
    String topic = "topic";
    helixNotifier.subscribe(topic, listener);
    helixNotifier.publish(topic, "message");
    awaitLatchOrTimeout(latch, LATCH_TIMEOUT_MS);
  }
Tests when publishing a message to a {@link TopicListener}, if the {@link TopicListener#onMessage(String, Object)}
method throws exception, it will not crash the {@link HelixNotifier}.
ambry-commons/src/test/java/com/github/ambry/commons/HelixNotifierTest.java