GmlTimePositionTypeWriter { public void write( final TimePosition timePosition, final XMLStreamWriter writer ) throws XMLStreamException { writeAttributeIfNotNull( FRAME, timePosition.getFrame(), writer ); writeAttributeIfNotNull( CALENDAR_ERA_NAME, timePosition.getCalendarEraName(), writer ); String indeterminatePosition = null; if ( timePosition.getIndeterminatePosition() != null ) { indeterminatePosition = timePosition.getIndeterminatePosition().toString().toLowerCase(); } writeAttributeIfNotNull( INDETERMINATE_POSITION, indeterminatePosition, writer ); writeCharactersIfNotEmpty( timePosition.getValue(), writer ); }  void write( final TimePosition timePosition, final XMLStreamWriter writer );  }
@Test public void writeMandatory() throws XMLStreamException { final String frame = null; final String calendarEraName = null; final IndeterminateValue indeterminatePosition = null; final String value = null; final TimePosition timePosition = new TimePosition( frame, calendarEraName, indeterminatePosition, value ); final MemoryXmlStreamWriter xmlWriter = new MemoryXmlStreamWriter(); xmlWriter.writeEmptyElement( "TimePosition" ); gmlTimePositionTypeWriter.write( timePosition, xmlWriter ); xmlWriter.close(); assertEquals( "<TimePosition/>", xmlWriter.getOutput() ); }
@Test public void writeOptional() throws XMLStreamException { final String frame = "http: final String calendarEraName = "Meiji"; final IndeterminateValue indeterminatePosition = BEFORE; final String value = "0025-03"; final TimePosition timePosition = new TimePosition( frame, calendarEraName, indeterminatePosition, value ); final MemoryXmlStreamWriter xmlWriter = new MemoryXmlStreamWriter(); xmlWriter.writeStartElement( "TimePosition" ); gmlTimePositionTypeWriter.write( timePosition, xmlWriter ); xmlWriter.writeEndElement(); assertEquals( "<TimePosition frame=\"http: xmlWriter.getOutput() ); }