ExperimentalFeaturesGroup implements IsElement,
                                                  ExperimentalFeaturesGroupView.Presenter,
                                                  Comparable<ExperimentalFeaturesGroup> { public void init(final String labelKey, final Collection<ExperimentalFeature> features, final ParameterizedCommand<EditableExperimentalFeature> callback) { PortablePreconditions.checkNotNull("labelKey", labelKey); PortablePreconditions.checkNotNull("features", features); PortablePreconditions.checkNotNull("callback", callback); clear(); this.labelKey = labelKey; this.callback = feature -> { callback.execute(feature); setEnableAllLabel(); }; view.setLabel(getLabel()); features.stream() .map(this::getEditor) .collect(Collectors.toCollection(TreeSet::new)) .forEach(view::render); setEnableAllLabel(); } @Inject  ExperimentalFeaturesGroup(final ExperimentalFeaturesGroupView view, final TranslationService translationService, final ManagedInstance<ExperimentalFeatureEditor> editorInstance); void init(final String labelKey, final Collection<ExperimentalFeature> features, final ParameterizedCommand<EditableExperimentalFeature> callback); @Override void doEnableAll(); @Override HTMLElement getElement(); @Override int compareTo(ExperimentalFeaturesGroup other); void expand(); void collapse(); @Override boolean isExpanded(); @Override void notifyExpand(); @Override String getLabel(); @PreDestroy void clear();  }
@Test public void testGroupsSorting() { ExperimentalFeaturesGroup generalGroup = new ExperimentalFeaturesGroup(view, translationService, editorInstance); generalGroup.init(UberfireExperimentalConstants.experimentalFeaturesGeneralGroupKey, new ArrayList<>(), callback); ExperimentalFeaturesGroup secondGroup = new ExperimentalFeaturesGroup(view, translationService, editorInstance); secondGroup.init(GROUP_KEY, new ArrayList<>(), callback); ExperimentalFeaturesGroup thirdGroup = new ExperimentalFeaturesGroup(view, translationService, editorInstance); thirdGroup.init(ANOTHER_GROUP_KEY, new ArrayList<>(), callback); ExperimentalFeaturesGroup adminGroup = new ExperimentalFeaturesGroup(view, translationService, editorInstance); adminGroup.init(UberfireExperimentalConstants.experimentalFeaturesGlobalGroupKey, new ArrayList<>(), callback); TreeSet<ExperimentalFeaturesGroup> groups = new TreeSet<>(); groups.add(secondGroup); groups.add(adminGroup); groups.add(generalGroup); groups.add(thirdGroup); Assertions.assertThat(groups) .hasSize(4) .containsExactly(generalGroup, secondGroup, thirdGroup, adminGroup); }