@Test public void createWhenWikiIdIsValidButFail() throws Exception { when(wikiDescriptorManager.exists("wikiid1")).thenReturn(false); when(xwiki.Param("xwiki.virtual.reserved_wikis")).thenReturn("forbidden"); when(store.isWikiNameAvailable(eq("wikiid1"), any(XWikiContext.class))).thenReturn(true); DefaultWikiDescriptor descriptor = new DefaultWikiDescriptor("wikiid1", "wikialias1", "owner"); when(wikiCreator.create("wikiid1", "wikialias1", "owner")).thenThrow(new WikiManagerException("...")); boolean exceptionCaught = false; try { this.mocker.getComponentUnderTest().create("wikiid1", "wikialias1", "owner", true); } catch (WikiManagerException e) { exceptionCaught = true; } assertTrue(exceptionCaught); verify(observationManager).notify(new WikiCreatingEvent("wikiid1"), "wikiid1", xcontext); verify(observationManager).notify(new WikiCreateFailedEvent("wikiid1"), "wikiid1", xcontext); }
@Override public WikiDescriptor create(String wikiId, String wikiAlias, boolean failOnExist) throws WikiManagerException { return create(wikiId, wikiAlias, null, failOnExist); }
DefaultWikiManager implements WikiManager { @Override public WikiDescriptor create(String wikiId, String wikiAlias, boolean failOnExist) throws WikiManagerException { return create(wikiId, wikiAlias, null, failOnExist); } }
DefaultWikiManager implements WikiManager { @Override public WikiDescriptor create(String wikiId, String wikiAlias, boolean failOnExist) throws WikiManagerException { return create(wikiId, wikiAlias, null, failOnExist); }  }
DefaultWikiManager implements WikiManager { @Override public WikiDescriptor create(String wikiId, String wikiAlias, boolean failOnExist) throws WikiManagerException { return create(wikiId, wikiAlias, null, failOnExist); }  @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 create(String wikiId, String wikiAlias, boolean failOnExist) throws WikiManagerException { return create(wikiId, wikiAlias, null, failOnExist); }  @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);  }