package com.scaleset.geo.geojson;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.GeometryFactory;
import com.vividsolutions.jts.geom.Point;
import org.junit.Assert;
import org.junit.Test;

import java.io.IOException;

public class GeoJsonModuleTest extends Assert {

    private GeometryFactory factory = new GeometryFactory();
    private ObjectMapper mapper = new ObjectMapper().registerModule(new GeoJsonModule());

    @Test
    public void testSerializePoint() throws IOException {
        Point point = factory.createPoint(new Coordinate(-78, 39));
        String json = mapper.writeValueAsString(point);
        assertEquals("{\"type\":\"Point\",\"coordinates\":[-78.0,39.0]}", json);
    }

    @Test
    public void testDeserializePolygon() throws IOException {
        String json = "{\"point\": {\"type\":\"Point\",\"coordinates\":[-78.0,39.0]}}";
        HasGeometry hasGeometry = mapper.readValue(json, HasGeometry.class);
        assertNotNull(hasGeometry);
    }


    @JsonIgnoreProperties(ignoreUnknown = true)
    static class HasGeometry {
        public Point point;
    }
}

@@ -194,16 +194,49 @@
 Mapper;%0A
+import com.scaleset.geo.Feature;%0A
 import c
@@ -928,59 +928,493 @@
     
-%7D%0A%0A    @Test%0A    public void testDeserializePolygon
+    Point p2 = mapper.readValue(json, Point.class);%0A        assertEquals(point, p2);%0A    %7D%0A%0A    @Test%0A    public void testSimpleFeature() throws IOException %7B%0A        Point point = factory.createPoint(new Coordinate(-78, 39));%0A        Feature feature = new Feature();%0A        feature.setGeometry(point);%0A        feature.getProperties().put(%22title%22, %22Simple Point Feature%22);%0A        String json = mapper.writeValueAsString(feature);%0A    %7D%0A%0A    @Test%0A    public void testDeserializePoint
 () t

Add example of using Feature class