ScenarioSimulationGridHeaderUtilities { public static EnableTestToolsEvent getEnableTestToolsEvent(final ScenarioGrid scenarioGrid, final ScenarioGridColumn scenarioGridColumn, final ScenarioHeaderMetaData clickedScenarioHeaderMetadata, final Integer uiColumnIndex, final String columnGroup) { if (!scenarioGridColumn.isInstanceAssigned()) { String complexSearch = getExistingInstances(columnGroup, scenarioGrid.getType(), scenarioGrid.getModel().getColumns()); return new EnableTestToolsEvent(complexSearch, true); } else if (Objects.equals(clickedScenarioHeaderMetadata.getMetadataType(), ScenarioHeaderMetaData.MetadataType.PROPERTY)) { List<String> propertyNameElements = null; if (scenarioGridColumn.isPropertyAssigned()) { propertyNameElements = getPropertyNameElements(scenarioGrid.getModel(), uiColumnIndex); } return propertyNameElements != null ? new EnableTestToolsEvent(scenarioGridColumn.getInformationHeaderMetaData() .getTitle(), propertyNameElements) : new EnableTestToolsEvent(scenarioGridColumn.getInformationHeaderMetaData().getTitle()); } else { return new EnableTestToolsEvent(scenarioGridColumn.getInformationHeaderMetaData().getTitle(), false); } }  static ScenarioHeaderMetaData getColumnScenarioHeaderMetaData(GridWidget gridWidget, Point2D relativePoint); static ScenarioHeaderMetaData getColumnScenarioHeaderMetaData(final ScenarioGridColumn scenarioGridColumn,
                                                                         final int uiRowIndex); static GridColumn<?> getGridColumn(GridWidget gridWidget, double cx); static boolean isEditableHeader(final ScenarioGridColumn column,
                                           final Integer uiHeaderRowIndex); static EnableTestToolsEvent getEnableTestToolsEvent(final ScenarioGrid scenarioGrid,
                                                               final ScenarioGridColumn scenarioGridColumn,
                                                               final ScenarioHeaderMetaData clickedScenarioHeaderMetadata,
                                                               final Integer uiColumnIndex,
                                                               final String columnGroup); static String getExistingInstances(final String group,
                                              final ScenarioSimulationModel.Type scenarioType,
                                              final List<GridColumn<?>> columns); static List<String> getPropertyNameElements(final AbstractScesimGridModel abstractScesimGridModel, final int columnIndex);  }
@Test public void testEnableTestToolsEventInstanceNotAssigned() { when(scenarioGridColumnOne.isInstanceAssigned()).thenReturn(false); final EnableTestToolsEvent event = ScenarioSimulationGridHeaderUtilities.getEnableTestToolsEvent(scenarioGridMock, scenarioGridColumnOne, clickedScenarioHeaderMetadataMock, UI_COLUMN_INDEX, COLUMN_GROUP); assertThat(event.getFilterTerm()).isEqualTo(COLUMN_ONE_TITLE + ";" + COLUMN_TWO_TITLE + ";" + MULTIPART_VALUE); assertThat(event.isNotEqualsSearch()).isTrue(); }
@Test public void testEnableTestToolsEventInstanceAssigned() { when(scenarioGridColumnOne.isInstanceAssigned()).thenReturn(true); final EnableTestToolsEvent event = ScenarioSimulationGridHeaderUtilities.getEnableTestToolsEvent(scenarioGridMock, scenarioGridColumnOne, clickedScenarioHeaderMetadataMock, UI_COLUMN_INDEX, COLUMN_GROUP); assertThat(event.getFilterTerm()).isEqualTo(COLUMN_ONE_TITLE); assertThat(event.isNotEqualsSearch()).isFalse(); }