edu.udayton.udri.asset.novatel/test/edu/udayton/udri/asset/novatel/TestNovatelStatusService.java
@Test
    public void testNewComponent()
    {
        List<SummaryStatusEnum> statuses = Arrays.asList(SummaryStatusEnum.GOOD, SummaryStatusEnum.GOOD);
        List<ComponentStatus> list = getMockComponentStatuses(m_ComponentTypes, m_Descriptors, statuses);
        Status status = getLastStatus(list);
        
        assertThat(status, notNullValue());
        assertThat(status.getSummaryStatus().getSummary(), is(SummaryStatusEnum.GOOD));
       
        List<ComponentStatus> compStatuses = status.getComponentStatuses();
        verifyStatuses(compStatuses, list);
        
        Observation observation = new Observation();
        observation.setStatus(status);
        
        //new status component
        ComponentType type = new ComponentType(ComponentTypeEnum.POWER, "I got the POWAR!");
        Status newStatus = m_SUT.getStatus(observation, new ComponentStatus(
                type, new OperatingStatus(SummaryStatusEnum.OFF, "I'm off")));
        assertThat(newStatus, is(notNullValue()));
        assertThat(newStatus.getComponentStatuses().size(), is(3));
        
        //organize results
        Map<ComponentTypeEnum, SummaryStatusEnum> resultMap = new HashMap<>();
        for (ComponentStatus statusComp : newStatus.getComponentStatuses())
        {
            resultMap.put(statusComp.getComponent().getType(), statusComp.getStatus().getSummary());
        }
        //verify
        assertThat(resultMap.get(ComponentTypeEnum.NAVIGATION), is(SummaryStatusEnum.GOOD));
        assertThat(resultMap.get(ComponentTypeEnum.SOFTWARE_UNIT), is(SummaryStatusEnum.GOOD));
        assertThat(resultMap.get(ComponentTypeEnum.POWER), is(SummaryStatusEnum.OFF));
        assertThat(newStatus.getSummaryStatus().getSummary(), is(SummaryStatusEnum.GOOD));
    }
/**
     * Verify that if a new component status is received with a new component type that a new status is created.
     */
Verify that if a new component status is received with a new component type that a new status is created.
Verify that if a new component status is received with a new component type that a new status is created .
@Test
    public void testNewComponent()
    {
        List<SummaryStatusEnum> statuses = Arrays.asList(SummaryStatusEnum.GOOD, SummaryStatusEnum.GOOD);
        List<ComponentStatus> list = getMockComponentStatuses(m_ComponentTypes, m_Descriptors, statuses);
        Status status = getLastStatus(list);
        assertThat(status, notNullValue());
        assertThat(status.getSummaryStatus().getSummary(), is(SummaryStatusEnum.GOOD));
        List<ComponentStatus> compStatuses = status.getComponentStatuses();
        verifyStatuses(compStatuses, list);
        Observation observation = new Observation();
        observation.setStatus(status);
        ComponentType type = new ComponentType(ComponentTypeEnum.POWER, "I got the POWAR!");
        Status newStatus = m_SUT.getStatus(observation, new ComponentStatus(
                type, new OperatingStatus(SummaryStatusEnum.OFF, "I'm off")));
        assertThat(newStatus, is(notNullValue()));
        assertThat(newStatus.getComponentStatuses().size(), is(3));
        Map<ComponentTypeEnum, SummaryStatusEnum> resultMap = new HashMap<>();
        for (ComponentStatus statusComp : newStatus.getComponentStatuses())
        {
            resultMap.put(statusComp.getComponent().getType(), statusComp.getStatus().getSummary());
        }
        assertThat(resultMap.get(ComponentTypeEnum.NAVIGATION), is(SummaryStatusEnum.GOOD));
        assertThat(resultMap.get(ComponentTypeEnum.SOFTWARE_UNIT), is(SummaryStatusEnum.GOOD));
        assertThat(resultMap.get(ComponentTypeEnum.POWER), is(SummaryStatusEnum.OFF));
        assertThat(newStatus.getSummaryStatus().getSummary(), is(SummaryStatusEnum.GOOD));
    }
@ Test public void testNewComponent ( ) { List < SummaryStatusEnum > statuses = Arrays . asList ( SummaryStatusEnum . GOOD , SummaryStatusEnum . GOOD ) ; List < ComponentStatus > list = getMockComponentStatuses ( m_ComponentTypes , m_Descriptors , statuses ) ; Status status = getLastStatus ( list ) ; assertThat ( status , notNullValue ( ) ) ; assertThat ( status . getSummaryStatus ( ) . getSummary ( ) , is ( SummaryStatusEnum . GOOD ) ) ; List < ComponentStatus > compStatuses = status . getComponentStatuses ( ) ; verifyStatuses ( compStatuses , list ) ; Observation observation = new Observation ( ) ; observation . setStatus ( status ) ; ComponentType type = new ComponentType ( ComponentTypeEnum . POWER , "I got the POWAR!" ) ; Status newStatus = m_SUT . getStatus ( observation , new ComponentStatus ( type , new OperatingStatus ( SummaryStatusEnum . OFF , "I'm off" ) ) ) ; assertThat ( newStatus , is ( notNullValue ( ) ) ) ; assertThat ( newStatus . getComponentStatuses ( ) . size ( ) , is ( 3 ) ) ; Map < ComponentTypeEnum , SummaryStatusEnum > resultMap = new HashMap < > ( ) ; for ( ComponentStatus statusComp : newStatus . getComponentStatuses ( ) ) { resultMap . put ( statusComp . getComponent ( ) . getType ( ) , statusComp . getStatus ( ) . getSummary ( ) ) ; } assertThat ( resultMap . get ( ComponentTypeEnum . NAVIGATION ) , is ( SummaryStatusEnum . GOOD ) ) ; assertThat ( resultMap . get ( ComponentTypeEnum . SOFTWARE_UNIT ) , is ( SummaryStatusEnum . GOOD ) ) ; assertThat ( resultMap . get ( ComponentTypeEnum . POWER ) , is ( SummaryStatusEnum . OFF ) ) ; assertThat ( newStatus . getSummaryStatus ( ) . getSummary ( ) , is ( SummaryStatusEnum . GOOD ) ) ; }
Verify that if a new component status is received with a new component type that a new status is created.
Verify that if a new component status is received with a new component type that a new status is created .
//new status component //organize results //verify