@Test
public void testCyclicToElement() throws Exception {

	ComplexTypeDescriptor a = new ComplexTypeDescriptor();
	a.setName("a");
	a.setType("typename");
	a.setQnameFromString("{namespace}typename");
	ComplexTypeDescriptor b = new ComplexTypeDescriptor();
	b.setName("b");
	b.setType("typename2");
	b.setQnameFromString("{namespace}typename2");
	a.getElements().add(b);
	b.getElements().add(a);
	Element el = XMLSplitterSerialisationHelper
			.typeDescriptorToExtensionXML(a);
	String xml = new XMLOutputter().outputString(el);
	assertEquals(
			"unexpected xml",
			"<s:extensions xmlns:s=\"http://org.embl.ebi.escience/xscufl/0.1alpha\"><s:complextype optional=\"false\" unbounded=\"false\" typename=\"typename\" name=\"a\" qname=\"{namespace}typename\"><s:elements><s:complextype optional=\"false\" unbounded=\"false\" typename=\"typename2\" name=\"b\" qname=\"{namespace}typename2\"><s:elements><s:complextype id=\"{namespace}typename\" optional=\"false\" unbounded=\"false\" typename=\"typename\" name=\"a\" /></s:elements></s:complextype></s:elements></s:complextype></s:extensions>",
			xml);
}