MessageControllerCache { public void saveToCache(String topic, Class<? extends JsTopicMessageController> cls) { if(null != topic && null != cls) { messageControllers.put(topic, cls); } }  void saveToCache(String topic, Class<? extends JsTopicMessageController> cls); JsTopicMessageController loadFromCache(String topic);  }
@Test public void testSaveToCache() { System.out.println("saveToCache"); String topic = "TOPIC"; Class<? extends JsTopicMessageController> cls = JsTopicMessageController.class; instance.messageControllers.clear(); instance.saveToCache(topic, null); instance.saveToCache(null, cls); instance.saveToCache(topic, cls); assertThat(instance.messageControllers).hasSize(1); }