mil.dod.th.ose.core/test/mil/dod/th/ose/core/impl/asset/TestAssetImpl.java
@Test
    public void testPerformBit() throws AssetException
    {
        Status retStatus = new Status().withSummaryStatus(
                new OperatingStatus().withDescription("New description").withSummary(SummaryStatusEnum.GOOD));
        when(m_Proxy.onPerformBit()).thenReturn(retStatus);

        final Observation status = m_SUT.performBit();

        verify(m_WakeLock).activate();
        verify(m_WakeLock).cancel();

        assertThat(status, is(m_SUT.getLastStatus()));
        final ArgumentCaptor<Event> eventCaptor = ArgumentCaptor.forClass(Event.class);
        verify(m_EventAdmin, atLeastOnce()).postEvent(eventCaptor.capture());
        assertThat(eventCaptor.getValue().getTopic(), is(Asset.TOPIC_STATUS_CHANGED));
        assertThat(
                SummaryStatusEnum.valueOf(
                        (String)eventCaptor.getValue().getProperty(Asset.EVENT_PROP_ASSET_STATUS_SUMMARY)),
                is(SummaryStatusEnum.GOOD));
        assertThat((String)eventCaptor.getValue().getProperty(Asset.EVENT_PROP_ASSET_STATUS_DESCRIPTION),
                is("New description"));
        assertThat((UUID)eventCaptor.getValue().getProperty(Asset.EVENT_PROP_ASSET_STATUS_OBSERVATION_UUID),
                is(notNullValue()));
    }
/**
     * Verify that performBit can be performed.
     */
Verify that performBit can be performed.
Verify that performBit can be performed .
@Test
    public void testPerformBit() throws AssetException
    {
        Status retStatus = new Status().withSummaryStatus(
                new OperatingStatus().withDescription("New description").withSummary(SummaryStatusEnum.GOOD));
        when(m_Proxy.onPerformBit()).thenReturn(retStatus);
        final Observation status = m_SUT.performBit();
        verify(m_WakeLock).activate();
        verify(m_WakeLock).cancel();
        assertThat(status, is(m_SUT.getLastStatus()));
        final ArgumentCaptor<Event> eventCaptor = ArgumentCaptor.forClass(Event.class);
        verify(m_EventAdmin, atLeastOnce()).postEvent(eventCaptor.capture());
        assertThat(eventCaptor.getValue().getTopic(), is(Asset.TOPIC_STATUS_CHANGED));
        assertThat(
                SummaryStatusEnum.valueOf(
                        (String)eventCaptor.getValue().getProperty(Asset.EVENT_PROP_ASSET_STATUS_SUMMARY)),
                is(SummaryStatusEnum.GOOD));
        assertThat((String)eventCaptor.getValue().getProperty(Asset.EVENT_PROP_ASSET_STATUS_DESCRIPTION),
                is("New description"));
        assertThat((UUID)eventCaptor.getValue().getProperty(Asset.EVENT_PROP_ASSET_STATUS_OBSERVATION_UUID),
                is(notNullValue()));
    }
@ Test public void testPerformBit ( ) throws AssetException { Status retStatus = new Status ( ) . withSummaryStatus ( new OperatingStatus ( ) . withDescription ( "New description" ) . withSummary ( SummaryStatusEnum . GOOD ) ) ; when ( m_Proxy . onPerformBit ( ) ) . thenReturn ( retStatus ) ; final Observation status = m_SUT . performBit ( ) ; verify ( m_WakeLock ) . activate ( ) ; verify ( m_WakeLock ) . cancel ( ) ; assertThat ( status , is ( m_SUT . getLastStatus ( ) ) ) ; final ArgumentCaptor < Event > eventCaptor = ArgumentCaptor . forClass ( Event . class ) ; verify ( m_EventAdmin , atLeastOnce ( ) ) . postEvent ( eventCaptor . capture ( ) ) ; assertThat ( eventCaptor . getValue ( ) . getTopic ( ) , is ( Asset . TOPIC_STATUS_CHANGED ) ) ; assertThat ( SummaryStatusEnum . valueOf ( ( String ) eventCaptor . getValue ( ) . getProperty ( Asset . EVENT_PROP_ASSET_STATUS_SUMMARY ) ) , is ( SummaryStatusEnum . GOOD ) ) ; assertThat ( ( String ) eventCaptor . getValue ( ) . getProperty ( Asset . EVENT_PROP_ASSET_STATUS_DESCRIPTION ) , is ( "New description" ) ) ; assertThat ( ( UUID ) eventCaptor . getValue ( ) . getProperty ( Asset . EVENT_PROP_ASSET_STATUS_OBSERVATION_UUID ) , is ( notNullValue ( ) ) ) ; }
Verify that performBit can be performed.
Verify that performBit can be performed .