MessageBus { public static void sendMessage(Message<?> message) { if (message == null) { return; } if (listeners == null) { return; } List<MessageListener<?>> listenersForType = getListenersFor(message); if (listenersForType == null) { return; } notifyListeners(message, listenersForType); } private  MessageBus(); static void sendMessage(Message<?> message); static void registerOnce(Class<?> messageType, MessageListener<?> listener); static void registerListener(Class<?> messageType, MessageListener<?> listener); static void unregisterListener(Class<?> messageType, MessageListener<?> listener); static void removeAllListeners(); static boolean listens(Class<?> messageType, MessageListener<?> toFindOut);  }
@Test public void noListener() { MessageBus.sendMessage(new Message1("a", "b")); }
@Test public void nullMessage() { MessageBus.sendMessage(null); }