mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/utils/TestGrowlMessageUtil.java
@Test
    public void testCreateLocalFacesMessageException()
    {
        IllegalArgumentException exception =  mock(IllegalArgumentException.class);
        
        //Create an growl message with severity of info.
        m_SUT.createLocalFacesMessage(FacesMessage.SEVERITY_INFO, "INFO", "INFO_DETAILS", exception);
        PowerMockito.verifyStatic();
        Logging.log(LogService.LOG_INFO, exception,"INFO_DETAILS");
        
        //Create an growl message with severity of warn.
        m_SUT.createLocalFacesMessage(FacesMessage.SEVERITY_WARN, "WARN", "WARN_DETAILS", exception);
        PowerMockito.verifyStatic();
        Logging.log(LogService.LOG_WARNING, exception,"WARN_DETAILS");
        
        //Create an growl message with severity of error.
        m_SUT.createLocalFacesMessage(FacesMessage.SEVERITY_ERROR, "ERROR", "ERROR_DETAILS", exception);
        PowerMockito.verifyStatic();
        Logging.log(LogService.LOG_ERROR, exception,"ERROR_DETAILS");
        
        //Create an growl message with severity of fatal.
        m_SUT.createLocalFacesMessage(FacesMessage.SEVERITY_FATAL, "FATAL", "FATAL_DETAILS", exception);
        PowerMockito.verifyStatic();
        Logging.log(LogService.LOG_ERROR, exception,"FATAL_DETAILS");
        
        //Verify that the growl message with info severity was handled correctly.
        ArgumentCaptor<PushGrowlMessage> msgCaptor = ArgumentCaptor.forClass(PushGrowlMessage.class);
        verify(m_Manager, times(4)).addMessage(msgCaptor.capture());
        PushGrowlMessage msg = msgCaptor.getAllValues().get(0);
        assertThat(msg.getSeverity(), is("info"));
        assertThat(msg.getSticky(), is(false));
        assertThat(msg.getSummary(), is("INFO"));
        assertThat(msg.getDetail(), is("INFO_DETAILS"));
        
        //Verify that the growl message with warn severity was handled correctly.
        msg = msgCaptor.getAllValues().get(1);
        assertThat(msg.getSeverity(), is("warn"));
        assertThat(msg.getSticky(), is(true));
        assertThat(msg.getSummary(), is("WARN"));
        assertThat(msg.getDetail(), is("WARN_DETAILS"));
        
        //Verify that the growl message with error severity was handled correctly.
        msg = msgCaptor.getAllValues().get(2);
        assertThat(msg.getSeverity(), is("error"));
        assertThat(msg.getSticky(), is(true));
        assertThat(msg.getSummary(), is("ERROR"));
        assertThat(msg.getDetail(), is("ERROR_DETAILS"));
        
        //Verify that the growl message with fatal severity was handled correctly.
        msg = msgCaptor.getAllValues().get(3);
        assertThat(msg.getSeverity(), is("fatal"));
        assertThat(msg.getSticky(), is(true));
        assertThat(msg.getSummary(), is("FATAL"));
        assertThat(msg.getDetail(), is("FATAL_DETAILS"));
    }
/**
     * Test creating a growl message with an exception.
     * Verify that a growl message is made appropriate for each kind of severity level.
     */
Test creating a growl message with an exception.
Verify that a growl message is made appropriate for each kind of severity level.
Test creating a growl message with an exception . Verify that a growl message is made appropriate for each kind of severity level .
@Test
    public void testCreateLocalFacesMessageException()
    {
        IllegalArgumentException exception =  mock(IllegalArgumentException.class);
        m_SUT.createLocalFacesMessage(FacesMessage.SEVERITY_INFO, "INFO", "INFO_DETAILS", exception);
        PowerMockito.verifyStatic();
        Logging.log(LogService.LOG_INFO, exception,"INFO_DETAILS");
        m_SUT.createLocalFacesMessage(FacesMessage.SEVERITY_WARN, "WARN", "WARN_DETAILS", exception);
        PowerMockito.verifyStatic();
        Logging.log(LogService.LOG_WARNING, exception,"WARN_DETAILS");
        m_SUT.createLocalFacesMessage(FacesMessage.SEVERITY_ERROR, "ERROR", "ERROR_DETAILS", exception);
        PowerMockito.verifyStatic();
        Logging.log(LogService.LOG_ERROR, exception,"ERROR_DETAILS");
        m_SUT.createLocalFacesMessage(FacesMessage.SEVERITY_FATAL, "FATAL", "FATAL_DETAILS", exception);
        PowerMockito.verifyStatic();
        Logging.log(LogService.LOG_ERROR, exception,"FATAL_DETAILS");
        ArgumentCaptor<PushGrowlMessage> msgCaptor = ArgumentCaptor.forClass(PushGrowlMessage.class);
        verify(m_Manager, times(4)).addMessage(msgCaptor.capture());
        PushGrowlMessage msg = msgCaptor.getAllValues().get(0);
        assertThat(msg.getSeverity(), is("info"));
        assertThat(msg.getSticky(), is(false));
        assertThat(msg.getSummary(), is("INFO"));
        assertThat(msg.getDetail(), is("INFO_DETAILS"));
        msg = msgCaptor.getAllValues().get(1);
        assertThat(msg.getSeverity(), is("warn"));
        assertThat(msg.getSticky(), is(true));
        assertThat(msg.getSummary(), is("WARN"));
        assertThat(msg.getDetail(), is("WARN_DETAILS"));
        msg = msgCaptor.getAllValues().get(2);
        assertThat(msg.getSeverity(), is("error"));
        assertThat(msg.getSticky(), is(true));
        assertThat(msg.getSummary(), is("ERROR"));
        assertThat(msg.getDetail(), is("ERROR_DETAILS"));
        msg = msgCaptor.getAllValues().get(3);
        assertThat(msg.getSeverity(), is("fatal"));
        assertThat(msg.getSticky(), is(true));
        assertThat(msg.getSummary(), is("FATAL"));
        assertThat(msg.getDetail(), is("FATAL_DETAILS"));
    }
