### Question:
DocumentManagerImpl implements DocumentManager { @Override public void makeImmutable(long docId, DocumentHistory transaction) throws Exception { assert (transaction != null); assert (transaction.getUser() != null); Document document = documentDAO.findById(docId); if (document.getImmutable() == 0) { transaction.setEvent(DocumentEvent.IMMUTABLE.toString()); documentDAO.makeImmutable(docId, transaction); log.debug("The document {} has been marked as immutable", docId); } else { throw new Exception("Document is immutable"); } }  void setListenerManager(DocumentListenerManager listenerManager); void setDocumentDAO(DocumentDAO documentDAO); void setTemplateDAO(TemplateDAO templateDAO); void setIndexer(SearchEngine indexer); @Override void replaceFile(long docId, String fileVersion, InputStream content, DocumentHistory transaction); @Override void replaceFile(long docId, String fileVersion, File newFile, DocumentHistory transaction); @Override void checkin(long docId, File file, String filename, boolean release, AbstractDocument docVO,
			DocumentHistory transaction); @Override void checkin(long docId, InputStream content, String filename, boolean release, AbstractDocument docVO,
			DocumentHistory transaction); @Override void checkout(long docId, DocumentHistory transaction); @Override void lock(long docId, int status, DocumentHistory transaction); @Override void deleteFromIndex(Document doc); @Override String parseDocument(Document doc, String fileVersion); @Override long reindex(long docId, String content); @Override void update(Document doc, Document docVO, DocumentHistory transaction); @Override void moveToFolder(Document doc, Folder folder, DocumentHistory transaction); @Override Document create(InputStream content, Document docVO, DocumentHistory transaction); @Override Document create(File file, Document docVO, DocumentHistory transaction); Document copyToFolder(Document doc, Folder folder, DocumentHistory transaction); @Override void unlock(long docId, DocumentHistory transaction); @Override void makeImmutable(long docId, DocumentHistory transaction); @Override void rename(long docId, String newName, DocumentHistory transaction); @Override Document replaceAlias(long aliasId, DocumentHistory transaction); @Override Document createAlias(Document doc, Folder folder, String aliasType, DocumentHistory transaction); void setVersionDAO(VersionDAO versionDAO); void setStorer(Storer storer); void setConfig(ContextProperties config); @Override void changeIndexingStatus(Document doc, int status); void setUserDAO(UserDAO userDAO); void setFolderDAO(FolderDAO folderDAO); @Override Version deleteVersion(long versionId, DocumentHistory transaction); void setDocumentNoteDAO(DocumentNoteDAO documentNoteDAO); @Override long archiveFolder(long folderId, DocumentHistory transaction); @Override void archiveDocuments(long[] docIds, DocumentHistory transaction); @Override Ticket createDownloadTicket(long docId, String suffix, Integer expireHours, Date expireDate,
			Integer maxDownloads, String urlPrefix, DocumentHistory transaction); void setTicketDAO(TicketDAO ticketDAO); @Override boolean unprotect(String sid, long docId, String password); @Override void promoteVersion(long docId, String version, DocumentHistory transaction);  }### Answer:
@Test public void testMakeImmutable() throws Exception { User user = userDao.findByUsername("admin"); Document doc = docDao.findById(1); Assert.assertNotNull(doc); DocumentHistory transaction = new DocumentHistory(); transaction.setFolderId(103L); transaction.setUser(user); transaction.setDocId(doc.getId()); transaction.setUserId(1L); transaction.setNotified(0); transaction.setComment("pippo_reason"); documentManager.makeImmutable(doc.getId(), transaction); doc = docDao.findById(1); Assert.assertEquals(1, doc.getImmutable()); doc.setFileName("ciccio"); docDao.initialize(doc); docDao.store(doc); }