@@ -0,0 +1,1686 @@
+package fgis.server.support.geojson;%0A%0Aimport java.io.ByteArrayOutputStream;%0Aimport java.io.StringReader;%0Aimport java.nio.charset.Charset;%0Aimport java.util.Arrays;%0Aimport javax.json.Json;%0Aimport javax.json.JsonObject;%0Aimport javax.json.JsonReader;%0Aimport javax.json.JsonStructure;%0Aimport javax.json.stream.JsonGenerator;%0Aimport org.geolatte.geom.Geometry;%0Aimport org.geolatte.geom.codec.Wkt;%0Aimport org.geolatte.geom.codec.Wkt.Dialect;%0Aimport org.testng.annotations.Test;%0Aimport static org.testng.Assert.*;%0A%0Apublic class GeoJsonWriterTest%0A%7B%0A  @Test%0A  public void emitPointGeometry()%0A  %7B%0A    final Geometry geometry = fromWkT( %22POINT (1 1)%22 );%0A    final GjElement e = new GjGeometry( geometry, null, null, null );%0A%0A    final JsonStructure result = writeAndRead( e );%0A%0A    final String expectedJson = %22%7B%5C%22type%5C%22:%5C%22Point%5C%22,%5C%22coordinates%5C%22:%5B1.0,1.0%5D%7D%22;%0A    final JsonObject expected = (JsonObject) parse( expectedJson );%0A    assertEquals( result, expected );%0A  %7D%0A%0A  private JsonStructure writeAndRead( final GjElement e )%0A  %7B%0A    final ByteArrayOutputStream baos = new ByteArrayOutputStream();%0A    final JsonGenerator g = Json.createGenerator( baos );%0A%0A    new GeoJsonWriter().emit( g, e );%0A%0A    g.flush();%0A%0A    return parse( baos.toByteArray() );%0A  %7D%0A%0A  private JsonStructure parse( final byte%5B%5D bytes )%0A  %7B%0A    return parse( new String( bytes, Charset.forName( %22US-ASCII%22 ) ) );%0A  %7D%0A%0A  private JsonStructure parse( final String json )%0A  %7B%0A    return new JsonReader( new StringReader( json ) ).read();%0A  %7D%0A%0A%0A  @SuppressWarnings( %22unchecked%22 )%0A  public final %3CT extends Geometry%3E T fromWkT( final String wkt )%0A  %7B%0A    return (T) Wkt.newDecoder( Dialect.POSTGIS_EWKT_1 ).decode( wkt );%0A  %7D%0A%7D%0A

Add basic test for emitting a point