/// <exception cref="org.codehaus.jackson.JsonParseException"/>
        /// <exception cref="System.IO.IOException"/>
        internal virtual bool testPolygon()
        {
            bool bAnswer = true;

            com.esri.core.geometry.Polygon polygon = new com.esri.core.geometry.Polygon();
            polygon.startPath(-97.06138, 32.837);
            polygon.lineTo(-97.06133, 32.836);
            polygon.lineTo(-97.06124, 32.834);
            polygon.lineTo(-97.06127, 32.832);
            polygon.startPath(-97.06326, 32.759);
            polygon.lineTo(-97.06298, 32.755);
            {
                org.codehaus.jackson.JsonParser polygonPathsWgs84Parser = factory.createJsonParser
                                                                              (com.esri.core.geometry.GeometryEngine.geometryToJson(spatialReferenceWGS84, polygon
                                                                                                                                    ));
                com.esri.core.geometry.MapGeometry mPolygonWGS84MP = com.esri.core.geometry.GeometryEngine
                                                                     .jsonToGeometry(polygonPathsWgs84Parser);
                NUnit.Framework.Assert.IsTrue(polygon.getPointCount() + 1 == ((com.esri.core.geometry.Polygon
                                                                               )mPolygonWGS84MP.getGeometry()).getPointCount());
                NUnit.Framework.Assert.IsTrue(polygon.getPoint(0).getX() == ((com.esri.core.geometry.Polygon
                                                                              )mPolygonWGS84MP.getGeometry()).getPoint(0).getX());
                NUnit.Framework.Assert.IsTrue(polygon.getPoint(0).getY() == ((com.esri.core.geometry.Polygon
                                                                              )mPolygonWGS84MP.getGeometry()).getPoint(0).getY());
                NUnit.Framework.Assert.IsTrue(polygon.getPathCount() == ((com.esri.core.geometry.Polygon
                                                                          )mPolygonWGS84MP.getGeometry()).getPathCount());
                NUnit.Framework.Assert.IsTrue(polygon.getSegmentCount() + 1 == ((com.esri.core.geometry.Polygon
                                                                                 )mPolygonWGS84MP.getGeometry()).getSegmentCount());
                NUnit.Framework.Assert.IsTrue(polygon.getSegmentCount(0) == ((com.esri.core.geometry.Polygon
                                                                              )mPolygonWGS84MP.getGeometry()).getSegmentCount(0));
                NUnit.Framework.Assert.IsTrue(polygon.getSegmentCount(1) + 1 == ((com.esri.core.geometry.Polygon
                                                                                  )mPolygonWGS84MP.getGeometry()).getSegmentCount(1));
                int lastIndex = polygon.getPointCount() - 1;
                NUnit.Framework.Assert.IsTrue(polygon.getPoint(lastIndex).getX() == ((com.esri.core.geometry.Polygon
                                                                                      )mPolygonWGS84MP.getGeometry()).getPoint(lastIndex).getX());
                NUnit.Framework.Assert.IsTrue(polygon.getPoint(lastIndex).getY() == ((com.esri.core.geometry.Polygon
                                                                                      )mPolygonWGS84MP.getGeometry()).getPoint(lastIndex).getY());
                NUnit.Framework.Assert.IsTrue(spatialReferenceWGS84.getID() == mPolygonWGS84MP.getSpatialReference
                                                  ().getID());
                if (!checkResultSpatialRef(mPolygonWGS84MP, 4326, 0))
                {
                    bAnswer = false;
                }
            }
            {
                com.esri.core.geometry.Polygon p = new com.esri.core.geometry.Polygon();
                p.addAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z);
                p.addAttribute(com.esri.core.geometry.VertexDescription.Semantics.M);
                string s = com.esri.core.geometry.GeometryEngine.geometryToJson(spatialReferenceWebMerc1
                                                                                , p);
                NUnit.Framework.Assert.IsTrue(s.Equals("{\"hasZ\":true,\"hasM\":true,\"rings\":[],\"spatialReference\":{\"wkid\":102100,\"latestWkid\":3857}}"
                                                       ));
                p.startPath(0, 0);
                p.lineTo(0, 1);
                p.lineTo(4, 4);
                p.startPath(2, 2);
                p.lineTo(3, 3);
                p.lineTo(7, 8);
                p.setAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z, 0, 0, 3);
                p.setAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 1, 0, 7);
                p.setAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 2, 0, 5);
                p.setAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 5, 0, 5);
                s = com.esri.core.geometry.GeometryEngine.geometryToJson(spatialReferenceWebMerc1
                                                                         , p);
                NUnit.Framework.Assert.IsTrue(s.Equals("{\"hasZ\":true,\"hasM\":true,\"rings\":[[[0,0,3,null],[0,1,0,7],[4,4,0,5],[0,0,3,null]],[[2,2,0,null],[3,3,0,null],[7,8,0,5],[2,2,0,null]]],\"spatialReference\":{\"wkid\":102100,\"latestWkid\":3857}}"
                                                       ));
            }
            {
                // Test Import Polygon from Polygon
                string rings = "{\"hasZ\": true, \"rings\" : [ [ [0,0, 5], [0.0, 10.0, 5], [10.0,10.0, 5, 66666], [10.0,0.0, 5] ], [ [12, 12] ],  [ [13 , 17], [13 , 17] ], [ [1.0, 1.0, 5, 66666], [9.0,1.0, 5], [9.0,9.0, 5], [1.0,9.0, 5], [1.0, 1.0, 5] ] ] }";
                com.esri.core.geometry.MapGeometry mapGeometry = com.esri.core.geometry.GeometryEngine
                                                                 .jsonToGeometry(factory.createJsonParser(rings));
                com.esri.core.geometry.Polygon p = (com.esri.core.geometry.Polygon)mapGeometry.getGeometry
                                                       ();
                double area   = p.calculateArea2D();
                double length = p.calculateLength2D();
                NUnit.Framework.Assert.IsTrue(p.getPathCount() == 4);
                int count = p.getPointCount();
                NUnit.Framework.Assert.IsTrue(count == 15);
                NUnit.Framework.Assert.IsTrue(p.hasAttribute(com.esri.core.geometry.VertexDescription.Semantics
                                                             .Z));
                NUnit.Framework.Assert.IsTrue(!p.hasAttribute(com.esri.core.geometry.VertexDescription.Semantics
                                                              .M));
            }
            return(bAnswer);
        }