@Test public void getPropertyNameElementsWithoutAlias() { FactIdentifier factIdentifierMock = mock(FactIdentifier.class); String packageName = "com.package"; String className = "ClassName"; String propertyName = "propertyName"; String aliasName = "AliasName"; when(factIdentifierMock.getClassName()).thenReturn(className); List<String> retrieved = ScenarioSimulationUtils.getPropertyNameElementsWithoutAlias(Collections.singletonList(propertyName), factIdentifierMock); assertEquals(Collections.singletonList(propertyName), retrieved); when(factIdentifierMock.getClassName()).thenReturn(packageName + "." + className); retrieved = ScenarioSimulationUtils.getPropertyNameElementsWithoutAlias(Collections.singletonList(propertyName), factIdentifierMock); assertEquals(Collections.singletonList(propertyName), retrieved); when(factIdentifierMock.getClassName()).thenReturn(className); retrieved = ScenarioSimulationUtils.getPropertyNameElementsWithoutAlias(Arrays.asList(className, propertyName), factIdentifierMock); assertEquals(Arrays.asList(className, propertyName), retrieved); when(factIdentifierMock.getClassName()).thenReturn(packageName + "." + className); retrieved = ScenarioSimulationUtils.getPropertyNameElementsWithoutAlias(Arrays.asList(aliasName, propertyName), factIdentifierMock); assertEquals(Arrays.asList(className, propertyName), retrieved); }
public static List<String> getPropertyNameElementsWithoutAlias(List<String> propertyNameElements, FactIdentifier factIdentifier) { String actualClassName = factIdentifier.getClassName(); if (actualClassName.contains(".")) { actualClassName = actualClassName.substring(actualClassName.lastIndexOf(".") + 1); } List<String> toReturn = new ArrayList<>(); toReturn.addAll(propertyNameElements); if (toReturn.size() > 1) { toReturn.set(0, actualClassName); } return toReturn; }
ScenarioSimulationUtils { public static List<String> getPropertyNameElementsWithoutAlias(List<String> propertyNameElements, FactIdentifier factIdentifier) { String actualClassName = factIdentifier.getClassName(); if (actualClassName.contains(".")) { actualClassName = actualClassName.substring(actualClassName.lastIndexOf(".") + 1); } List<String> toReturn = new ArrayList<>(); toReturn.addAll(propertyNameElements); if (toReturn.size() > 1) { toReturn.set(0, actualClassName); } return toReturn; } }
ScenarioSimulationUtils { public static List<String> getPropertyNameElementsWithoutAlias(List<String> propertyNameElements, FactIdentifier factIdentifier) { String actualClassName = factIdentifier.getClassName(); if (actualClassName.contains(".")) { actualClassName = actualClassName.substring(actualClassName.lastIndexOf(".") + 1); } List<String> toReturn = new ArrayList<>(); toReturn.addAll(propertyNameElements); if (toReturn.size() > 1) { toReturn.set(0, actualClassName); } return toReturn; } private  ScenarioSimulationUtils(); }
ScenarioSimulationUtils { public static List<String> getPropertyNameElementsWithoutAlias(List<String> propertyNameElements, FactIdentifier factIdentifier) { String actualClassName = factIdentifier.getClassName(); if (actualClassName.contains(".")) { actualClassName = actualClassName.substring(actualClassName.lastIndexOf(".") + 1); } List<String> toReturn = new ArrayList<>(); toReturn.addAll(propertyNameElements); if (toReturn.size() > 1) { toReturn.set(0, actualClassName); } return toReturn; } private  ScenarioSimulationUtils(); static String getColumnSubGroup(String columnGroup); static String getOriginalColumnGroup(String columnGroup); static boolean isSimpleJavaType(String className); static String getPlaceHolder(final boolean isInstanceAssigned,
                                        final boolean isPropertyAssigned,
                                        final FactMappingValueType valueType,
                                        final String className); static List<String> getPropertyNameElementsWithoutAlias(List<String> propertyNameElements, FactIdentifier factIdentifier); static ScenarioGridColumn getScenarioGridColumn(String instanceTitle,
                                                           String propertyTitle,
                                                           String columnId,
                                                           String columnGroup,
                                                           FactMappingType factMappingType,
                                                           ScenarioHeaderTextBoxSingletonDOMElementFactory factoryHeader,
                                                           ScenarioCellTextAreaSingletonDOMElementFactory factoryCell,
                                                           String placeHolder); static ScenarioGridColumn getScenarioGridColumn(ScenarioSimulationBuilders.HeaderBuilder headerBuilder,
                                                           ScenarioCellTextAreaSingletonDOMElementFactory factoryCell,
                                                           String placeHolder); static ScenarioSimulationBuilders.ScenarioGridColumnBuilder getScenarioGridColumnBuilder(ScenarioCellTextAreaSingletonDOMElementFactory factoryCell,
                                                                                                    ScenarioSimulationBuilders.HeaderBuilder headerBuilder,
                                                                                                    String placeHolder); static ScenarioSimulationBuilders.HeaderBuilder getHeaderBuilder(String instanceTitle,
                                                                            String propertyTitle,
                                                                            String columnId,
                                                                            String columnGroup,
                                                                            FactMappingType factMappingType,
                                                                            ScenarioHeaderTextBoxSingletonDOMElementFactory factoryHeader); static Point2D getMiddleXYCell(final GridWidget gridWidget, final GridColumn<?> column, boolean isHeader, final int uiRowIndex, final GridLayer gridLayer); static int getCellHeight(final GridWidget gridWidget, final GridColumn<?> column, boolean isHeader, final int uiRowIndex); }
