@Test public void testGroupByTitle() { final List<CompositeColumn<? extends BaseColumn>> conditions = new ArrayList<CompositeColumn<? extends BaseColumn>>() {{ add(compositeColumn1); add(compositeColumn2); add(compositeColumn3); }}; final String title1 = "title1"; final String title2 = "title2"; doReturn(title1).when(compositeColumn1).getHeader(); doReturn(title2).when(compositeColumn2).getHeader(); doReturn(title1).when(compositeColumn3).getHeader(); final Map<String, List<BaseColumn>> columnGroups = presenter.groupByTitle(conditions); final List<BaseColumn> actualTitle1List = columnGroups.get(title1); final List<BaseColumn> actualTitle2List = columnGroups.get(title2); final ArrayList<CompositeColumn<? extends BaseColumn>> expectedTitle1List = new ArrayList<CompositeColumn<? extends BaseColumn>>() {{ add(compositeColumn1); add(compositeColumn3); }}; final ArrayList<CompositeColumn<? extends BaseColumn>> expectedTitle2List = new ArrayList<CompositeColumn<? extends BaseColumn>>() {{ add(compositeColumn2); }}; assertEquals(2, columnGroups.size()); assertEquals(actualTitle1List, expectedTitle1List); assertEquals(actualTitle2List, expectedTitle2List); }
<T extends BaseColumn> Map<String, List<BaseColumn>> groupByTitle(final List<T> columns) { return columns .stream() .collect(Collectors.groupingBy(DecisionTableColumnViewUtils::getColumnManagementGroupTitle, Collectors.toList())); }
ColumnsPagePresenter { <T extends BaseColumn> Map<String, List<BaseColumn>> groupByTitle(final List<T> columns) { return columns .stream() .collect(Collectors.groupingBy(DecisionTableColumnViewUtils::getColumnManagementGroupTitle, Collectors.toList())); } }
ColumnsPagePresenter { <T extends BaseColumn> Map<String, List<BaseColumn>> groupByTitle(final List<T> columns) { return columns .stream() .collect(Collectors.groupingBy(DecisionTableColumnViewUtils::getColumnManagementGroupTitle, Collectors.toList())); } @Inject  ColumnsPagePresenter(final View view,
                                final GuidedDecisionTableAccordion accordion,
                                final ManagedInstance<NewGuidedDecisionTableColumnWizard> wizardManagedInstance,
                                final TranslationService translationService,
                                final ManagedInstance<DeleteColumnManagementAnchorWidget> deleteColumnManagementAnchorWidgets,
                                final ManagedInstance<AttributeColumnConfigRow> attributeColumnConfigRow,
                                final ColumnManagementView conditionsPanel,
                                final ColumnManagementView actionsPanel,
                                final ShowRuleNameOptionPresenter showRuleNameOptionPresenter); }
ColumnsPagePresenter { <T extends BaseColumn> Map<String, List<BaseColumn>> groupByTitle(final List<T> columns) { return columns .stream() .collect(Collectors.groupingBy(DecisionTableColumnViewUtils::getColumnManagementGroupTitle, Collectors.toList())); } @Inject  ColumnsPagePresenter(final View view,
                                final GuidedDecisionTableAccordion accordion,
                                final ManagedInstance<NewGuidedDecisionTableColumnWizard> wizardManagedInstance,
                                final TranslationService translationService,
                                final ManagedInstance<DeleteColumnManagementAnchorWidget> deleteColumnManagementAnchorWidgets,
                                final ManagedInstance<AttributeColumnConfigRow> attributeColumnConfigRow,
                                final ColumnManagementView conditionsPanel,
                                final ColumnManagementView actionsPanel,
                                final ShowRuleNameOptionPresenter showRuleNameOptionPresenter); @PostConstruct void setup(); View getView(); void init(final GuidedDecisionTableModellerView.Presenter modeller); void onUpdatedLockStatusEvent(final @Observes UpdatedLockStatusEvent event); void onRefreshAttributesPanelEvent(final @Observes RefreshAttributesPanelEvent event); void onRefreshMetaDataPanelEvent(final @Observes RefreshMetaDataPanelEvent event); void onRefreshConditionsPanelEvent(final @Observes RefreshConditionsPanelEvent event); void onRefreshActionsPanelEvent(final @Observes RefreshActionsPanelEvent event); GuidedDecisionTableAccordion getAccordion(); void onDecisionTableSelected(final @Observes DecisionTableSelectedEvent event); void refresh(); }
ColumnsPagePresenter { <T extends BaseColumn> Map<String, List<BaseColumn>> groupByTitle(final List<T> columns) { return columns .stream() .collect(Collectors.groupingBy(DecisionTableColumnViewUtils::getColumnManagementGroupTitle, Collectors.toList())); } @Inject  ColumnsPagePresenter(final View view,
                                final GuidedDecisionTableAccordion accordion,
                                final ManagedInstance<NewGuidedDecisionTableColumnWizard> wizardManagedInstance,
                                final TranslationService translationService,
                                final ManagedInstance<DeleteColumnManagementAnchorWidget> deleteColumnManagementAnchorWidgets,
                                final ManagedInstance<AttributeColumnConfigRow> attributeColumnConfigRow,
                                final ColumnManagementView conditionsPanel,
                                final ColumnManagementView actionsPanel,
                                final ShowRuleNameOptionPresenter showRuleNameOptionPresenter); @PostConstruct void setup(); View getView(); void init(final GuidedDecisionTableModellerView.Presenter modeller); void onUpdatedLockStatusEvent(final @Observes UpdatedLockStatusEvent event); void onRefreshAttributesPanelEvent(final @Observes RefreshAttributesPanelEvent event); void onRefreshMetaDataPanelEvent(final @Observes RefreshMetaDataPanelEvent event); void onRefreshConditionsPanelEvent(final @Observes RefreshConditionsPanelEvent event); void onRefreshActionsPanelEvent(final @Observes RefreshActionsPanelEvent event); GuidedDecisionTableAccordion getAccordion(); void onDecisionTableSelected(final @Observes DecisionTableSelectedEvent event); void refresh();  }