@Test public void copyWhenWikiAlreadyExists() throws Exception { when(store.isWikiNameAvailable(any(String.class), any(XWikiContext.class))).thenReturn(true); when(wikiDescriptorManager.exists("existingid")).thenReturn(true); boolean exceptionCaught = false; try { this.mocker.getComponentUnderTest().copy("wikiid", "existingid", "newwikialias", true, true, true); } catch (WikiManagerException e) { exceptionCaught = true; } assertTrue(exceptionCaught); }
@Override public WikiDescriptor copy(String fromWikiId, String newWikiId, String newWikiAlias, boolean copyHistory, boolean copyRecycleBin, boolean failOnExist) throws WikiManagerException { WikiDescriptor newWiki = create(newWikiId, newWikiAlias, failOnExist); wikiCopier.copyDocuments(fromWikiId, newWikiId, copyHistory); if (copyRecycleBin) { wikiCopier.copyDeletedDocuments(fromWikiId, newWikiId); } observationManager.notify(new WikiCopiedEvent(fromWikiId, newWikiId), fromWikiId, xcontextProvider.get()); return newWiki; }
DefaultWikiManager implements WikiManager { @Override public WikiDescriptor copy(String fromWikiId, String newWikiId, String newWikiAlias, boolean copyHistory, boolean copyRecycleBin, boolean failOnExist) throws WikiManagerException { WikiDescriptor newWiki = create(newWikiId, newWikiAlias, failOnExist); wikiCopier.copyDocuments(fromWikiId, newWikiId, copyHistory); if (copyRecycleBin) { wikiCopier.copyDeletedDocuments(fromWikiId, newWikiId); } observationManager.notify(new WikiCopiedEvent(fromWikiId, newWikiId), fromWikiId, xcontextProvider.get()); return newWiki; } }
DefaultWikiManager implements WikiManager { @Override public WikiDescriptor copy(String fromWikiId, String newWikiId, String newWikiAlias, boolean copyHistory, boolean copyRecycleBin, boolean failOnExist) throws WikiManagerException { WikiDescriptor newWiki = create(newWikiId, newWikiAlias, failOnExist); wikiCopier.copyDocuments(fromWikiId, newWikiId, copyHistory); if (copyRecycleBin) { wikiCopier.copyDeletedDocuments(fromWikiId, newWikiId); } observationManager.notify(new WikiCopiedEvent(fromWikiId, newWikiId), fromWikiId, xcontextProvider.get()); return newWiki; }  }
DefaultWikiManager implements WikiManager { @Override public WikiDescriptor copy(String fromWikiId, String newWikiId, String newWikiAlias, boolean copyHistory, boolean copyRecycleBin, boolean failOnExist) throws WikiManagerException { WikiDescriptor newWiki = create(newWikiId, newWikiAlias, failOnExist); wikiCopier.copyDocuments(fromWikiId, newWikiId, copyHistory); if (copyRecycleBin) { wikiCopier.copyDeletedDocuments(fromWikiId, newWikiId); } observationManager.notify(new WikiCopiedEvent(fromWikiId, newWikiId), fromWikiId, xcontextProvider.get()); return newWiki; }  @Override WikiDescriptor create(String wikiId, String wikiAlias, boolean failOnExist); @Override WikiDescriptor create(String wikiId, String wikiAlias, String ownerId, boolean failOnExist); @Override WikiDescriptor copy(String fromWikiId, String newWikiId, String newWikiAlias, boolean copyHistory,
        boolean copyRecycleBin, boolean failOnExist); @Override WikiDescriptor rename(String wikiId, String newWikiId); @Override void delete(String wikiId); @Override boolean idAvailable(String wikiId); }
DefaultWikiManager implements WikiManager { @Override public WikiDescriptor copy(String fromWikiId, String newWikiId, String newWikiAlias, boolean copyHistory, boolean copyRecycleBin, boolean failOnExist) throws WikiManagerException { WikiDescriptor newWiki = create(newWikiId, newWikiAlias, failOnExist); wikiCopier.copyDocuments(fromWikiId, newWikiId, copyHistory); if (copyRecycleBin) { wikiCopier.copyDeletedDocuments(fromWikiId, newWikiId); } observationManager.notify(new WikiCopiedEvent(fromWikiId, newWikiId), fromWikiId, xcontextProvider.get()); return newWiki; }  @Override WikiDescriptor create(String wikiId, String wikiAlias, boolean failOnExist); @Override WikiDescriptor create(String wikiId, String wikiAlias, String ownerId, boolean failOnExist); @Override WikiDescriptor copy(String fromWikiId, String newWikiId, String newWikiAlias, boolean copyHistory,
        boolean copyRecycleBin, boolean failOnExist); @Override WikiDescriptor rename(String wikiId, String newWikiId); @Override void delete(String wikiId); @Override boolean idAvailable(String wikiId);  }