Skip to content

Commit 781206c

Browse files
authored
checked the stop access column not just values (#2143)
1 parent c437e10 commit 781206c

2 files changed

Lines changed: 27 additions & 1 deletion

File tree

main/src/main/java/org/mobilitydata/gtfsvalidator/validator/StopAccessValidator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
public class StopAccessValidator extends SingleEntityValidator<GtfsStop> {
2626
@Override
2727
public void validate(GtfsStop entity, NoticeContainer noticeContainer) {
28-
if (entity.stopAccess() == null) {
28+
if (entity.stopAccess() == null || !entity.hasStopAccess()) {
2929
return;
3030
}
3131
if (entity.locationType() == GtfsLocationType.STOP) {

main/src/test/java/org/mobilitydata/gtfsvalidator/validator/StopAccessValidatorTest.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,30 @@ public void nonStopLocationWithStopAccess_generatesIncorrectLocationNotice() {
6161
GtfsStopAccess.NOT_ACCESSIBLE_VIA_PATHWAYS,
6262
GtfsLocationType.STATION));
6363
}
64+
65+
@Test
66+
public void stopLocationWithoutParentStation_withoutStopAccess_generatesNoNotice() {
67+
GtfsStop stop =
68+
new GtfsStop.Builder()
69+
.setCsvRowNumber(10)
70+
.setStopId("S3")
71+
.setLocationType(GtfsLocationType.STOP)
72+
.setStopName("Stop 3")
73+
.build();
74+
75+
assertThat(generateNotices(stop)).isEmpty();
76+
}
77+
78+
@Test
79+
public void nonStopLocation_withoutStopAccess_generatesNoNotice() {
80+
GtfsStop stop =
81+
new GtfsStop.Builder()
82+
.setCsvRowNumber(11)
83+
.setStopId("S4")
84+
.setLocationType(GtfsLocationType.STATION)
85+
.setStopName("Stop 4")
86+
.build();
87+
88+
assertThat(generateNotices(stop)).isEmpty();
89+
}
6490
}

0 commit comments

Comments
 (0)