ScenarioSimulationUtils { public static List<String> getPropertyNameElementsWithoutAlias(List<String> propertyNameElements, FactIdentifier factIdentifier) { String actualClassName = factIdentifier.getClassName(); if (actualClassName.contains(".")) { actualClassName = actualClassName.substring(actualClassName.lastIndexOf(".") + 1); } List<String> toReturn = new ArrayList<>(); toReturn.addAll(propertyNameElements); if (toReturn.size() > 1) { toReturn.set(0, actualClassName); } return toReturn; } private  ScenarioSimulationUtils(); static String getColumnSubGroup(String columnGroup); static String getOriginalColumnGroup(String columnGroup); static boolean isSimpleJavaType(String className); static String getPlaceHolder(final boolean isInstanceAssigned,
                                        final boolean isPropertyAssigned,
                                        final FactMappingValueType valueType,
                                        final String className); static List<String> getPropertyNameElementsWithoutAlias(List<String> propertyNameElements, FactIdentifier factIdentifier); static ScenarioGridColumn getScenarioGridColumn(String instanceTitle,
                                                           String propertyTitle,
                                                           String columnId,
                                                           String columnGroup,
                                                           FactMappingType factMappingType,
                                                           ScenarioHeaderTextBoxSingletonDOMElementFactory factoryHeader,
                                                           ScenarioCellTextAreaSingletonDOMElementFactory factoryCell,
                                                           String placeHolder); static ScenarioGridColumn getScenarioGridColumn(ScenarioSimulationBuilders.HeaderBuilder headerBuilder,
                                                           ScenarioCellTextAreaSingletonDOMElementFactory factoryCell,
                                                           String placeHolder); static ScenarioSimulationBuilders.ScenarioGridColumnBuilder getScenarioGridColumnBuilder(ScenarioCellTextAreaSingletonDOMElementFactory factoryCell,
                                                                                                    ScenarioSimulationBuilders.HeaderBuilder headerBuilder,
                                                                                                    String placeHolder); static ScenarioSimulationBuilders.HeaderBuilder getHeaderBuilder(String instanceTitle,
                                                                            String propertyTitle,
                                                                            String columnId,
                                                                            String columnGroup,
                                                                            FactMappingType factMappingType,
                                                                            ScenarioHeaderTextBoxSingletonDOMElementFactory factoryHeader); static Point2D getMiddleXYCell(final GridWidget gridWidget, final GridColumn<?> column, boolean isHeader, final int uiRowIndex, final GridLayer gridLayer); static int getCellHeight(final GridWidget gridWidget, final GridColumn<?> column, boolean isHeader, final int uiRowIndex);  }