MessageControllerManager { JsTopicMessageController getJsTopicMessageControllerFromJsTopicControl(String topic) { logger.debug("Looking for messageController for topic '{}' from JsTopicControl annotation", topic); Instance<JsTopicMessageController<?>> select = topicMessageController.select(new JsTopicCtrlAnnotationLiteral(topic)); if(!select.isUnsatisfied()) { logger.debug("Found messageController for topic '{}' from JsTopicControl annotation", topic); return select.get(); } return null; }  JsTopicMessageController getJsTopicMessageController(String topic);  }
@Test public void getJsTopicMessageControllerFromJsTopicControlTest() { System.out.println("getJsTopicMessageControllerFromJsTopicControl"); Instance instances = mock(Instance.class); JsTopicMessageController jtmc = mock(JsTopicMessageController.class); when(topicMessageController.select(any(JsTopicControl.class))).thenReturn(instances); when(instances.isUnsatisfied()).thenReturn(Boolean.TRUE).thenReturn(Boolean.FALSE); when(instances.get()).thenReturn(jtmc); JsTopicMessageController result = instance.getJsTopicMessageControllerFromJsTopicControl(eq(TOPIC)); assertThat(result).isNull(); result = instance.getJsTopicMessageControllerFromJsTopicControl(eq(TOPIC)); assertThat(result).isEqualTo(jtmc); }