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