Search in sources :

Example 1 with StopLocationTypeValidator

use of edu.usf.cutr.gtfsrtvalidator.lib.validation.gtfs.StopLocationTypeValidator in project gtfs-realtime-validator by CUTR-at-USF.

the class StopLocationTypeValidatorTest method testE010.

/**
 * E010 - If location_type is used in stops.txt, all stops referenced in stop_times.txt must have location_type of 0
 */
@Test
public void testE010() {
    StopLocationTypeValidator stopLocationValidator = new StopLocationTypeValidator();
    Map<ValidationRule, Integer> expected = new HashMap<>();
    // gtfsData does not contain location_type = 1 for stop_id. Therefore returns 0 results
    results = stopLocationValidator.validate(gtfsData);
    for (ErrorListHelperModel error : results) {
        assertEquals(0, error.getOccurrenceList().size());
    }
    // gtfsData2 contains location_type = 1 for stop_ids. Therefore returns errorcount = (number of location_type = 1 for stop_ids)
    results = stopLocationValidator.validate(gtfsData2);
    expected.put(E010, 1);
    TestUtils.assertResults(expected, results);
    clearAndInitRequiredFeedFields();
}
Also used : ErrorListHelperModel(edu.usf.cutr.gtfsrtvalidator.lib.model.helper.ErrorListHelperModel) StopLocationTypeValidator(edu.usf.cutr.gtfsrtvalidator.lib.validation.gtfs.StopLocationTypeValidator) HashMap(java.util.HashMap) ValidationRule(edu.usf.cutr.gtfsrtvalidator.lib.model.ValidationRule) Test(org.junit.Test) FeedMessageTest(edu.usf.cutr.gtfsrtvalidator.lib.test.FeedMessageTest)

Aggregations

ValidationRule (edu.usf.cutr.gtfsrtvalidator.lib.model.ValidationRule)1 ErrorListHelperModel (edu.usf.cutr.gtfsrtvalidator.lib.model.helper.ErrorListHelperModel)1 FeedMessageTest (edu.usf.cutr.gtfsrtvalidator.lib.test.FeedMessageTest)1 StopLocationTypeValidator (edu.usf.cutr.gtfsrtvalidator.lib.validation.gtfs.StopLocationTypeValidator)1 HashMap (java.util.HashMap)1 Test (org.junit.Test)1