use of org.xwiki.wiki.user.WikiUserManagerException in project xwiki-platform by xwiki.
the class WikiUserManagerScriptServiceTest method getAllRequestError.
@Test
public void getAllRequestError() throws Exception {
// Mocks
Exception expectedException = new WikiUserManagerException("error in getAllRequests()");
when(wikiUserManager.getAllRequests("subwiki")).thenThrow(expectedException);
// Test
Collection<MemberCandidacy> result = mocker.getComponentUnderTest().getAllRequests("subwiki");
// Asserts
assertNull(result);
assertEquals(expectedException, mocker.getComponentUnderTest().getLastError());
}
use of org.xwiki.wiki.user.WikiUserManagerException in project xwiki-platform by xwiki.
the class WikiUserManagerScriptServiceTest method getCandidacyWhenError.
@Test
public void getCandidacyWhenError() throws Exception {
// Mocks
Exception exception = new WikiUserManagerException("error in getCandidacy");
when(wikiUserManager.getCandidacy("subwiki", 42)).thenThrow(exception);
// Test
MemberCandidacy result = mocker.getComponentUnderTest().getCandidacy("subwiki", 42);
// Asserts
assertNull(result);
assertEquals(exception, mocker.getComponentUnderTest().getLastError());
}
use of org.xwiki.wiki.user.WikiUserManagerException in project xwiki-platform by xwiki.
the class WikiUserManagerScriptServiceTest method joinWhenError.
@Test
public void joinWhenError() throws Exception {
String userId = "mainWiki:XWiki.User";
String wikiId = "wikiId";
// Mocks
WikiUserManagerException expectedException = new WikiUserManagerException("error in wikiUserManager#join()");
doThrow(expectedException).when(wikiUserManager).join(userId, wikiId);
// Test
boolean result = this.mocker.getComponentUnderTest().join(userId, wikiId);
// Asserts
assertFalse(result);
assertEquals(expectedException, this.mocker.getComponentUnderTest().getLastError());
}
use of org.xwiki.wiki.user.WikiUserManagerException in project xwiki-platform by xwiki.
the class WikiUserManagerScriptServiceTest method isMemberError.
@Test
public void isMemberError() throws Exception {
// Mocks
Exception expectedException = new WikiUserManagerException("error in isMember");
when(wikiUserManager.isMember("mainWiki:XWiki.User", "subwiki")).thenThrow(expectedException);
// Test
Boolean result = mocker.getComponentUnderTest().isMember("mainWiki:XWiki.User", "subwiki");
// Asserts
assertNull(result);
assertEquals(expectedException, mocker.getComponentUnderTest().getLastError());
}
use of org.xwiki.wiki.user.WikiUserManagerException in project xwiki-platform by xwiki.
the class WikiUserManagerScriptServiceTest method hasPendingRequestWhenError.
@Test
public void hasPendingRequestWhenError() throws Exception {
String wikiId = "subwiki";
DocumentReference userToTest = new DocumentReference("mainWiki", "XWiki", "User");
// Mocks
Exception expectedException = new WikiUserManagerException("exception");
doThrow(expectedException).when(wikiUserManager).hasPendingRequest(userToTest, wikiId);
// Test
Boolean result = mocker.getComponentUnderTest().hasPendingRequest(userToTest, wikiId);
// Asserts
assertNull(result);
assertEquals(expectedException, mocker.getComponentUnderTest().getLastError());
}
Aggregations