@Test
public void testValidatingExportedCurveSegments()
                        throws XMLStreamException, XMLParsingException, UnknownCRSException,
                        FactoryConfigurationError, IOException, TransformationException {

    for ( String segmentSource : segmentSources ) {
        URL docURL = GML3GeometryWriterTest.class.getResource( SEGMENT_DIR + segmentSource );
        GMLStreamReader parser = getGML31StreamReader( docURL );
        XMLStreamReaderWrapper xmlReader = new XMLStreamReaderWrapper( parser.getXMLReader(), docURL.toString() );
        CurveSegment curveSegment = ( (GML3GeometryReader) parser.getGeometryReader() ).getCurveSegmentReader().parseCurveSegment( xmlReader,
                                                                                                                                   null );
        XMLMemoryStreamWriter memoryWriter = new XMLMemoryStreamWriter();
        SchemaLocationXMLStreamWriter writer = new SchemaLocationXMLStreamWriter(
                                                                                  memoryWriter.getXMLStreamWriter(),
                                                                                  SCHEMA_LOCATION_ATTRIBUTE );
        GMLStreamWriter exporter = GMLOutputFactory.createGMLStreamWriter( GML_31, writer );
        ( (GML3GeometryWriter) exporter.getGeometryWriter() ).exportCurveSegment( curveSegment );
        writer.flush();
        XMLAssert.assertValidity( memoryWriter.getReader(), SCHEMA_LOCATION );
    }
}