mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/controller/TestObservationCountMgrImpl.java
@Test
    public void testIncrementObsCount()
    {
        //Test initial increment for unknown controller adds the controller and sets obs count to one.
        Event persistEvent = mockObsPersisted();
        m_ObsEventHandler.handleEvent(persistEvent);
        assertThat(m_SUT.getObservationCount(CONTROLLER_ID), is(1));
        
        //Test incrementing the observation count for a known controller by one.
        m_ObsEventHandler.handleEvent(persistEvent);
        assertThat(m_SUT.getObservationCount(CONTROLLER_ID), is(2));
        
        //Verify that two observation count updated events were posted.
        ArgumentCaptor<Event> eventCaptor = ArgumentCaptor.forClass(Event.class);
        verify(m_EventAdmin, times(2)).postEvent(eventCaptor.capture());
        
        Event firstPush = eventCaptor.getAllValues().get(0);
        Event secondPush = eventCaptor.getAllValues().get(1);
        assertThat(firstPush.getTopic(), is(ObservationCountMgr.TOPIC_OBSERVATION_COUNT_UPDATED));
        assertThat((int)firstPush.getProperty(SharedPropertyConstants.EVENT_PROP_CONTROLLER_ID), is(CONTROLLER_ID));
        assertThat((int)firstPush.getProperty(ObservationCountMgr.EVENT_PROP_OBS_COUNT), is(1));
       
        assertThat(secondPush.getTopic(), is(ObservationCountMgr.TOPIC_OBSERVATION_COUNT_UPDATED));
        assertThat((int)secondPush.getProperty(SharedPropertyConstants.EVENT_PROP_CONTROLLER_ID), is(CONTROLLER_ID));
        assertThat((int)secondPush.getProperty(ObservationCountMgr.EVENT_PROP_OBS_COUNT), is(2));
    }
/**
     * Test the method used to increment the observation count for a controller by one.
     * Verify that the observation count is incremented and that an obs count updated event is posted.
     */
Test the method used to increment the observation count for a controller by one.
Verify that the observation count is incremented and that an obs count updated event is posted.
Test the method used to increment the observation count for a controller by one . Verify that the observation count is incremented and that an obs count updated event is posted .
@Test
    public void testIncrementObsCount()
    {
        Event persistEvent = mockObsPersisted();
        m_ObsEventHandler.handleEvent(persistEvent);
        assertThat(m_SUT.getObservationCount(CONTROLLER_ID), is(1));
        m_ObsEventHandler.handleEvent(persistEvent);
        assertThat(m_SUT.getObservationCount(CONTROLLER_ID), is(2));
        ArgumentCaptor<Event> eventCaptor = ArgumentCaptor.forClass(Event.class);
        verify(m_EventAdmin, times(2)).postEvent(eventCaptor.capture());
        Event firstPush = eventCaptor.getAllValues().get(0);
        Event secondPush = eventCaptor.getAllValues().get(1);
        assertThat(firstPush.getTopic(), is(ObservationCountMgr.TOPIC_OBSERVATION_COUNT_UPDATED));
        assertThat((int)firstPush.getProperty(SharedPropertyConstants.EVENT_PROP_CONTROLLER_ID), is(CONTROLLER_ID));
        assertThat((int)firstPush.getProperty(ObservationCountMgr.EVENT_PROP_OBS_COUNT), is(1));
        assertThat(secondPush.getTopic(), is(ObservationCountMgr.TOPIC_OBSERVATION_COUNT_UPDATED));
        assertThat((int)secondPush.getProperty(SharedPropertyConstants.EVENT_PROP_CONTROLLER_ID), is(CONTROLLER_ID));
        assertThat((int)secondPush.getProperty(ObservationCountMgr.EVENT_PROP_OBS_COUNT), is(2));
    }
@ Test public void testIncrementObsCount ( ) { Event persistEvent = mockObsPersisted ( ) ; m_ObsEventHandler . handleEvent ( persistEvent ) ; assertThat ( m_SUT . getObservationCount ( CONTROLLER_ID ) , is ( 1 ) ) ; m_ObsEventHandler . handleEvent ( persistEvent ) ; assertThat ( m_SUT . getObservationCount ( CONTROLLER_ID ) , is ( 2 ) ) ; ArgumentCaptor < Event > eventCaptor = ArgumentCaptor . forClass ( Event . class ) ; verify ( m_EventAdmin , times ( 2 ) ) . postEvent ( eventCaptor . capture ( ) ) ; Event firstPush = eventCaptor . getAllValues ( ) . get ( 0 ) ; Event secondPush = eventCaptor . getAllValues ( ) . get ( 1 ) ; assertThat ( firstPush . getTopic ( ) , is ( ObservationCountMgr . TOPIC_OBSERVATION_COUNT_UPDATED ) ) ; assertThat ( ( int ) firstPush . getProperty ( SharedPropertyConstants . EVENT_PROP_CONTROLLER_ID ) , is ( CONTROLLER_ID ) ) ; assertThat ( ( int ) firstPush . getProperty ( ObservationCountMgr . EVENT_PROP_OBS_COUNT ) , is ( 1 ) ) ; assertThat ( secondPush . getTopic ( ) , is ( ObservationCountMgr . TOPIC_OBSERVATION_COUNT_UPDATED ) ) ; assertThat ( ( int ) secondPush . getProperty ( SharedPropertyConstants . EVENT_PROP_CONTROLLER_ID ) , is ( CONTROLLER_ID ) ) ; assertThat ( ( int ) secondPush . getProperty ( ObservationCountMgr . EVENT_PROP_OBS_COUNT ) , is ( 2 ) ) ; }
Test the method used to increment the observation count for a controller by one.
Test the method used to increment the observation count for a controller by one .
//Test initial increment for unknown controller adds the controller and sets obs count to one. //Test incrementing the observation count for a known controller by one. //Verify that two observation count updated events were posted.