### Question:
AuthorizableWrapperImpl implements AuthorizableWrapper { @Override public Iterator<Group> getMembership() { try { return authorizable.memberOf(); } catch (RepositoryException e) { log.error("Failed to get membership of authorizable: {}", authorizable, e); return Collections.emptyIterator(); } } AuthorizableWrapperImpl(ResourceResolver resolver);  AuthorizableWrapperImpl(Resource resource); @Override Authorizable getAuthorizable(); @Override Iterator<Authorizable> getDeclaredMembers(); @Override Iterator<Group> getDeclaredMembership(); @Override Iterator<String> getGroupNames(); @Override String getId(); @Override Iterator<Authorizable> getMembers(); @Override Iterator<Group> getMembership(); @Override boolean isAdministrator(); @Override boolean isMember(String groupName);  }### Answer:
@Test public void testMembership() throws AccessDeniedException, UnsupportedRepositoryOperationException, RepositoryException { AuthorizableWrapper authWrapper = new AuthorizableWrapperImpl(userResource); assertTrue(SlingCMSTestHelper.toStream(authWrapper.getMembership()).anyMatch(g -> g == group)); authWrapper = new AuthorizableWrapperImpl(throwyResource); assertFalse(authWrapper.getMembership().hasNext()); }
@Test public void testNonMember() throws AccessDeniedException, UnsupportedRepositoryOperationException, RepositoryException { AuthorizableWrapper authWrapper = new AuthorizableWrapperImpl(userResource); assertFalse(SlingCMSTestHelper.toStream(authWrapper.getMembership()).anyMatch(g -> g == group2)); }