### Question:
DocumentManagerImpl implements DocumentManager { @Override public void archiveDocuments(long[] docIds, DocumentHistory transaction) throws Exception { assert (transaction.getUser() != null); List<Long> idsList = new ArrayList<Long>(); DocumentDAO dao = (DocumentDAO) Context.get().getBean(DocumentDAO.class); Collection<Long> folderIds = folderDAO.findFolderIdByUserIdAndPermission(transaction.getUserId(), Permission.ARCHIVE, null, true); for (long id : docIds) { Document doc = dao.findById(id); if (!(transaction.getUser().isMemberOf("admin") || transaction.getUser().getUsername().equals("_retention")) && !folderIds.contains(doc.getFolder().getId())) continue; DocumentHistory t = (DocumentHistory) transaction.clone(); if (dao.archive(id, t)) idsList.add(id); } SearchEngine engine = (SearchEngine) Context.get().getBean(SearchEngine.class); engine.deleteHits(idsList); log.info("Archived documents {}", idsList); }  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 testArchiveDocuments() throws Exception { User user = userDao.findByUsername("admin"); DocumentHistory transaction = new DocumentHistory(); transaction.setSessionId("1234"); transaction.setUser(user); documentManager.archiveDocuments(new long[] { 1L }, transaction); Document doc = docDao.findById(1L); Assert.assertEquals(AbstractDocument.DOC_ARCHIVED, doc.getStatus()); }