edu.udayton.udri.asset.novatel/test/edu/udayton/udri/asset/novatel/TestNovatelStatusService.java
private void verifyStatuses(List<ComponentStatus> compStatuses, List<ComponentStatus> expectedCompStatList)
    {
        assertThat(compStatuses, notNullValue());
        assertThat(compStatuses.size(), is(expectedCompStatList.size()));
        
        Map<ComponentTypeEnum, ComponentStatus> expectedStatusesMap = new HashMap<>();
        for (ComponentStatus expectedStatus : expectedCompStatList)
        {
            expectedStatusesMap.put(expectedStatus.getComponent().getType(), expectedStatus);
        }
        for (ComponentTypeEnum expectedStatus : expectedStatusesMap.keySet())
        {
            boolean found = false; 
            ComponentStatus status = expectedStatusesMap.get(expectedStatus);
            
            for (ComponentStatus newStatuses : compStatuses)
            {
                assertThat(newStatuses, notNullValue());
                if (newStatuses.getComponent().getDescription()
                        .equals(status.getComponent().getDescription()))
                {
                    found = true;
                    assertThat(newStatuses.getComponent().getType(), is(status.getComponent().getType()));
                    assertThat(newStatuses.getStatus().getSummary(), is(status.getStatus().getSummary()));
                    assertThat(newStatuses.getStatus().getDescription(), is(status.getStatus().getDescription()));
                    break;
                }
            }
            
            assertThat(String.format("Looking for component status: " 
                    + "Type: %s Description: %s but it was not found in the status returned.", 
                    status.getComponent().getType(), status.getComponent().getDescription()),found, is(true));
        }
    }
/**
     * Function to verify that the component statuses match the given map of component statuses.
     * @param compStatuses
     *  the list of generated component statuses from the overall created status object
     * @param expectedCompStatList
     *  the map of generated component statuses
     */
Function to verify that the component statuses match the given map of component statuses.
@param compStatuses
the list of generated component statuses from the overall created status object
@param expectedCompStatList
the map of generated component statuses
Function to verify that the component statuses match the given map of component statuses . @param compStatuses the list of generated component statuses from the overall created status object @param expectedCompStatList the map of generated component statuses
private void verifyStatuses(List<ComponentStatus> compStatuses, List<ComponentStatus> expectedCompStatList)
    {
        assertThat(compStatuses, notNullValue());
        assertThat(compStatuses.size(), is(expectedCompStatList.size()));
        Map<ComponentTypeEnum, ComponentStatus> expectedStatusesMap = new HashMap<>();
        for (ComponentStatus expectedStatus : expectedCompStatList)
        {
            expectedStatusesMap.put(expectedStatus.getComponent().getType(), expectedStatus);
        }
        for (ComponentTypeEnum expectedStatus : expectedStatusesMap.keySet())
        {
            boolean found = false; 
            ComponentStatus status = expectedStatusesMap.get(expectedStatus);
            for (ComponentStatus newStatuses : compStatuses)
            {
                assertThat(newStatuses, notNullValue());
                if (newStatuses.getComponent().getDescription()
                        .equals(status.getComponent().getDescription()))
                {
                    found = true;
                    assertThat(newStatuses.getComponent().getType(), is(status.getComponent().getType()));
                    assertThat(newStatuses.getStatus().getSummary(), is(status.getStatus().getSummary()));
                    assertThat(newStatuses.getStatus().getDescription(), is(status.getStatus().getDescription()));
                    break;
                }
            }
            assertThat(String.format("Looking for component status: " 
                    + "Type: %s Description: %s but it was not found in the status returned.", 
                    status.getComponent().getType(), status.getComponent().getDescription()),found, is(true));
        }
    }
private void verifyStatuses ( List < ComponentStatus > compStatuses , List < ComponentStatus > expectedCompStatList ) { assertThat ( compStatuses , notNullValue ( ) ) ; assertThat ( compStatuses . size ( ) , is ( expectedCompStatList . size ( ) ) ) ; Map < ComponentTypeEnum , ComponentStatus > expectedStatusesMap = new HashMap < > ( ) ; for ( ComponentStatus expectedStatus : expectedCompStatList ) { expectedStatusesMap . put ( expectedStatus . getComponent ( ) . getType ( ) , expectedStatus ) ; } for ( ComponentTypeEnum expectedStatus : expectedStatusesMap . keySet ( ) ) { boolean found = false ; ComponentStatus status = expectedStatusesMap . get ( expectedStatus ) ; for ( ComponentStatus newStatuses : compStatuses ) { assertThat ( newStatuses , notNullValue ( ) ) ; if ( newStatuses . getComponent ( ) . getDescription ( ) . equals ( status . getComponent ( ) . getDescription ( ) ) ) { found = true ; assertThat ( newStatuses . getComponent ( ) . getType ( ) , is ( status . getComponent ( ) . getType ( ) ) ) ; assertThat ( newStatuses . getStatus ( ) . getSummary ( ) , is ( status . getStatus ( ) . getSummary ( ) ) ) ; assertThat ( newStatuses . getStatus ( ) . getDescription ( ) , is ( status . getStatus ( ) . getDescription ( ) ) ) ; break ; } } assertThat ( String . format ( "Looking for component status: " + "Type: %s Description: %s but it was not found in the status returned." , status . getComponent ( ) . getType ( ) , status . getComponent ( ) . getDescription ( ) ) , found , is ( true ) ) ; } }
Function to verify that the component statuses match the given map of component statuses.
Function to verify that the component statuses match the given map of component statuses .