Skip to content

Commit 708a84c

Browse files
authored
Update ShorteningTest.java
1 parent f9596c8 commit 708a84c

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

java/com/google/openlocationcode/tests/ShorteningTest.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,18 @@ private class TestData {
2323
private final double referenceLatitude;
2424
private final double referenceLongitude;
2525
private final String shortCode;
26+
private final String testType;
2627

2728
public TestData(String line) {
2829
String[] parts = line.split(",");
29-
if (parts.length != 4) {
30+
if (parts.length != 5) {
3031
throw new IllegalArgumentException("Wrong format of testing data.");
3132
}
3233
this.code = parts[0];
3334
this.referenceLatitude = Double.valueOf(parts[1]);
3435
this.referenceLongitude = Double.valueOf(parts[2]);
3536
this.shortCode = parts[3];
37+
this.testType = parts[4];
3638
}
3739
}
3840

@@ -55,6 +57,9 @@ public void setUp() throws Exception {
5557
@Test
5658
public void testShortening() {
5759
for (TestData testData : testDataList) {
60+
if (testData.testType != "B" && testData.testType != "S") {
61+
continue;
62+
}
5863
OpenLocationCode olc = new OpenLocationCode(testData.code);
5964
OpenLocationCode shortened =
6065
olc.shorten(testData.referenceLatitude, testData.referenceLongitude);
@@ -68,6 +73,9 @@ public void testShortening() {
6873
@Test
6974
public void testRecovering() {
7075
for (TestData testData : testDataList) {
76+
if (testData.testType != "B" && testData.testType != "R") {
77+
continue;
78+
}
7179
OpenLocationCode olc = new OpenLocationCode(testData.shortCode);
7280
OpenLocationCode recovered =
7381
olc.recover(testData.referenceLatitude, testData.referenceLongitude);

0 commit comments

Comments
 (0)