@ Test public void testCreateLocalFacesMessageException ( ) { IllegalArgumentException exception = mock ( IllegalArgumentException . class ) ; m_SUT . createLocalFacesMessage ( FacesMessage . SEVERITY_INFO , "INFO" , "INFO_DETAILS" , exception ) ; PowerMockito . verifyStatic ( ) ; Logging . log ( LogService . LOG_INFO , exception , "INFO_DETAILS" ) ; m_SUT . createLocalFacesMessage ( FacesMessage . SEVERITY_WARN , "WARN" , "WARN_DETAILS" , exception ) ; PowerMockito . verifyStatic ( ) ; Logging . log ( LogService . LOG_WARNING , exception , "WARN_DETAILS" ) ; m_SUT . createLocalFacesMessage ( FacesMessage . SEVERITY_ERROR , "ERROR" , "ERROR_DETAILS" , exception ) ; PowerMockito . verifyStatic ( ) ; Logging . log ( LogService . LOG_ERROR , exception , "ERROR_DETAILS" ) ; m_SUT . createLocalFacesMessage ( FacesMessage . SEVERITY_FATAL , "FATAL" , "FATAL_DETAILS" , exception ) ; PowerMockito . verifyStatic ( ) ; Logging . log ( LogService . LOG_ERROR , exception , "FATAL_DETAILS" ) ; ArgumentCaptor < PushGrowlMessage > msgCaptor = ArgumentCaptor . forClass ( PushGrowlMessage . class ) ; verify ( m_Manager , times ( 4 ) ) . addMessage ( msgCaptor . capture ( ) ) ; PushGrowlMessage msg = msgCaptor . getAllValues ( ) . get ( 0 ) ; assertThat ( msg . getSeverity ( ) , is ( "info" ) ) ; assertThat ( msg . getSticky ( ) , is ( false ) ) ; assertThat ( msg . getSummary ( ) , is ( "INFO" ) ) ; assertThat ( msg . getDetail ( ) , is ( "INFO_DETAILS" ) ) ; msg = msgCaptor . getAllValues ( ) . get ( 1 ) ; assertThat ( msg . getSeverity ( ) , is ( "warn" ) ) ; assertThat ( msg . getSticky ( ) , is ( true ) ) ; assertThat ( msg . getSummary ( ) , is ( "WARN" ) ) ; assertThat ( msg . getDetail ( ) , is ( "WARN_DETAILS" ) ) ; msg = msgCaptor . getAllValues ( ) . get ( 2 ) ; assertThat ( msg . getSeverity ( ) , is ( "error" ) ) ; assertThat ( msg . getSticky ( ) , is ( true ) ) ; assertThat ( msg . getSummary ( ) , is ( "ERROR" ) ) ; assertThat ( msg . getDetail ( ) , is ( "ERROR_DETAILS" ) ) ; msg = msgCaptor . getAllValues ( ) . get ( 3 ) ; assertThat ( msg . getSeverity ( ) , is ( "fatal" ) ) ; assertThat ( msg . getSticky ( ) , is ( true ) ) ; assertThat ( msg . getSummary ( ) , is ( "FATAL" ) ) ; assertThat ( msg . getDetail ( ) , is ( "FATAL_DETAILS" ) ) ; }
Test creating a growl message with an exception.
Test creating a growl message with an exception .
//Create an growl message with severity of info. //Create an growl message with severity of warn. //Create an growl message with severity of error. //Create an growl message with severity of fatal. //Verify that the growl message with info severity was handled correctly. //Verify that the growl message with warn severity was handled correctly. //Verify that the growl message with error severity was handled correctly. //Verify that the growl message with fatal severity was handled correctly.