mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/controller/TestControllerMgrImpl.java
@Test
    public void testModeEventHandlerWithIllegalMode()
    {
        int contId = 9001;
        
        RemoteChannel channel = addChannelMockHelper(contId);//mock channel lookup
        
        Event event = createBasicChannelUpdatedEvent(channel, contId);
        
        m_ChannelHelper.handleEvent(event);
        
        //mock system info response has been received for newly added channel
        mockControllerMessage(contId, BaseMessageType.ControllerInfo);
        
        ControllerModel model = m_SUT.getController(contId);
        assertThat(model, notNullValue());
        
        final Map<String, Object> props = new HashMap<String, Object>();
        props.put(RemoteConstants.REMOTE_EVENT_PROP_CONTROLLER_ID, contId);
        props.put(TerraHarvestController.EVENT_PROP_SYSTEM_MODE, "IDONTCARE");
        
        final Event modeEvent = createOsgiEvent(TerraHarvestController.TOPIC_CONTROLLER_MODE_CHANGED 
                + RemoteConstants.REMOTE_TOPIC_SUFFIX, props);
        m_ModeEventHandler.handleEvent(modeEvent);
        
        //Verify that the correct error growl message is displayed.
        verify(m_GrowlUtil, times(1)).createGlobalFacesMessage(eq(FacesMessage.SEVERITY_ERROR), 
                eq("Controller Status Update Failed"), 
                eq("The status for controller 0x00002329 could not be updated to IDONTCARE."), 
                Mockito.any(IllegalArgumentException.class));
        
        //Verify that no other controller status updated growl messages are displayed.
        verify(m_GrowlUtil, never()).createGlobalFacesMessage(eq(FacesMessage.SEVERITY_INFO), 
                eq("Controller Status Updated"), anyString());
    }
/**
     * Verify that a growl message is posted when an illegal controller mode type is received.
     */
Verify that a growl message is posted when an illegal controller mode type is received.
Verify that a growl message is posted when an illegal controller mode type is received .
@Test
    public void testModeEventHandlerWithIllegalMode()
    {
        int contId = 9001;
        RemoteChannel channel = addChannelMockHelper(contId);
        Event event = createBasicChannelUpdatedEvent(channel, contId);
        m_ChannelHelper.handleEvent(event);
        mockControllerMessage(contId, BaseMessageType.ControllerInfo);
        ControllerModel model = m_SUT.getController(contId);
        assertThat(model, notNullValue());
        final Map<String, Object> props = new HashMap<String, Object>();
        props.put(RemoteConstants.REMOTE_EVENT_PROP_CONTROLLER_ID, contId);
        props.put(TerraHarvestController.EVENT_PROP_SYSTEM_MODE, "IDONTCARE");
        final Event modeEvent = createOsgiEvent(TerraHarvestController.TOPIC_CONTROLLER_MODE_CHANGED 
                + RemoteConstants.REMOTE_TOPIC_SUFFIX, props);
        m_ModeEventHandler.handleEvent(modeEvent);
        verify(m_GrowlUtil, times(1)).createGlobalFacesMessage(eq(FacesMessage.SEVERITY_ERROR), 
                eq("Controller Status Update Failed"), 
                eq("The status for controller 0x00002329 could not be updated to IDONTCARE."), 
                Mockito.any(IllegalArgumentException.class));
        verify(m_GrowlUtil, never()).createGlobalFacesMessage(eq(FacesMessage.SEVERITY_INFO), 
                eq("Controller Status Updated"), anyString());
    }
@ Test public void testModeEventHandlerWithIllegalMode ( ) { int contId = 9001 ; RemoteChannel channel = addChannelMockHelper ( contId ) ; Event event = createBasicChannelUpdatedEvent ( channel , contId ) ; m_ChannelHelper . handleEvent ( event ) ; mockControllerMessage ( contId , BaseMessageType . ControllerInfo ) ; ControllerModel model = m_SUT . getController ( contId ) ; assertThat ( model , notNullValue ( ) ) ; final Map < String , Object > props = new HashMap < String , Object > ( ) ; props . put ( RemoteConstants . REMOTE_EVENT_PROP_CONTROLLER_ID , contId ) ; props . put ( TerraHarvestController . EVENT_PROP_SYSTEM_MODE , "IDONTCARE" ) ; final Event modeEvent = createOsgiEvent ( TerraHarvestController . TOPIC_CONTROLLER_MODE_CHANGED + RemoteConstants . REMOTE_TOPIC_SUFFIX , props ) ; m_ModeEventHandler . handleEvent ( modeEvent ) ; verify ( m_GrowlUtil , times ( 1 ) ) . createGlobalFacesMessage ( eq ( FacesMessage . SEVERITY_ERROR ) , eq ( "Controller Status Update Failed" ) , eq ( "The status for controller 0x00002329 could not be updated to IDONTCARE." ) , Mockito . any ( IllegalArgumentException . class ) ) ; verify ( m_GrowlUtil , never ( ) ) . createGlobalFacesMessage ( eq ( FacesMessage . SEVERITY_INFO ) , eq ( "Controller Status Updated" ) , anyString ( ) ) ; }
Verify that a growl message is posted when an illegal controller mode type is received.
Verify that a growl message is posted when an illegal controller mode type is received .
//mock channel lookup //mock system info response has been received for newly added channel //Verify that the correct error growl message is displayed. //Verify that no other controller status updated growl messages are displayed.