Skip to content

Commit

Permalink
merge: master
Browse files Browse the repository at this point in the history
  • Loading branch information
cka-y committed Oct 8, 2024
1 parent 06be75e commit a25b7c3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@
public class MissingStopsFileValidator extends FileValidator {

private final GtfsStopTableContainer stopTableContainer;
private final GtfsGeojsonFeaturesContainer geojsonFeaturesContainer;
private final GtfsGeoJSONFeaturesContainer geoJSONFeaturesContainer;

@Inject
MissingStopsFileValidator(
GtfsStopTableContainer table, GtfsGeojsonFeaturesContainer geojsonFeaturesContainer) {
GtfsStopTableContainer table, GtfsGeoJSONFeaturesContainer geoJSONFeaturesContainer) {
this.stopTableContainer = table;
this.geojsonFeaturesContainer = geojsonFeaturesContainer;
this.geoJSONFeaturesContainer = geoJSONFeaturesContainer;
}

@Override
public void validate(NoticeContainer noticeContainer) {
if (stopTableContainer.isMissingFile() && geojsonFeaturesContainer.isMissingFile()) {
if (stopTableContainer.isMissingFile() && geoJSONFeaturesContainer.isMissingFile()) {
noticeContainer.addValidationNotice(new MissingRequiredFileNotice("stops.txt"));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import org.junit.Test;
import org.mobilitydata.gtfsvalidator.notice.MissingRequiredFileNotice;
import org.mobilitydata.gtfsvalidator.notice.NoticeContainer;
import org.mobilitydata.gtfsvalidator.table.GtfsGeojsonFeaturesContainer;
import org.mobilitydata.gtfsvalidator.table.GtfsGeojsonFileDescriptor;
import org.mobilitydata.gtfsvalidator.table.GtfsGeoJSONFeaturesContainer;
import org.mobilitydata.gtfsvalidator.table.GtfsGeoJSONFileDescriptor;
import org.mobilitydata.gtfsvalidator.table.GtfsStopTableContainer;
import org.mobilitydata.gtfsvalidator.table.TableStatus;

Expand All @@ -16,12 +16,12 @@ public class MissingStopsFileValidatorTest {
public void stopsTxtMissingFileShouldGenerateNotice() {
// If stops.txt is missing and locations.geojson is missing, a notice should be generated
NoticeContainer noticeContainer = new NoticeContainer();
GtfsGeojsonFileDescriptor descriptor = new GtfsGeojsonFileDescriptor();
GtfsGeojsonFeaturesContainer geoJsonFeaturesContainer =
GtfsGeoJSONFileDescriptor descriptor = new GtfsGeoJSONFileDescriptor();
GtfsGeoJSONFeaturesContainer geoJSONFeaturesContainer =
descriptor.createContainerForInvalidStatus(TableStatus.MISSING_FILE);
GtfsStopTableContainer stopTableContainer =
GtfsStopTableContainer.forStatus(TableStatus.MISSING_FILE);
new MissingStopsFileValidator(stopTableContainer, geoJsonFeaturesContainer)
new MissingStopsFileValidator(stopTableContainer, geoJSONFeaturesContainer)
.validate(noticeContainer);
assertThat(noticeContainer.getValidationNotices())
.containsExactly(new MissingRequiredFileNotice("stops.txt"));
Expand All @@ -31,12 +31,12 @@ public void stopsTxtMissingFileShouldGenerateNotice() {
public void stopsTxtMissingFileShouldNotGenerateNotice() {
// If stops.txt is missing, but locations.geojson is present, no notice should be generated
NoticeContainer noticeContainer = new NoticeContainer();
GtfsGeojsonFileDescriptor descriptor = new GtfsGeojsonFileDescriptor();
GtfsGeojsonFeaturesContainer geoJsonFeaturesContainer =
GtfsGeoJSONFileDescriptor descriptor = new GtfsGeoJSONFileDescriptor();
GtfsGeoJSONFeaturesContainer geoJSONFeaturesContainer =
descriptor.createContainerForEntities(new ArrayList<>(), noticeContainer);
GtfsStopTableContainer stopTableContainer =
GtfsStopTableContainer.forStatus(TableStatus.MISSING_FILE);
new MissingStopsFileValidator(stopTableContainer, geoJsonFeaturesContainer)
new MissingStopsFileValidator(stopTableContainer, geoJSONFeaturesContainer)
.validate(noticeContainer);
assertThat(noticeContainer.getValidationNotices()).isEmpty();
}
Expand Down

0 comments on commit a25b7c3

Please sign in to comment.