Skip to content

Commit

Permalink
apply info severity to feed exp date <= 30 days
Browse files Browse the repository at this point in the history
  • Loading branch information
KClough committed Aug 24, 2022
1 parent 00c8760 commit 40c94f4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public void validate(GtfsFeedInfo entity, NoticeContainer noticeContainer) {
noticeContainer.addValidationNotice(
new FeedExpirationDateNotice(
entity.csvRowNumber(),
SeverityLevel.WARNING,
currentDate,
entity.feedEndDate(),
currentDatePlusSevenDays));
Expand All @@ -66,6 +67,7 @@ public void validate(GtfsFeedInfo entity, NoticeContainer noticeContainer) {
noticeContainer.addValidationNotice(
new FeedExpirationDateNotice(
entity.csvRowNumber(),
SeverityLevel.INFO,
currentDate,
entity.feedEndDate(),
currentDatePlusThirtyDays));
Expand All @@ -81,10 +83,11 @@ static class FeedExpirationDateNotice extends ValidationNotice {

FeedExpirationDateNotice(
long csvRowNumber,
SeverityLevel severity,
GtfsDate currentDate,
GtfsDate feedEndDate,
GtfsDate suggestedExpirationDate) {
super(SeverityLevel.WARNING);
super(severity);
this.csvRowNumber = csvRowNumber;
this.currentDate = currentDate;
this.feedEndDate = feedEndDate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.junit.Test;
import org.mobilitydata.gtfsvalidator.input.CurrentDateTime;
import org.mobilitydata.gtfsvalidator.notice.NoticeContainer;
import org.mobilitydata.gtfsvalidator.notice.SeverityLevel;
import org.mobilitydata.gtfsvalidator.notice.ValidationNotice;
import org.mobilitydata.gtfsvalidator.table.GtfsFeedInfo;
import org.mobilitydata.gtfsvalidator.type.GtfsDate;
Expand Down Expand Up @@ -58,6 +59,7 @@ public void feedExpiringInFiveDaysFromNowShouldGenerateNotice() {
.containsExactly(
new FeedExpirationDateNotice(
1,
SeverityLevel.WARNING,
GtfsDate.fromLocalDate(TEST_NOW.toLocalDate()),
GtfsDate.fromLocalDate(TEST_NOW.toLocalDate().plusDays(3)),
GtfsDate.fromLocalDate(TEST_NOW.toLocalDate().plusDays(7))));
Expand All @@ -71,6 +73,7 @@ public void feedExpiringInSevenDaysFromNowShouldGenerateNotice() {
.containsExactly(
new FeedExpirationDateNotice(
1,
SeverityLevel.INFO,
GtfsDate.fromLocalDate(TEST_NOW.toLocalDate()),
GtfsDate.fromLocalDate(TEST_NOW.toLocalDate().plusDays(7)),
GtfsDate.fromLocalDate(TEST_NOW.toLocalDate().plusDays(30))));
Expand All @@ -84,6 +87,7 @@ public void feedExpiring7to30DaysFromNowShouldGenerateNotice() {
.containsExactly(
new FeedExpirationDateNotice(
1,
SeverityLevel.INFO,
GtfsDate.fromLocalDate(TEST_NOW.toLocalDate()),
GtfsDate.fromLocalDate(TEST_NOW.toLocalDate().plusDays(23)),
GtfsDate.fromLocalDate(TEST_NOW.toLocalDate().plusDays(30))));
Expand All @@ -97,6 +101,7 @@ public void feedExpiring30DaysFromNowShouldGenerateNotice() {
.containsExactly(
new FeedExpirationDateNotice(
1,
SeverityLevel.INFO,
GtfsDate.fromLocalDate(TEST_NOW.toLocalDate()),
GtfsDate.fromLocalDate(TEST_NOW.toLocalDate().plusDays(30)),
GtfsDate.fromLocalDate(TEST_NOW.toLocalDate().plusDays(30))));
Expand Down

0 comments on commit 40c94f4

Please sign in to comment.