### Question:
DefaultMessagingService implements ClusterMessagingService { @Override public synchronized void registerMessageHandlerFactory(String type, MessageHandlerFactory factory) { registerMessageHandlerFactory(Collections.singletonList(type), factory); } DefaultMessagingService(HelixManager manager); @Override int send(Criteria recipientCriteria, final Message messageTemplate); @Override int send(final Criteria recipientCriteria, final Message message,
      AsyncCallback callbackOnReply, int timeOut); @Override int send(final Criteria recipientCriteria, final Message message,
      AsyncCallback callbackOnReply, int timeOut, int retryCount); Map<InstanceType, List<Message>> generateMessage(final Criteria recipientCriteria,
      final Message message); @Override synchronized void registerMessageHandlerFactory(String type,
      MessageHandlerFactory factory); @Override synchronized void registerMessageHandlerFactory(List<String> types,
      MessageHandlerFactory factory); synchronized void onConnected(); @Deprecated void sendNopMessage(); HelixTaskExecutor getExecutor(); @Override // TODO if the manager is not Participant or Controller, no reply, so should fail immediately int sendAndWait(Criteria recipientCriteria, Message message, AsyncCallback asyncCallback,
      int timeOut, int retryCount); @Override int sendAndWait(Criteria recipientCriteria, Message message, AsyncCallback asyncCallback,
      int timeOut);  }### Answer:
@Test public void testMultipleMessageTypeRegisteration() { HelixManager manager = new MockManager(); MockDefaultMessagingService svc = new MockDefaultMessagingService(manager); TestStateTransitionHandlerFactory factory = new TestStateTransitionHandlerFactory(); svc.registerMessageHandlerFactory(factory.getMessageTypes(), factory); Assert.assertTrue( svc.getMessageHandlerFactoryMap().containsKey(Message.MessageType.STATE_TRANSITION.name())); Assert.assertTrue(svc.getMessageHandlerFactoryMap() .containsKey(Message.MessageType.STATE_TRANSITION_CANCELLATION.name())); Assert.assertTrue( svc.getMessageHandlerFactoryMap().containsKey(Message.MessageType.CONTROLLER_MSG.name())); }