### Question:
HibernateDocumentNoteDAO extends HibernatePersistentObjectDAO<DocumentNote> implements DocumentNoteDAO { @Override public int copyAnnotations(long docId, String oldFileVersion, String newFileVersion) throws PersistenceException { List<DocumentNote> oldNotes = findByDocId(docId, oldFileVersion); int count=0; for (DocumentNote oldNote : oldNotes) { if (oldNote.getPage() > 0) continue; try { DocumentNote newNote = (DocumentNote) oldNote.clone(); newNote.setId(0L); newNote.setFileVersion(newFileVersion); store(newNote); count++; } catch (CloneNotSupportedException e) { log.error(e.getMessage(), e); } } return count; } HibernateDocumentNoteDAO(); @Override boolean store(DocumentNote note, DocumentHistory transaction); @Override List<DocumentNote> findByDocId(long docId, String fileVersion); @Override List<DocumentNote> findByUserId(long userId); @Override boolean delete(long id, int code); @Override int copyAnnotations(long docId, String oldFileVersion, String newFileVersion);  }### Answer:
@Test public void testCopyAnnotations() throws PersistenceException { Assert.assertTrue(dao.findByDocId(4L, "2.0").isEmpty()); dao.copyAnnotations(4L, "1.0", "2.0"); Assert.assertEquals(1, dao.findByDocId(4L, "2.0").size()); }