### Question:
WikiUserManagerScriptService implements ScriptService { public Collection<MemberCandidacy> getAllRequests(String wikiId) { try { Collection<MemberCandidacy> candidacies = wikiUserManager.getAllRequests(wikiId); return filterAuthorizedCandidacies(candidacies); } catch (WikiUserManagerException e) { setLastError(e); return null; } }  Exception getLastError(); UserScope getUserScope(); UserScope getUserScope(String wikiId); boolean setUserScope(String wikiId, String scope); MembershipType getMembershipType(); MembershipType getMembershipType(String wikiId); boolean setMembershipType(String wikiId, String type); Collection<String> getMembers(String wikiId); Boolean isMember(String userId, String wikiId); boolean addMember(String userId, String wikiId); boolean addMembers(Collection<String> userIds, String wikiId); boolean removeMember(String userId, String wikiId); MemberCandidacy getCandidacy(String wikiId, int candidacyId); Collection<MemberCandidacy> getAllInvitations(String wikiId); Boolean hasPendingInvitation(DocumentReference user, String wikiId); Boolean hasPendingRequest(DocumentReference user, String wikiId); Collection<MemberCandidacy> getAllRequests(String wikiId); boolean join(String userId, String wikiId); boolean leave(String userId, String wikiId); MemberCandidacy askToJoin(String userId, String wikiId, String message); boolean acceptRequest(MemberCandidacy request, String message, String privateComment); boolean refuseRequest(MemberCandidacy request, String message, String privateComment); boolean cancelCandidacy(MemberCandidacy candidacy); MemberCandidacy invite(String userId, String wikiId, String message); boolean acceptInvitation(MemberCandidacy invitation, String message); boolean refuseInvitation(MemberCandidacy invitation, String message);  }### Answer:
@Test public void getAllRequests() throws Exception { ArrayList<MemberCandidacy> candidacies = new ArrayList<MemberCandidacy>(); candidacies.add(new MemberCandidacy("subwiki", "mainWiki:XWiki.User", MemberCandidacy.CandidateType.REQUEST)); candidacies.add(new MemberCandidacy("subwiki", "mainWiki:XWiki.OtherUser", MemberCandidacy.CandidateType.REQUEST)); candidacies.get(0).setAdminPrivateComment("private message"); when(authorizationManager.hasAccess(eq(Right.ADMIN), eq(userDocRef), eq(new WikiReference("subwiki")))).thenReturn(false); when(wikiUserManager.getAllRequests("subwiki")).thenReturn(candidacies); Collection<MemberCandidacy> result = mocker.getComponentUnderTest().getAllRequests("subwiki"); assertEquals(1, result.size()); assertTrue(result.contains(candidacies.get(0))); assertFalse(result.contains(candidacies.get(1))); assertNull(((MemberCandidacy)result.toArray()[0]).getAdminPrivateComment()); }