public void testXmlResourceToXmlElement() throws Exception
{
final MasterConversionService service = Sapphire.service( MasterConversionService.class );
final XmlResourceStore xmlResourceStore = new XmlResourceStore();
final RootXmlResource xmlResource = new RootXmlResource( xmlResourceStore );
final XmlConversionTestElement elementOnXml = XmlConversionTestElement.TYPE.instantiate( xmlResource );
xmlResource.save();
final XmlElement xmlElement = service.convert( xmlResource, XmlElement.class );
assertNotNull( xmlElement );
assertSame( xmlElement, xmlResource.getXmlElement() );
assertSame( xmlElement, xmlResource.adapt( XmlElement.class ) );
final XmlConversionTestElement.ListEntry childElement = elementOnXml.getList().insert();
final XmlElement childXmlElement = service.convert( childElement.resource(), XmlElement.class );
final XmlResource childXmlResource = (XmlResource) childElement.resource();