GroupItemSelectorTrackerUtil { public static Set<String> getGroupItemSelectorProviderTypes() { if (_serviceTrackerMap == null) { return Collections.emptySet(); } Collection<GroupItemSelectorProvider> values = _serviceTrackerMap.values(); Stream<GroupItemSelectorProvider> stream = values.stream(); return stream.filter( GroupItemSelectorProvider::isEnabled ).map( GroupItemSelectorProvider::getGroupType ).collect( Collectors.toSet() ); }  static Optional<GroupItemSelectorProvider> getGroupItemSelectorProviderOptional(String groupType); static Set<String> getGroupItemSelectorProviderTypes();  }
@Test public void testGetGroupItemSelectorProviderTypesWithoutRegisteredGroupItemSelectorProvider() { Assert.assertEquals( Collections.emptySet(), GroupItemSelectorTrackerUtil.getGroupItemSelectorProviderTypes()); }
@Test public void testGetGroupItemSelectorProviderTypesWithRegisteredGroupItemSelectorProvider() { ReflectionTestUtil.setFieldValue( GroupItemSelectorTrackerUtil.class, "_serviceTrackerMap", new MockServiceTrackerMap( Collections.singletonMap( "test", new MockGroupItemSelectorProvider()))); Assert.assertEquals( Collections.singleton("test"), GroupItemSelectorTrackerUtil.getGroupItemSelectorProviderTypes()); ReflectionTestUtil.setFieldValue( GroupItemSelectorTrackerUtil.class, "_serviceTrackerMap", null); }