@Test
@Sudo
public void testConvertions() {

	ITestDAO dao = tester.getApplication().getServiceInstance(ITestDAO.class);
	ODocument doc = dao.findSingleAsDocument("root");
	IDAOTestClass root = dao.findSingleAsDAO("root");
	assertEquals(doc.field("name"), root.getName());
	List<ODocument> listDocs = dao.findAllAsDocument();
	List<IDAOTestClass> listObjs = dao.findAllAsDAO();
	assertEquals(listDocs.size(), listObjs.size());
	assertTrue(listDocs.get(0) instanceof ODocument);
	assertTrue(listObjs.get(0) instanceof IDAOTestClass);
	
	assertConsistent(root.getChild(), root.getChildAsDocuments(), 5);
	
	List<ODocument> allExceptOneChild = root.getChildAsDocuments();
	allExceptOneChild.remove(0);
	root.setChildAsDocuments(allExceptOneChild);
	root.save();
	
	assertConsistent(root.getChild(), root.getChildAsDocuments(), 4);
	
	List<IDAOTestClass> allExceptOneMoreChild = new ArrayList<IDAOTestClass>(root.getChild());
	allExceptOneMoreChild.remove(0);
	root.setChild(allExceptOneMoreChild);
	root.save();
	
	assertConsistent(root.getChild(), root.getChildAsDocuments(), 3);
	
	assertConsistent(root.getLinkMap(), root.getLinkMapAsDocuments(), 5);
	
	Map<String, ODocument> mapDocs = root.getLinkMapAsDocuments();
/		Map<String, ODocument> mapDocs = new HashMap<String, ODocument>(root.getLinkMapAsDocuments());
	Iterator<Map.Entry<String, ODocument>> itDocs = mapDocs.entrySet().iterator();
	itDocs.next();
	itDocs.remove();
	root.setLinkMapAsDocuments(mapDocs);
	root.save();
	
	assertConsistent(root.getLinkMap(), root.getLinkMapAsDocuments(), 4);
	
	
	Map<String, IDAOTestClass> map = new HashMap<String, IDAOTestClass>(root.getLinkMap());
	Iterator<Map.Entry<String, IDAOTestClass>> it = map.entrySet().iterator();
	it.next();
	it.remove();
	root.setLinkMap(map);
	root.save();
	
	assertConsistent(root.getLinkMap(), root.getLinkMapAsDocuments(), 3);
	
}