### Question:
GeoJsonParser { ArrayList<GeoJsonFeature> getFeatures() { return mGeoJsonFeatures; } GeoJsonParser(JSONObject geoJsonFile); static Geometry parseGeometry(JSONObject geoJsonGeometry);  }### Answer:
@Test public void testParseGeometryCollection() throws Exception { GeoJsonParser parser = new GeoJsonParser(validGeometryCollection()); assertEquals(1, parser.getFeatures().size()); for (GeoJsonFeature feature : parser.getFeatures()) { assertEquals("GeometryCollection", feature.getGeometry().getGeometryType()); int size = 0; for (String property : feature.getPropertyKeys()) { size++; } assertEquals(2, size); assertEquals("Popsicles", feature.getId()); GeoJsonGeometryCollection geometry = ((GeoJsonGeometryCollection) feature.getGeometry()); assertEquals(1, geometry.getGeometries().size()); for (Geometry geoJsonGeometry : geometry.getGeometries()) { assertEquals("GeometryCollection", geoJsonGeometry.getGeometryType()); } } }
@Test public void testParseMultiPolygon() throws Exception { GeoJsonParser parser = new GeoJsonParser(validMultiPolygon()); assertEquals(1, parser.getFeatures().size()); GeoJsonFeature feature = parser.getFeatures().get(0); GeoJsonMultiPolygon polygon = ((GeoJsonMultiPolygon) feature.getGeometry()); assertEquals(2, polygon.getPolygons().size()); assertEquals(1, polygon.getPolygons().get(0).getCoordinates().size()); List<List<LatLng>> p1 = new ArrayList<>(); p1.add( new ArrayList<>( Arrays.asList( new LatLng(2, 102), new LatLng(2, 103), new LatLng(3, 103), new LatLng(3, 102), new LatLng(2, 102)))); assertEquals(p1, polygon.getPolygons().get(0).getCoordinates()); assertEquals(2, polygon.getPolygons().get(1).getCoordinates().size()); List<List<LatLng>> p2 = new ArrayList<>(); p2.add( new ArrayList<>( Arrays.asList( new LatLng(0, 100), new LatLng(0, 101), new LatLng(1, 101), new LatLng(1, 100), new LatLng(0, 100)))); p2.add( new ArrayList<>( Arrays.asList( new LatLng(0.2, 100.2), new LatLng(0.2, 100.8), new LatLng(0.8, 100.8), new LatLng(0.8, 100.2), new LatLng(0.2, 100.2)))); assertEquals(p2, polygon.getPolygons().get(1).getCoordinates()); }