Search in sources :

Example 11 with WikiTemplateManagerException

use of org.xwiki.wiki.template.WikiTemplateManagerException in project xwiki-platform by xwiki.

the class WikiTemplateManagerScriptTest method getTemplatesError.

@Test
public void getTemplatesError() throws Exception {
    Exception exception = new WikiTemplateManagerException("Error in getTemplates");
    when(wikiTemplateManager.getTemplates()).thenThrow(exception);
    Collection<WikiDescriptor> results = mocker.getComponentUnderTest().getTemplates();
    assertTrue(results.isEmpty());
    assertEquals(exception, mocker.getComponentUnderTest().getLastError());
    verify(mocker.getMockedLogger()).error("Error while getting all the wiki templates.", exception);
}
Also used : WikiTemplateManagerException(org.xwiki.wiki.template.WikiTemplateManagerException) WikiManagerException(org.xwiki.wiki.manager.WikiManagerException) AccessDeniedException(org.xwiki.security.authorization.AccessDeniedException) WikiTemplateManagerException(org.xwiki.wiki.template.WikiTemplateManagerException) WikiDescriptor(org.xwiki.wiki.descriptor.WikiDescriptor) Test(org.junit.Test)

Example 12 with WikiTemplateManagerException

use of org.xwiki.wiki.template.WikiTemplateManagerException in project xwiki-platform by xwiki.

the class WikiTemplateManagerScriptTest method isTemplateError.

@Test
public void isTemplateError() throws Exception {
    Exception exception = new WikiTemplateManagerException("error in isTemplate");
    when(wikiTemplateManager.isTemplate("wikiTemplate")).thenThrow(exception);
    assertNull(mocker.getComponentUnderTest().isTemplate("wikiTemplate"));
    assertEquals(exception, mocker.getComponentUnderTest().getLastError());
    verify(mocker.getMockedLogger()).error("Failed to get if the wiki [wikiTemplate] is a template or not.", exception);
}
Also used : WikiTemplateManagerException(org.xwiki.wiki.template.WikiTemplateManagerException) WikiManagerException(org.xwiki.wiki.manager.WikiManagerException) AccessDeniedException(org.xwiki.security.authorization.AccessDeniedException) WikiTemplateManagerException(org.xwiki.wiki.template.WikiTemplateManagerException) Test(org.junit.Test)

Aggregations

WikiTemplateManagerException (org.xwiki.wiki.template.WikiTemplateManagerException)12 WikiManagerException (org.xwiki.wiki.manager.WikiManagerException)11 WikiDescriptor (org.xwiki.wiki.descriptor.WikiDescriptor)8 AccessDeniedException (org.xwiki.security.authorization.AccessDeniedException)7 Test (org.junit.Test)5 XWikiContext (com.xpn.xwiki.XWikiContext)2 ArrayList (java.util.ArrayList)2 WikiReference (org.xwiki.model.reference.WikiReference)2 WikiPropertyGroupException (org.xwiki.wiki.properties.WikiPropertyGroupException)2 WikiTemplatePropertyGroup (org.xwiki.wiki.template.WikiTemplatePropertyGroup)2 JobStatus (org.xwiki.job.event.status.JobStatus)1 WikiCreationException (org.xwiki.platform.wiki.creationjob.WikiCreationException)1 Query (org.xwiki.query.Query)1 WikiProvisioningJobException (org.xwiki.wiki.provisioning.WikiProvisioningJobException)1 WikiUserManagerException (org.xwiki.wiki.user.WikiUserManagerException)1