@Override
  public void subscribe(String topic, TopicListener<T> listener) {
    if (topic == null || listener == null) {
      throw new IllegalArgumentException("topic or listener cannot be null.");
    }

    Set<TopicListener<T>> listeners = topicToListenersMap.get(topic);
    if (listeners == null) {
      listeners = new HashSet<>();
    }
    listeners.add(listener);
    topicToListenersMap.put(topic, listeners);
  }
A mock implementation of {@link Notifier}. The methods in this class are synchronous, and this class is
not thread-safe and supposed to be called from a single thread.
@param <T> The type of message.
ambry-account/src/test/java/com/github/ambry/account/MockNotifier.java