Skip to content

Commit d96ac84

Browse files
committed
Fixes geojson GeometryDeserializer.java and tests (#42)
1 parent 725c3a2 commit d96ac84

5 files changed

Lines changed: 17 additions & 11 deletions

File tree

libjava/lib/src/main/java/com/mapbox/services/commons/geojson/custom/GeometryDeserializer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public Geometry deserialize(JsonElement json, Type typeOfT, JsonDeserializationC
2121
String geometryType = json.getAsJsonObject().get("type").getAsString();
2222
try {
2323
// Use the current context to deserialize it
24-
Type classType = Class.forName("com.mapbox.services.geojson." + geometryType);
24+
Type classType = Class.forName("com.mapbox.services.commons.geojson." + geometryType);
2525
return context.deserialize(json, classType);
2626
} catch (ClassNotFoundException e) {
2727
// Unknown geometry

libjava/lib/src/test/java/com/mapbox/services/geojson/FeatureCollectionTest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.mapbox.services.geojson;
22

3+
import com.mapbox.services.commons.geojson.FeatureCollection;
4+
35
import org.junit.Test;
46

57
import static org.junit.Assert.assertEquals;
@@ -11,7 +13,7 @@ public class FeatureCollectionTest extends BaseGeoJSON {
1113

1214
@Test
1315
public void fromJson() {
14-
com.mapbox.services.commons.geojson.FeatureCollection geo = com.mapbox.services.commons.geojson.FeatureCollection.fromJson(BaseGeoJSON.SAMPLE_FEATURECOLLECTION);
16+
FeatureCollection geo = FeatureCollection.fromJson(BaseGeoJSON.SAMPLE_FEATURECOLLECTION);
1517
assertEquals(geo.getType(), "FeatureCollection");
1618
assertEquals(geo.getFeatures().size(), 3);
1719
assertEquals(geo.getFeatures().get(0).getType(), "Feature");
@@ -24,7 +26,7 @@ public void fromJson() {
2426

2527
@Test
2628
public void toJson() {
27-
com.mapbox.services.commons.geojson.FeatureCollection geo = com.mapbox.services.commons.geojson.FeatureCollection.fromJson(BaseGeoJSON.SAMPLE_FEATURECOLLECTION);
29+
FeatureCollection geo = FeatureCollection.fromJson(BaseGeoJSON.SAMPLE_FEATURECOLLECTION);
2830
compareJson(BaseGeoJSON.SAMPLE_FEATURECOLLECTION, geo.toJson());
2931
}
3032

libjava/lib/src/test/java/com/mapbox/services/geojson/FeatureTest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.mapbox.services.geojson;
22

3+
import com.mapbox.services.commons.geojson.Feature;
4+
35
import org.junit.Test;
46

57
import static org.junit.Assert.assertEquals;
@@ -11,15 +13,15 @@ public class FeatureTest extends BaseGeoJSON {
1113

1214
@Test
1315
public void fromJson() {
14-
com.mapbox.services.commons.geojson.Feature geo = com.mapbox.services.commons.geojson.Feature.fromJson(BaseGeoJSON.SAMPLE_FEATURE);
16+
Feature geo = Feature.fromJson(BaseGeoJSON.SAMPLE_FEATURE);
1517
assertEquals(geo.getType(), "Feature");
1618
assertEquals(geo.getGeometry().getType(), "Point");
1719
assertEquals(geo.getProperties().get("name").getAsString(), "Dinagat Islands");
1820
}
1921

2022
@Test
2123
public void toJson() {
22-
com.mapbox.services.commons.geojson.Feature geo = com.mapbox.services.commons.geojson.Feature.fromJson(BaseGeoJSON.SAMPLE_FEATURE);
24+
Feature geo = Feature.fromJson(BaseGeoJSON.SAMPLE_FEATURE);
2325
compareJson(BaseGeoJSON.SAMPLE_FEATURE, geo.toJson());
2426
}
2527

libjava/lib/src/test/java/com/mapbox/services/geojson/GeometryCollectionTest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.mapbox.services.geojson;
22

3+
import com.mapbox.services.commons.geojson.GeometryCollection;
4+
35
import org.junit.Test;
46

57
import static org.junit.Assert.*;
@@ -11,15 +13,15 @@ public class GeometryCollectionTest extends BaseGeoJSON {
1113

1214
@Test
1315
public void fromJson() {
14-
com.mapbox.services.commons.geojson.GeometryCollection geo = com.mapbox.services.commons.geojson.GeometryCollection.fromJson(BaseGeoJSON.SAMPLE_GEOMETRYCOLLECTION);
16+
GeometryCollection geo = GeometryCollection.fromJson(BaseGeoJSON.SAMPLE_GEOMETRYCOLLECTION);
1517
assertEquals(geo.getType(), "GeometryCollection");
1618
assertEquals(geo.getGeometries().get(0).getType(), "Point");
1719
assertEquals(geo.getGeometries().get(1).getType(), "LineString");
1820
}
1921

2022
@Test
2123
public void toJson() {
22-
com.mapbox.services.commons.geojson.GeometryCollection geo = com.mapbox.services.commons.geojson.GeometryCollection.fromJson(BaseGeoJSON.SAMPLE_GEOMETRYCOLLECTION);
24+
GeometryCollection geo = GeometryCollection.fromJson(BaseGeoJSON.SAMPLE_GEOMETRYCOLLECTION);
2325
compareJson(BaseGeoJSON.SAMPLE_GEOMETRYCOLLECTION, geo.toJson());
2426
}
2527

scripts/bitrise.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,15 @@ workflows:
6666
- content: |-
6767
#!/bin/bash
6868
cd libjava
69-
./gradlew testReleaseUnitTest --continue
69+
./gradlew test
7070
- is_debug: 'yes'
7171
- script:
7272
title: Run Android Project Unit Tests
7373
inputs:
7474
- content: |-
7575
#!/bin/bash
7676
cd libandroid
77-
./gradlew testReleaseUnitTest --continue
77+
./gradlew test
7878
- is_debug: 'yes'
7979
- slack:
8080
title: Post to Slack
@@ -155,14 +155,14 @@ workflows:
155155
- content: |-
156156
#!/bin/bash
157157
cd libjava
158-
./gradlew testReleaseUnitTest --continue
158+
./gradlew test
159159
- script:
160160
title: Run Android Project Unit Tests
161161
inputs:
162162
- content: |-
163163
#!/bin/bash
164164
cd libandroid
165-
./gradlew testReleaseUnitTest --continue
165+
./gradlew test
166166
- script:
167167
title: Publish Java Services To Maven Central
168168
inputs:

0 commit comments

Comments
 (0)