### Question:
DefaultWikiDeleter implements WikiDeleter { @Override public void delete(String wikiId) throws WikiManagerException { XWikiContext context = xcontextProvider.get(); XWiki xwiki = context.getWiki(); if (wikiId.equals(wikiDescriptorManager.getMainWikiId())) { throw new WikiManagerException("It's not allowed to delete the main wiki!"); } try { XWikiDocument descriptorDocument = descriptorDocumentHelper.getDocumentFromWikiId(wikiId); xwiki.deleteDocument(descriptorDocument, context); } catch (XWikiException e) { throw new WikiManagerException( String.format("Error deleting the Wiki Descriptor Document for database [%s]", wikiId), e); } try { xwiki.getStore().deleteWiki(wikiId, context); } catch (XWikiException e) { throw new WikiManagerException(String.format("Error deleting the database [%s]", wikiId), e); } }  @Override void delete(String wikiId);  }### Answer:
@Test public void deleteTheMainWiki() throws Exception { boolean exceptionCaught = false; try { this.mocker.getComponentUnderTest().delete("xwiki"); } catch (WikiManagerException e) { exceptionCaught = true; } assertTrue(exceptionCaught); }
@Test public void deleteWiki() throws Exception { DefaultWikiDescriptor descriptor = new DefaultWikiDescriptor("wikiid", "wikialias"); descriptor.addAlias("wikialias2"); XWikiDocument descriptorDocument = mock(XWikiDocument.class); when(descriptorDocumentHelper.getDocumentFromWikiId("wikiid")).thenReturn(descriptorDocument); this.mocker.getComponentUnderTest().delete("wikiid"); verify(store).deleteWiki(eq("wikiid"), any(XWikiContext.class)); verify(xwiki).deleteDocument(eq(descriptorDocument), any(XWikiContext.class)); }