Skip to content

Commit 19b2f0a

Browse files
committed
Update tests with required files
1 parent 2f3e541 commit 19b2f0a

File tree

4 files changed

+40
-1
lines changed

4 files changed

+40
-1
lines changed

src/test/java/org/entur/gbfs/validation/validator/GbfsJsonValidatorTest.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ void testEmptyDeliveryMapValidation() {
3333
GbfsJsonValidator validator = new GbfsJsonValidator();
3434
Map<String, InputStream> deliveryMap = new HashMap<>();
3535
ValidationResult result = validator.validate(deliveryMap);
36-
Assertions.assertEquals(0, result.getSummary().getErrorsCount());
36+
37+
// The expected error count is 2, because there are two required files
38+
// missing in an empty delivery, gbfs.json, and system_information.json
39+
Assertions.assertEquals(2, result.getSummary().getErrorsCount());
3740
}
3841

3942
@Test
@@ -42,6 +45,7 @@ void testSuccessfulV1_0Validation() {
4245

4346
Map<String, InputStream> deliveryMap = new HashMap<>();
4447
deliveryMap.put("gbfs", getFixture("fixtures/v1.0/gbfs.json"));
48+
deliveryMap.put("system_information", getFixture("fixtures/v1.0/system_information.json"));
4549
deliveryMap.put("system_hours", getFixture("fixtures/v1.0/system_hours.json"));
4650

4751
ValidationResult result = validator.validate(deliveryMap);
@@ -59,6 +63,7 @@ void testSuccessfulV1_1Validation() {
5963
Map<String, InputStream> deliveryMap = new HashMap<>();
6064
deliveryMap.put("gbfs", getFixture("fixtures/v1.1/gbfs.json"));
6165
deliveryMap.put("gbfs_versions", getFixture("fixtures/v1.1/gbfs_versions.json"));
66+
deliveryMap.put("system_information", getFixture("fixtures/v1.1/system_information.json"));
6267
deliveryMap.put("system_hours", getFixture("fixtures/v1.1/system_hours.json"));
6368

6469
ValidationResult result = validator.validate(deliveryMap);
@@ -76,6 +81,7 @@ void testSuccessfulV2_0Validation() {
7681
Map<String, InputStream> deliveryMap = new HashMap<>();
7782
deliveryMap.put("gbfs", getFixture("fixtures/v2.0/gbfs.json"));
7883
deliveryMap.put("gbfs_versions", getFixture("fixtures/v2.0/gbfs_versions.json"));
84+
deliveryMap.put("system_information", getFixture("fixtures/v2.0/system_information.json"));
7985
deliveryMap.put("system_hours", getFixture("fixtures/v2.0/system_hours.json"));
8086

8187
ValidationResult result = validator.validate(deliveryMap);
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"last_updated":1611598155,
3+
"ttl":1800,
4+
"version": "1.0",
5+
"data":{
6+
"system_id":"exampleride",
7+
"language":"en",
8+
"name":"Example Ride",
9+
"timezone":"America/Chicago"
10+
}
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"last_updated":1611598155,
3+
"ttl":1800,
4+
"version": "1.1",
5+
"data":{
6+
"system_id":"exampleride",
7+
"language":"en",
8+
"name":"Example Ride",
9+
"timezone":"America/Chicago"
10+
}
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"last_updated":1611598155,
3+
"ttl":1800,
4+
"version": "2.0",
5+
"data":{
6+
"system_id":"exampleride",
7+
"language":"en",
8+
"name":"Example Ride",
9+
"timezone":"America/Chicago"
10+
}
11+
}

0 commit comments

Comments
 (0)