mil.dod.th.ose.core/test/mil/dod/th/ose/core/impl/asset/TestAssetImpl.java
@Test
    public void testSetStatusWithSensorId() throws ValidationFailedException
    {
        String sensorId = "testId2";
        Status status = new Status().withSummaryStatus(
                new OperatingStatus().withDescription("New description").withSummary(SummaryStatusEnum.GOOD));

        m_SUT.setStatus(sensorId, status);

        ArgumentCaptor<Event> evtCaptor = ArgumentCaptor.forClass(Event.class);
        verify(m_EventAdmin, atLeastOnce()).postEvent(evtCaptor.capture());

        assertThat(evtCaptor.getValue().getTopic(), is(Asset.TOPIC_STATUS_CHANGED));
        assertThat((String)evtCaptor.getValue().getProperty(Asset.EVENT_PROP_ASSET_STATUS_DESCRIPTION),
                is("New description"));
        assertThat((String)evtCaptor.getValue().getProperty(Asset.EVENT_PROP_ASSET_STATUS_SUMMARY),
                is(SummaryStatusEnum.GOOD.toString()));
        assertThat(evtCaptor.getValue().getProperty(Asset.EVENT_PROP_ASSET_STATUS_OBSERVATION_UUID), notNullValue());

        Observation observation = m_SUT.getLastStatus();

        assertThat(observation.isSetStatus(), is(true));
        assertThat(observation.getSensorId(), is(sensorId));
        assertThat(observation.getStatus().getSummaryStatus().getDescription(), is("New description"));
        assertThat(observation.getStatus().getSummaryStatus().getSummary(), is(SummaryStatusEnum.GOOD));
    }
/**
     * Verify that a Status can be given and will be set on the asset for a given sensor ID.
     */
Verify that a Status can be given and will be set on the asset for a given sensor ID.
Verify that a Status can be given and will be set on the asset for a given sensor ID .
@Test
    public void testSetStatusWithSensorId() throws ValidationFailedException
    {
        String sensorId = "testId2";
        Status status = new Status().withSummaryStatus(
                new OperatingStatus().withDescription("New description").withSummary(SummaryStatusEnum.GOOD));
        m_SUT.setStatus(sensorId, status);
        ArgumentCaptor<Event> evtCaptor = ArgumentCaptor.forClass(Event.class);
        verify(m_EventAdmin, atLeastOnce()).postEvent(evtCaptor.capture());
        assertThat(evtCaptor.getValue().getTopic(), is(Asset.TOPIC_STATUS_CHANGED));
        assertThat((String)evtCaptor.getValue().getProperty(Asset.EVENT_PROP_ASSET_STATUS_DESCRIPTION),
                is("New description"));
        assertThat((String)evtCaptor.getValue().getProperty(Asset.EVENT_PROP_ASSET_STATUS_SUMMARY),
                is(SummaryStatusEnum.GOOD.toString()));
        assertThat(evtCaptor.getValue().getProperty(Asset.EVENT_PROP_ASSET_STATUS_OBSERVATION_UUID), notNullValue());
        Observation observation = m_SUT.getLastStatus();
        assertThat(observation.isSetStatus(), is(true));
        assertThat(observation.getSensorId(), is(sensorId));
        assertThat(observation.getStatus().getSummaryStatus().getDescription(), is("New description"));
        assertThat(observation.getStatus().getSummaryStatus().getSummary(), is(SummaryStatusEnum.GOOD));
    }
@ Test public void testSetStatusWithSensorId ( ) throws ValidationFailedException { String sensorId = "testId2" ; Status status = new Status ( ) . withSummaryStatus ( new OperatingStatus ( ) . withDescription ( "New description" ) . withSummary ( SummaryStatusEnum . GOOD ) ) ; m_SUT . setStatus ( sensorId , status ) ; ArgumentCaptor < Event > evtCaptor = ArgumentCaptor . forClass ( Event . class ) ; verify ( m_EventAdmin , atLeastOnce ( ) ) . postEvent ( evtCaptor . capture ( ) ) ; assertThat ( evtCaptor . getValue ( ) . getTopic ( ) , is ( Asset . TOPIC_STATUS_CHANGED ) ) ; assertThat ( ( String ) evtCaptor . getValue ( ) . getProperty ( Asset . EVENT_PROP_ASSET_STATUS_DESCRIPTION ) , is ( "New description" ) ) ; assertThat ( ( String ) evtCaptor . getValue ( ) . getProperty ( Asset . EVENT_PROP_ASSET_STATUS_SUMMARY ) , is ( SummaryStatusEnum . GOOD . toString ( ) ) ) ; assertThat ( evtCaptor . getValue ( ) . getProperty ( Asset . EVENT_PROP_ASSET_STATUS_OBSERVATION_UUID ) , notNullValue ( ) ) ; Observation observation = m_SUT . getLastStatus ( ) ; assertThat ( observation . isSetStatus ( ) , is ( true ) ) ; assertThat ( observation . getSensorId ( ) , is ( sensorId ) ) ; assertThat ( observation . getStatus ( ) . getSummaryStatus ( ) . getDescription ( ) , is ( "New description" ) ) ; assertThat ( observation . getStatus ( ) . getSummaryStatus ( ) . getSummary ( ) , is ( SummaryStatusEnum . GOOD ) ) ; }
Verify that a Status can be given and will be set on the asset for a given sensor ID.
Verify that a Status can be given and will be set on the asset for a given sensor ID .