-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
15 additions
and
17 deletions.
There are no files selected for viewing
32 changes: 15 additions & 17 deletions
32
...est/java/org/mobilitydata/gtfsvalidator/validator/BidirectionalExitGateValidatorTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,42 @@ | ||
package org.mobilitydata.gtfsvalidator.validator; | ||
|
||
import static com.google.common.truth.Truth.assertThat; | ||
|
||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.junit.runners.JUnit4; | ||
import org.mobilitydata.gtfsvalidator.notice.NoticeContainer; | ||
import org.mobilitydata.gtfsvalidator.table.GtfsPathway; | ||
import org.mobilitydata.gtfsvalidator.table.GtfsPathwayIsBidirectional; | ||
|
||
|
||
import static com.google.common.truth.Truth.assertThat; | ||
|
||
@RunWith(JUnit4.class) | ||
public class BidirectionalExitGateValidatorTest { | ||
public static GtfsPathway createPathway(int csvRowNumber, Integer pathwayMode, GtfsPathwayIsBidirectional gtfsPathwayIsBidirectional) { | ||
public static GtfsPathway createPathway( | ||
int csvRowNumber, | ||
Integer pathwayMode, | ||
GtfsPathwayIsBidirectional gtfsPathwayIsBidirectional) { | ||
return new GtfsPathway.Builder() | ||
.setCsvRowNumber(csvRowNumber) | ||
.setPathwayMode(pathwayMode) | ||
.setIsBidirectional(gtfsPathwayIsBidirectional) | ||
.build(); | ||
.setCsvRowNumber(csvRowNumber) | ||
.setPathwayMode(pathwayMode) | ||
.setIsBidirectional(gtfsPathwayIsBidirectional) | ||
.build(); | ||
} | ||
|
||
/** | ||
* Tests that a pathway with bidirectional exit gates generates a notice. | ||
*/ | ||
/** Tests that a pathway with bidirectional exit gates generates a notice. */ | ||
@Test | ||
public void isBidirectionalExitGateShouldGenerateNotice() { | ||
GtfsPathway entity = createPathway(1, 7, GtfsPathwayIsBidirectional.BIDIRECTIONAL); | ||
NoticeContainer noticeContainer = new NoticeContainer(); | ||
new BidirectionalExitGateValidator() | ||
.validate(entity, noticeContainer); | ||
assertThat(noticeContainer.getValidationNotices()).containsExactly( | ||
new BidirectionalExitGateValidator.BidirectionalExitGatesNotice(entity)); | ||
new BidirectionalExitGateValidator().validate(entity, noticeContainer); | ||
assertThat(noticeContainer.getValidationNotices()) | ||
.containsExactly(new BidirectionalExitGateValidator.BidirectionalExitGatesNotice(entity)); | ||
} | ||
|
||
@Test | ||
public void isNotBidirectionalExitGateShouldNotGenerateNotice() { | ||
GtfsPathway entity = createPathway(1, 7, GtfsPathwayIsBidirectional.UNIDIRECTIONAL); | ||
NoticeContainer noticeContainer = new NoticeContainer(); | ||
new BidirectionalExitGateValidator() | ||
.validate(entity, noticeContainer); | ||
new BidirectionalExitGateValidator().validate(entity, noticeContainer); | ||
assertThat(noticeContainer.getValidationNotices()).isEmpty(); | ||
} | ||
} |