### Question:
AuthorizableWrapperImpl implements AuthorizableWrapper { @Override public Iterator<String> getGroupNames() { Iterable<Group> iterable = this::getMembership; return StreamSupport.stream(iterable.spliterator(), false).map(g -> { try { return g.getPrincipal().getName(); } catch (RepositoryException e) { log.error("Failed to get name from group: {}", g, e); return null; } }).iterator(); } 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 testGetGroupNames() throws AccessDeniedException, UnsupportedRepositoryOperationException, RepositoryException { AuthorizableWrapper authWrapper = new AuthorizableWrapperImpl(userResource); assertEquals(Collections.singletonList("456"), SlingCMSTestHelper.toStream(authWrapper.getGroupNames()).collect(Collectors.toList())); authWrapper = new AuthorizableWrapperImpl(throwyResource); assertFalse(authWrapper.getGroupNames().hasNext()); }