@Test
public void testCyclicFromElement() throws Exception {

	String 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 id=\"{namespace}typename\" /></s:elements></s:complextype></s:extensions>";
	Element el = new SAXBuilder().build(new StringReader(xml))
			.getRootElement();
	TypeDescriptor a = XMLSplitterSerialisationHelper
			.extensionXMLToTypeDescriptor(el);
	assertTrue("wrong type", a instanceof ComplexTypeDescriptor);
	assertEquals("wrong name", "a", a.getName());
	List<TypeDescriptor> a_elements = ((ComplexTypeDescriptor) a).getElements();
	assertEquals("should be only 1 element", 1, a_elements.size());
	TypeDescriptor b = a_elements.get(0);
	assertTrue("wrong type", b instanceof ComplexTypeDescriptor);
	List<TypeDescriptor> b_elements = ((ComplexTypeDescriptor) b).getElements();
	assertEquals("should be only 1 element", 1, b_elements.size());
	assertEquals("b should contain a reference to a", a.toString(),
			b_elements.get(0).toString());
}