use of org.xwiki.wiki.user.WikiUserManagerException in project xwiki-platform by xwiki.
the class WikiUserManagerScriptServiceTest method getAllInvitationsError.
@Test
public void getAllInvitationsError() throws Exception {
// Mocks
Exception expectedException = new WikiUserManagerException("error in getAllInvitations()");
when(wikiUserManager.getAllInvitations("subwiki")).thenThrow(expectedException);
// Test
Collection<MemberCandidacy> result = mocker.getComponentUnderTest().getAllInvitations("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 hasPendingInvitationWhenError.
@Test
public void hasPendingInvitationWhenError() throws Exception {
String wikiId = "subwiki";
// Mocks
DocumentReference userToTest = new DocumentReference("mainWiki", "XWiki", "User");
Exception expectedException = new WikiUserManagerException("exception");
doThrow(expectedException).when(wikiUserManager).hasPendingInvitation(userToTest, wikiId);
// Test
Boolean result = mocker.getComponentUnderTest().hasPendingInvitation(userToTest, wikiId);
// Asserts
assertNull(result);
assertEquals(expectedException, mocker.getComponentUnderTest().getLastError());
}
Aggregations