From 5f334fae481ca9303a5f25f7be52bd0767a70934 Mon Sep 17 00:00:00 2001 From: Jingsi Lu Date: Wed, 2 Oct 2024 14:32:43 -0400 Subject: [PATCH 1/5] removed @Recommended Column and modified MissingTimepointValue validation rule --- .../mobilitydata/gtfsvalidator/table/GtfsStopTimeSchema.java | 1 - .../gtfsvalidator/validator/TimepointTimeValidator.java | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/main/src/main/java/org/mobilitydata/gtfsvalidator/table/GtfsStopTimeSchema.java b/main/src/main/java/org/mobilitydata/gtfsvalidator/table/GtfsStopTimeSchema.java index 80561fe0ee..d19d913a6d 100644 --- a/main/src/main/java/org/mobilitydata/gtfsvalidator/table/GtfsStopTimeSchema.java +++ b/main/src/main/java/org/mobilitydata/gtfsvalidator/table/GtfsStopTimeSchema.java @@ -91,7 +91,6 @@ public interface GtfsStopTimeSchema extends GtfsEntity { double shapeDistTraveled(); @DefaultValue("1") - @RecommendedColumn GtfsStopTimeTimepoint timepoint(); @FieldType(FieldTypeEnum.ID) diff --git a/main/src/main/java/org/mobilitydata/gtfsvalidator/validator/TimepointTimeValidator.java b/main/src/main/java/org/mobilitydata/gtfsvalidator/validator/TimepointTimeValidator.java index 972a35d8f0..bcca748636 100644 --- a/main/src/main/java/org/mobilitydata/gtfsvalidator/validator/TimepointTimeValidator.java +++ b/main/src/main/java/org/mobilitydata/gtfsvalidator/validator/TimepointTimeValidator.java @@ -60,7 +60,7 @@ public void validate(NoticeContainer noticeContainer) { return; } for (GtfsStopTime stopTime : stopTimes.getEntities()) { - if (!stopTime.hasTimepoint()) { + if ((stopTime.hasArrivalTime() || stopTime.hasDepartureTime()) && !stopTime.hasTimepoint()) { noticeContainer.addValidationNotice(new MissingTimepointValueNotice(stopTime)); } if (isTimepoint(stopTime)) { From bcda5a363f1801d980e9a5c583ad1aa734e5a68d Mon Sep 17 00:00:00 2001 From: Jingsi Lu Date: Wed, 2 Oct 2024 14:50:27 -0400 Subject: [PATCH 2/5] fixed broken test --- .../mobilitydata/gtfsvalidator/table/GtfsStopTimeSchema.java | 1 - .../gtfsvalidator/validator/TimepointTimeValidatorTest.java | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/main/src/main/java/org/mobilitydata/gtfsvalidator/table/GtfsStopTimeSchema.java b/main/src/main/java/org/mobilitydata/gtfsvalidator/table/GtfsStopTimeSchema.java index d19d913a6d..93a48fa614 100644 --- a/main/src/main/java/org/mobilitydata/gtfsvalidator/table/GtfsStopTimeSchema.java +++ b/main/src/main/java/org/mobilitydata/gtfsvalidator/table/GtfsStopTimeSchema.java @@ -29,7 +29,6 @@ import org.mobilitydata.gtfsvalidator.annotation.Index; import org.mobilitydata.gtfsvalidator.annotation.NonNegative; import org.mobilitydata.gtfsvalidator.annotation.PrimaryKey; -import org.mobilitydata.gtfsvalidator.annotation.RecommendedColumn; import org.mobilitydata.gtfsvalidator.annotation.Required; import org.mobilitydata.gtfsvalidator.type.GtfsTime; diff --git a/main/src/test/java/org/mobilitydata/gtfsvalidator/validator/TimepointTimeValidatorTest.java b/main/src/test/java/org/mobilitydata/gtfsvalidator/validator/TimepointTimeValidatorTest.java index 8d3c3455fa..fc5332914f 100644 --- a/main/src/test/java/org/mobilitydata/gtfsvalidator/validator/TimepointTimeValidatorTest.java +++ b/main/src/test/java/org/mobilitydata/gtfsvalidator/validator/TimepointTimeValidatorTest.java @@ -201,7 +201,7 @@ public void nonTimepoint_timesProvided_shouldNotGenerateNotice() { } @Test - public void emptyTimepoint_noTimesProvided_shouldGenerateNotice() { + public void emptyTimepoint_noArrivalTime_noDepartureTime_noTimesProvided_shouldNotGenerateNotice() { // setting .setTimepoint(null) is used to define a missing value // (even if the timepoint value is included in header) List stopTimes = new ArrayList<>(); @@ -216,7 +216,7 @@ public void emptyTimepoint_noTimesProvided_shouldGenerateNotice() { .setTimepoint((Integer) null) .build()); assertThat(generateNotices(createHeaderWithTimepointColumn(), stopTimes)) - .containsExactly(new MissingTimepointValueNotice(stopTimes.get(0))); + .doesNotContain(new MissingTimepointValueNotice(stopTimes.get(0))); } @Test From f7723b9ca452a4bb904f09745675ae999a3f533c Mon Sep 17 00:00:00 2001 From: Jingsi Lu Date: Wed, 2 Oct 2024 15:04:44 -0400 Subject: [PATCH 3/5] reformatted code --- .../gtfsvalidator/validator/TimepointTimeValidatorTest.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main/src/test/java/org/mobilitydata/gtfsvalidator/validator/TimepointTimeValidatorTest.java b/main/src/test/java/org/mobilitydata/gtfsvalidator/validator/TimepointTimeValidatorTest.java index fc5332914f..52af6b8c73 100644 --- a/main/src/test/java/org/mobilitydata/gtfsvalidator/validator/TimepointTimeValidatorTest.java +++ b/main/src/test/java/org/mobilitydata/gtfsvalidator/validator/TimepointTimeValidatorTest.java @@ -201,7 +201,8 @@ public void nonTimepoint_timesProvided_shouldNotGenerateNotice() { } @Test - public void emptyTimepoint_noArrivalTime_noDepartureTime_noTimesProvided_shouldNotGenerateNotice() { + public void + emptyTimepoint_noArrivalTime_noDepartureTime_noTimesProvided_shouldNotGenerateNotice() { // setting .setTimepoint(null) is used to define a missing value // (even if the timepoint value is included in header) List stopTimes = new ArrayList<>(); From 369e5e6ec637994dab39d91f9f5b26203fa27481 Mon Sep 17 00:00:00 2001 From: Jingsi Lu Date: Mon, 7 Oct 2024 09:44:21 -0400 Subject: [PATCH 4/5] renamed test method --- .../gtfsvalidator/validator/TimepointTimeValidatorTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/src/test/java/org/mobilitydata/gtfsvalidator/validator/TimepointTimeValidatorTest.java b/main/src/test/java/org/mobilitydata/gtfsvalidator/validator/TimepointTimeValidatorTest.java index 52af6b8c73..3aacdab76d 100644 --- a/main/src/test/java/org/mobilitydata/gtfsvalidator/validator/TimepointTimeValidatorTest.java +++ b/main/src/test/java/org/mobilitydata/gtfsvalidator/validator/TimepointTimeValidatorTest.java @@ -202,7 +202,7 @@ public void nonTimepoint_timesProvided_shouldNotGenerateNotice() { @Test public void - emptyTimepoint_noArrivalTime_noDepartureTime_noTimesProvided_shouldNotGenerateNotice() { + emptyTimepoint_noArrivalTime_noDepartureTime_noTimePointProvided_shouldNotGenerateNotice() { // setting .setTimepoint(null) is used to define a missing value // (even if the timepoint value is included in header) List stopTimes = new ArrayList<>(); From f3cf34fd6addda8a02eeb24a398505a3d96829fd Mon Sep 17 00:00:00 2001 From: Jingsi Lu Date: Mon, 7 Oct 2024 09:50:09 -0400 Subject: [PATCH 5/5] formatted code --- .../gtfsvalidator/validator/TimepointTimeValidatorTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/src/test/java/org/mobilitydata/gtfsvalidator/validator/TimepointTimeValidatorTest.java b/main/src/test/java/org/mobilitydata/gtfsvalidator/validator/TimepointTimeValidatorTest.java index 3aacdab76d..dcdab56f47 100644 --- a/main/src/test/java/org/mobilitydata/gtfsvalidator/validator/TimepointTimeValidatorTest.java +++ b/main/src/test/java/org/mobilitydata/gtfsvalidator/validator/TimepointTimeValidatorTest.java @@ -202,7 +202,7 @@ public void nonTimepoint_timesProvided_shouldNotGenerateNotice() { @Test public void - emptyTimepoint_noArrivalTime_noDepartureTime_noTimePointProvided_shouldNotGenerateNotice() { + emptyTimepoint_noArrivalTime_noDepartureTime_noTimePointProvided_shouldNotGenerateNotice() { // setting .setTimepoint(null) is used to define a missing value // (even if the timepoint value is included in header) List stopTimes = new ArrayList<>();