-
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.
feat: included network_id as part of the primary key for fare_leg_rul…
…es.txt (#1894) * included network_id as part of the primary key for fare_leg_rules.txt * rewrote noDuplicateKeyNoticeWithNetworkIdAsPrimaryKey test and wrote duplicateKeyNoticeWithNetworkIdAsPrimaryKey test
- Loading branch information
Showing
2 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
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
42 changes: 42 additions & 0 deletions
42
main/src/test/java/org/mobilitydata/gtfsvalidator/table/GtfsFareLegRuleDuplicateKeyTest.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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package org.mobilitydata.gtfsvalidator.table; | ||
|
||
import static com.google.common.truth.Truth.assertThat; | ||
|
||
import org.junit.Before; | ||
import org.junit.Test; | ||
import org.mobilitydata.gtfsvalidator.testing.LoadingHelper; | ||
import org.mobilitydata.gtfsvalidator.validator.ValidatorLoaderException; | ||
|
||
public class GtfsFareLegRuleDuplicateKeyTest { | ||
private LoadingHelper helper; | ||
private GtfsFareLegRuleTableDescriptor tableDescriptor; | ||
|
||
@Before | ||
public void setup() { | ||
tableDescriptor = new GtfsFareLegRuleTableDescriptor(); | ||
helper = new LoadingHelper(); | ||
} | ||
|
||
@Test | ||
public void noDuplicateKeyNoticeWithNetworkIdAsPrimaryKey() throws ValidatorLoaderException { | ||
GtfsFareLegRuleTableContainer tableContainer = | ||
helper.load( | ||
tableDescriptor, | ||
"network_id,from_area_id,to_area_id,from_timeframe_group_id,to_timeframe_group_id,fare_product_id", | ||
"network1,area1,area2,timeframe1,timeframe2,fare1", | ||
"network2,area1,area2,timeframe1,timeframe2,fare1"); | ||
assertThat(helper.getValidationNotices()).isEmpty(); | ||
} | ||
|
||
@Test | ||
public void duplicateKeyNoticeWithNetworkIdAsPrimaryKey() throws ValidatorLoaderException { | ||
GtfsFareLegRuleTableContainer tableContainer = | ||
helper.load( | ||
tableDescriptor, | ||
"network_id,from_area_id,to_area_id,from_timeframe_group_id,to_timeframe_group_id,fare_product_id", | ||
"network1,area1,area2,timeframe1,timeframe2,fare1", | ||
"network1,area1,area2,timeframe1,timeframe2,fare1"); | ||
assertThat(helper.getValidationNotices()).hasSize(1); | ||
assertThat(helper.getValidationNotices().get(0).getCode()).isEqualTo("duplicate_key"); | ||
} | ||
} |