assertEquals("newimageid", pdoc.getIdentifier());
}
@Test
public void testParseComplicated() throws Exception {
SimpleEntity entity = baseDao.first(SimpleEntity.class);
MultiDocument bmd = entity.getPhotos();
assertTrue(bmd.getDocuments().size() == 4);
MultiDocument md = new MultiDocument();
md.setId(bmd.getId());
md.addDocument(new Document());
md.getDocuments().iterator().next().setId(bmd.getDocuments().iterator().next().getId());
Document doc2 = new Document();
doc2.setTemporal(false);
doc2.setIdentifier("void image");
doc2.setWidth(1);
doc2.setHeight(1);
doc2.setCreation(new Date());
doc2.setMimeType("image/gif");
doc2.setAuthor((UserImpl) securityDAO.findUser("adminuser"));
doc2.setContents(FileCopyUtils.copyToByteArray(getClass().getResourceAsStream("/void.gif")));
md.addDocument(doc2);
Document doc = baseDao.find(Document.class, generatedDocIDs.get(0));
assertNull(doc.getDocumentGroup());
Document t = new Document();
t.setId(doc.getId());
md.addDocument(t);
entity.setPhotos(multiDocumentParser.parse(md));
baseDao.update(entity);
assertTrue(entity.getPhotos().getDocuments().size() == 2);
}