From dee5802afc2f0e37b0299a5d6dca192c08ee4af8 Mon Sep 17 00:00:00 2001 From: Michael Kearney Date: Tue, 12 Mar 2024 12:34:13 -0400 Subject: [PATCH] fix: correct field name in missing_recommended_field_notice (#1574) (#1706) --- .../validator/AgencyConsistencyValidator.java | 4 +++- .../validator/AgencyConsistencyValidatorTest.java | 8 ++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/main/src/main/java/org/mobilitydata/gtfsvalidator/validator/AgencyConsistencyValidator.java b/main/src/main/java/org/mobilitydata/gtfsvalidator/validator/AgencyConsistencyValidator.java index 2e5821416f..5f807a3224 100644 --- a/main/src/main/java/org/mobilitydata/gtfsvalidator/validator/AgencyConsistencyValidator.java +++ b/main/src/main/java/org/mobilitydata/gtfsvalidator/validator/AgencyConsistencyValidator.java @@ -62,7 +62,9 @@ public void validate(NoticeContainer noticeContainer) { if (!agency.hasAgencyId()) { noticeContainer.addValidationNotice( new MissingRecommendedFieldNotice( - agencyTable.gtfsFilename(), agency.csvRowNumber(), agency.agencyName())); + agencyTable.gtfsFilename(), + agency.csvRowNumber(), + GtfsAgency.AGENCY_ID_FIELD_NAME)); } // no further validation required return; diff --git a/main/src/test/java/org/mobilitydata/gtfsvalidator/validator/AgencyConsistencyValidatorTest.java b/main/src/test/java/org/mobilitydata/gtfsvalidator/validator/AgencyConsistencyValidatorTest.java index 806c80ba63..6b301f36c0 100644 --- a/main/src/test/java/org/mobilitydata/gtfsvalidator/validator/AgencyConsistencyValidatorTest.java +++ b/main/src/test/java/org/mobilitydata/gtfsvalidator/validator/AgencyConsistencyValidatorTest.java @@ -72,7 +72,9 @@ public void singleAgencyPresentButNoAgencyIdSetShouldGenerateWarningNotice() { ZoneId.of("America/Montreal"), Locale.CANADA))); assertThat(notices) - .containsExactly(new MissingRecommendedFieldNotice("agency.txt", 0, "agency name")); + .containsExactly( + new MissingRecommendedFieldNotice( + GtfsAgency.FILENAME, 0, GtfsAgency.AGENCY_ID_FIELD_NAME)); } @Test @@ -95,7 +97,9 @@ public void multipleAgenciesPresentButNoAgencyIdSetShouldGenerateErrorNotice() { ZoneId.of("America/Montreal"), Locale.CANADA))); assertThat(notices) - .containsExactly(new MissingRequiredFieldNotice("agency.txt", 1, "agency_id")); + .containsExactly( + new MissingRequiredFieldNotice( + GtfsAgency.FILENAME, 1, GtfsAgency.AGENCY_ID_FIELD_NAME)); } @Test