@Test public void listAllAccessLevels() throws ComponentLookupException { List<AccessLevel> levels = new ArrayList<>(); levels.add(EDIT_ACCESS); levels.add(NO_ACCESS); levels.add(OWNER_ACCESS); levels.add(VIEW_ACCESS); levels.add(MANAGE_ACCESS); when(this.componentManager.<AccessLevel>getInstanceList(AccessLevel.class)).thenReturn(levels); Collection<AccessLevel> returnedLevels = this.component.listAllAccessLevels(); Assert.assertEquals(5, returnedLevels.size()); Iterator<AccessLevel> it = returnedLevels.iterator(); Assert.assertSame(NO_ACCESS, it.next()); Assert.assertSame(VIEW_ACCESS, it.next()); Assert.assertSame(EDIT_ACCESS, it.next()); Assert.assertSame(MANAGE_ACCESS, it.next()); Assert.assertSame(OWNER_ACCESS, it.next()); }
@Nonnull @Override public Collection<AccessLevel> listAllAccessLevels() { try { return new TreeSet<>(this.componentManager.get().getInstanceList(AccessLevel.class)); } catch (final ComponentLookupException ex) { return Collections.emptyList(); } }
DefaultEntityAccessManager implements EntityAccessManager { @Nonnull @Override public Collection<AccessLevel> listAllAccessLevels() { try { return new TreeSet<>(this.componentManager.get().getInstanceList(AccessLevel.class)); } catch (final ComponentLookupException ex) { return Collections.emptyList(); } } }
DefaultEntityAccessManager implements EntityAccessManager { @Nonnull @Override public Collection<AccessLevel> listAllAccessLevels() { try { return new TreeSet<>(this.componentManager.get().getInstanceList(AccessLevel.class)); } catch (final ComponentLookupException ex) { return Collections.emptyList(); } }  }
DefaultEntityAccessManager implements EntityAccessManager { @Nonnull @Override public Collection<AccessLevel> listAllAccessLevels() { try { return new TreeSet<>(this.componentManager.get().getInstanceList(AccessLevel.class)); } catch (final ComponentLookupException ex) { return Collections.emptyList(); } }  @Nonnull @Override Collection<AccessLevel> listAccessLevels(); @Nonnull @Override Collection<AccessLevel> listAllAccessLevels(); @Nonnull @Override AccessLevel resolveAccessLevel(@Nullable final String name); @Nonnull @Override AccessLevel getAccessLevel(@Nullable final PrimaryEntity entity, @Nullable final EntityReference userOrGroup); @Override boolean isAdministrator(@Nullable final PrimaryEntity entity); @Override boolean isAdministrator(@Nullable final PrimaryEntity entity, @Nullable final DocumentReference user); @Nullable @Override Owner getOwner(@Nullable final PrimaryEntity entity); @Override boolean setOwner(@Nullable final PrimaryEntity entity, @Nullable final EntityReference userOrGroup); @Nonnull @Override Collection<Collaborator> getCollaborators(@Nullable final PrimaryEntity entity); @Override boolean setCollaborators(
        @Nullable final PrimaryEntity entity,
        @Nullable final Collection<Collaborator> newCollaborators); @Override boolean addCollaborator(@Nullable final PrimaryEntity entity, @Nullable final Collaborator collaborator); @Override boolean removeCollaborator(@Nullable final PrimaryEntity entity, @Nullable final Collaborator collaborator); }
DefaultEntityAccessManager implements EntityAccessManager { @Nonnull @Override public Collection<AccessLevel> listAllAccessLevels() { try { return new TreeSet<>(this.componentManager.get().getInstanceList(AccessLevel.class)); } catch (final ComponentLookupException ex) { return Collections.emptyList(); } }  @Nonnull @Override Collection<AccessLevel> listAccessLevels(); @Nonnull @Override Collection<AccessLevel> listAllAccessLevels(); @Nonnull @Override AccessLevel resolveAccessLevel(@Nullable final String name); @Nonnull @Override AccessLevel getAccessLevel(@Nullable final PrimaryEntity entity, @Nullable final EntityReference userOrGroup); @Override boolean isAdministrator(@Nullable final PrimaryEntity entity); @Override boolean isAdministrator(@Nullable final PrimaryEntity entity, @Nullable final DocumentReference user); @Nullable @Override Owner getOwner(@Nullable final PrimaryEntity entity); @Override boolean setOwner(@Nullable final PrimaryEntity entity, @Nullable final EntityReference userOrGroup); @Nonnull @Override Collection<Collaborator> getCollaborators(@Nullable final PrimaryEntity entity); @Override boolean setCollaborators(
        @Nullable final PrimaryEntity entity,
        @Nullable final Collection<Collaborator> newCollaborators); @Override boolean addCollaborator(@Nullable final PrimaryEntity entity, @Nullable final Collaborator collaborator); @Override boolean removeCollaborator(@Nullable final PrimaryEntity entity, @Nullable final Collaborator collaborator);  }