content: package com.alibaba.fastjson2.geo;
  
  import com.alibaba.fastjson2.JSON;
  import com.alibaba.fastjson2.support.geo.FeatureCollection;
  import com.alibaba.fastjson2.support.geo.Geometry;
  import org.junit.jupiter.api.Test;
  import org.skyscreamer.jsonassert.JSONAssert;
  
  import static org.junit.jupiter.api.Assertions.assertEquals;
  
  public class FeatureCollectionTest {
      @Test
      public void test_geo() throws Exception {
          String str = "{\n" +
                  "    \"type\": \"FeatureCollection\",\n" +
                  "    \"features\": [{\n" +
                  "       \"type\": \"Feature\",\n" +
                  "       \"geometry\": {\n" +
                  "           \"type\": \"Point\",\n" +
                  "           \"coordinates\": [102.0, 0.5]\n" +
                  "       },\n" +
                  "       \"properties\": {\n" +
                  "           \"prop0\": \"value0\"\n" +
                  "       }\n" +
                  "    }, {\n" +
                  "       \"type\": \"Feature\",\n" +
                  "       \"geometry\": {\n" +
                  "           \"type\": \"LineString\",\n" +
                  "           \"coordinates\": [\n" +
                  "               [102.0, 0.0],\n" +
                  "               [103.0, 1.0],\n" +
                  "               [104.0, 0.0],\n" +
                  "               [105.0, 1.0]\n" +
                  "           ]\n" +
                  "       },\n" +
                  "       \"properties\": {\n" +
                  "           \"prop0\": \"value0\",\n" +
                  "           \"prop1\": 0.0\n" +
                  "       }\n" +
                  "    }, {\n" +
                  "       \"type\": \"Feature\",\n" +
                  "       \"geometry\": {\n" +
                  "           \"type\": \"Polygon\",\n" +
                  "           \"coordinates\": [\n" +
                  "               [\n" +
                  "                   [100.0, 0.0],\n" +
                  "                   [101.0, 0.0],\n" +
                  "                   [101.0, 1.0],\n" +
                  "                   [100.0, 1.0],\n" +
                  "                   [100.0, 0.0]\n" +
                  "               ]\n" +
                  "           ]\n" +
                  "       },\n" +
                  "       \"properties\": {\n" +
                  "           \"prop0\": \"value0\",\n" +
                  "           \"prop1\": {\n" +
                  "               \"this\": \"that\"\n" +
                  "           }\n" +
                  "       }\n" +
                  "    }]\n" +
                  "}\n";
  
          Geometry geometry = JSON.parseObject(str, Geometry.class);
          assertEquals(FeatureCollection.class, geometry.getClass());
  
          JSONAssert.assertEquals("{\"type\":\"FeatureCollection\",\"features\":[{\"type\":\"Feature\",\"properties\":{\"prop0\":\"value0\"},\"geometry\":{\"type\":\"Point\",\"coordinates\":[102.0,0.5]}},{\"type\":\"Feature\",\"properties\":{\"prop1\":\"0.0\",\"prop0\":\"value0\"},\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[102.0,0.0],[103.0,1.0],[104.0,0.0],[105.0,1.0]]}},{\"type\":\"Feature\",\"properties\":{\"prop1\":\"{\\\"this\\\":\\\"that\\\"}\",\"prop0\":\"value0\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[100.0,0.0],[101.0,0.0],[101.0,1.0],[100.0,1.0],[100.0,0.0]]]}}]}", JSON.toJSONString(geometry), true);
  
          String str2 = JSON.toJSONString(geometry);
          JSONAssert.assertEquals(str2, JSON.toJSONString(JSON.parseObject(str2, Geometry.class)), true);
      }
  }
  