### Question:
MessageBusServiceImpl implements MessageBusService { @Override public String subscribeMessage(Class<? extends BaseMessage> messageClass, NulsMessageHandler<? extends BaseMessage> messageHandler) { MessageManager.putMessage(messageClass); return handlerManager.registerMessageHandler(null, messageClass, messageHandler); }  @Override String subscribeMessage(Class<? extends BaseMessage> messageClass, NulsMessageHandler<? extends BaseMessage> messageHandler); @Override void unsubscribeMessage(String subscribeId); @Override void receiveMessage(BaseMessage message, Node node); void shutdown(); @Override Result<List<String>> broadcast(BaseMessage message, Node excludeNode, boolean aysn, int percent); @Override Result sendToNode(BaseMessage message, Node node, boolean aysn); @Override Result<? extends BaseMessage> getMessageInstance(short moduleId, int type);  }### Answer:
@Test public void subscribeMessage() throws Exception { subscribe(); assertNotNull(handlerId); Field field = messageBusService.getClass().getDeclaredField("processorManager"); field.setAccessible(true); DispatchManager processorManager = (DispatchManager) field.get(messageBusService); Class processorManagerClass = processorManager.getClass(); Field handlerMapField = processorManagerClass.getDeclaredField("handlerMap"); handlerMapField.setAccessible(true); Map<String, NulsMessageHandler> handlerMap = (Map<String, NulsMessageHandler>) handlerMapField.get(processorManager); assertNotNull(handlerMap.get(handlerId)); assertEquals(handlerMap.get(handlerId), messageHandler); Field messageHandlerMappingField = processorManagerClass.getDeclaredField("messageHandlerMapping"); messageHandlerMappingField.setAccessible(true); Map<Class, Set<String>> messageHandlerMapping = (Map<Class, Set<String>>) messageHandlerMappingField.get(processorManager); assertNotNull(messageHandlerMapping.get(block)); assertTrue(messageHandlerMapping.get(block).contains(handlerId)); }