use of org.xwiki.wiki.manager.WikiManagerException in project xwiki-platform by xwiki.
the class WikiManagerScriptServiceTest method getByIdError.
@Test
public void getByIdError() throws Exception {
Exception exception = new WikiManagerException("error in getById");
when(wikiDescriptorManager.getById("wikiId")).thenThrow(exception);
WikiDescriptor result = mocker.getComponentUnderTest().getById("wikiId");
assertNull(result);
assertEquals(exception, mocker.getComponentUnderTest().getLastError());
}
use of org.xwiki.wiki.manager.WikiManagerException in project xwiki-platform by xwiki.
the class WikiManagerScriptServiceTest method getAllIdsError.
@Test
public void getAllIdsError() throws Exception {
Exception exception = new WikiManagerException("error in getAllIds");
when(wikiDescriptorManager.getAllIds()).thenThrow(exception);
Collection<String> result = mocker.getComponentUnderTest().getAllIds();
assertTrue(result.isEmpty());
assertEquals(exception, mocker.getComponentUnderTest().getLastError());
}
use of org.xwiki.wiki.manager.WikiManagerException in project xwiki-platform by xwiki.
the class WikiManagerScriptServiceTest method createWikiError.
@Test
public void createWikiError() throws Exception {
Exception exception = new WikiManagerException("error on create");
when(wikiManager.create("newwiki", "alias", true)).thenThrow(exception);
WikiDescriptor result = mocker.getComponentUnderTest().createWiki("newwiki", "alias", "userA", true);
assertNull(result);
assertEquals(exception, mocker.getComponentUnderTest().getLastError());
}
use of org.xwiki.wiki.manager.WikiManagerException in project xwiki-platform by xwiki.
the class WikiManagerScriptServiceTest method idAvailableError.
@Test
public void idAvailableError() throws Exception {
Exception exception = new WikiManagerException("error in idAvailable");
when(wikiManager.idAvailable("wikiId")).thenThrow(exception);
Boolean result = mocker.getComponentUnderTest().idAvailable("wikiId");
assertNull(result);
assertEquals(exception, mocker.getComponentUnderTest().getLastError());
assertEquals(exception, mocker.getComponentUnderTest().getLastException());
}
use of org.xwiki.wiki.manager.WikiManagerException in project xwiki-platform by xwiki.
the class WikiManagerScriptServiceTest method getMainWikiDescriptorError.
@Test
public void getMainWikiDescriptorError() throws Exception {
Exception exception = new WikiManagerException("error in getMainWikiDescriptor");
when(wikiDescriptorManager.getMainWikiDescriptor()).thenThrow(exception);
WikiDescriptor result = mocker.getComponentUnderTest().getMainWikiDescriptor();
assertNull(result);
assertEquals(exception, mocker.getComponentUnderTest().getLastError());
}
Aggregations