@Test public void shouldReturnRepositoryIds() { when(repository.facet(GroupFacet.class)).thenReturn(groupFacet); when(groupFacet.leafMembers()).thenReturn(asList(leafMember1, leafMember2)); when(leafMember1.facet(ContentFacet.class)).thenReturn(contentFacet); when(leafMember2.facet(ContentFacet.class)).thenReturn(contentFacet); when(contentFacet.contentRepositoryId()).thenReturn(1, 2); Set<Integer> repositoryIds = getLeafRepositoryIds(repository); assertThat(repositoryIds, is(newHashSet(1, 2))); }
static Set<Integer> getLeafRepositoryIds(final Repository repository) { return repository.facet(GroupFacet.class).leafMembers().stream() .map(leafRepository -> leafRepository.facet(ContentFacet.class)) .map(ContentRepository::contentRepositoryId) .collect(toSet()); }
RepositoryContentUtil { static Set<Integer> getLeafRepositoryIds(final Repository repository) { return repository.facet(GroupFacet.class).leafMembers().stream() .map(leafRepository -> leafRepository.facet(ContentFacet.class)) .map(ContentRepository::contentRepositoryId) .collect(toSet()); } }
RepositoryContentUtil { static Set<Integer> getLeafRepositoryIds(final Repository repository) { return repository.facet(GroupFacet.class).leafMembers().stream() .map(leafRepository -> leafRepository.facet(ContentFacet.class)) .map(ContentRepository::contentRepositoryId) .collect(toSet()); } private  RepositoryContentUtil(); }
RepositoryContentUtil { static Set<Integer> getLeafRepositoryIds(final Repository repository) { return repository.facet(GroupFacet.class).leafMembers().stream() .map(leafRepository -> leafRepository.facet(ContentFacet.class)) .map(ContentRepository::contentRepositoryId) .collect(toSet()); } private  RepositoryContentUtil();  }
RepositoryContentUtil { static Set<Integer> getLeafRepositoryIds(final Repository repository) { return repository.facet(GroupFacet.class).leafMembers().stream() .map(leafRepository -> leafRepository.facet(ContentFacet.class)) .map(ContentRepository::contentRepositoryId) .collect(toSet()); } private  RepositoryContentUtil();   }