GeoJsonReader { @Nullable public Geometry readGeometry(@Nullable final String json) { if (TextUtils.isEmpty(json)) { return null; } try { return readGeometry(new StringReader(json)); } catch (IOException ioe) { Log.w(TAG, ioe.getMessage()); } return null; } GeoJsonReader(); @Nullable Feature readFeature(@Nullable final String json); @NonNull Feature readFeature(@NonNull final Reader in); @Nullable FeatureCollection readFeatureCollection(@Nullable final String json); @NonNull FeatureCollection readFeatureCollection(@NonNull final Reader in); @Nullable Geometry readGeometry(@Nullable final String json); @NonNull Geometry readGeometry(@NonNull final Reader in); @NonNull Feature readFeature(@NonNull final JsonReader reader);  }
@Test public void testReadGeometryFromJsonString() throws Exception { final String json = TestHelper.getFixture("geometry_point.json"); final Geometry point = geoJsonReader.readGeometry(json); assertEquals(createPoint(gf, 47.2256258d, -1.5545135d), point); }
@Test public void testReadGeometryFromInvalidJsonString() throws Exception { final Geometry geometry = geoJsonReader.readGeometry(""); assertNull(geometry); }
@Test public void testReadGeometry() throws Exception { final StringReader reader = new StringReader(TestHelper.getFixture("geometry_point.json")); final Geometry point = geoJsonReader.readGeometry(reader); assertNotNull(point); assertEquals(createPoint(gf, 47.2256258d, -1.5545135d), point); }