@Test public void testGetGroups_repositoryContainedInMultipleGroupsWhichAlsoContainEachOther() { Repository repo = mockRepository("repo"); Repository group1 = mockGroupRepository("group1", repo); Repository group2 = mockGroupRepository("group2", repo); Repository group3 = mockGroupRepository("group3", group1); Repository group4 = mockGroupRepository("group4", group3); Repository group5 = mockGroupRepository("group5", group4); when(repositoryManager.browse()).thenReturn(Arrays.asList(group5, group4, group3, group2, group1, repo)); List<String> groups = underTest.getGroups("repo"); assertThat(groups, contains("group1", "group2", "group3", "group4", "group5")); }
List<String> getGroups(String member) { return new ArrayList<>(getCache().getOrDefault(member, Collections.emptyList())); }
GroupMemberMappingCache extends ComponentSupport implements EventAware { List<String> getGroups(String member) { return new ArrayList<>(getCache().getOrDefault(member, Collections.emptyList())); } }
GroupMemberMappingCache extends ComponentSupport implements EventAware { List<String> getGroups(String member) { return new ArrayList<>(getCache().getOrDefault(member, Collections.emptyList())); }  }
GroupMemberMappingCache extends ComponentSupport implements EventAware { List<String> getGroups(String member) { return new ArrayList<>(getCache().getOrDefault(member, Collections.emptyList())); }  @Subscribe void on(final RepositoryCreatedEvent event); @Subscribe void on(final RepositoryUpdatedEvent event); @Subscribe void on(final RepositoryDeletedEvent event); }
GroupMemberMappingCache extends ComponentSupport implements EventAware { List<String> getGroups(String member) { return new ArrayList<>(getCache().getOrDefault(member, Collections.emptyList())); }  @Subscribe void on(final RepositoryCreatedEvent event); @Subscribe void on(final RepositoryUpdatedEvent event); @Subscribe void on(final RepositoryDeletedEvent event);  }