CollectionEditorSingletonDOMElementFactory extends BaseSingletonDOMElementFactory<String, CollectionViewImpl, CollectionEditorDOMElement> { protected Map<String, Map<String, String>> getExpandablePropertiesMap(String typeName) { final Map<String, Map<String, String>> toReturn = new HashMap<>(); if (isSimpleJavaType(typeName)) { return toReturn; } boolean isRule = RULE.equals(scenarioSimulationContext.getSettings().getType()); final Map<String, String> expandableProperties = scenarioSimulationContext.getDataObjectFieldsMap().get(typeName).getExpandableProperties(); expandableProperties.forEach((key, nestedTypeName) -> { if (isRule) { nestedTypeName = nestedTypeName.substring(nestedTypeName.lastIndexOf('.') + 1); } toReturn.put(key, getSimplePropertiesMap(nestedTypeName)); }); return toReturn; } CollectionEditorSingletonDOMElementFactory(final GridLienzoPanel gridPanel,
                                                      final GridLayer gridLayer,
                                                      final GridWidget gridWidget,
                                                      final ScenarioSimulationContext scenarioSimulationContext,
                                                      final ViewsProvider viewsProvider); @Override CollectionViewImpl createWidget(); @Override CollectionEditorDOMElement createDomElement(final GridLayer gridLayer,
                                                       final GridWidget gridWidget); @Override CollectionEditorDOMElement createDomElementInternal(final CollectionViewImpl collectionEditorView,
                                                               final GridLayer gridLayer,
                                                               final GridWidget gridWidget); @Override void registerHandlers(final CollectionViewImpl widget, final CollectionEditorDOMElement widgetDomElement);  }
@Test public void getExpandableProperties_SimpleType() { Map<String, Map<String, String>> resultMap = collectionEditorSingletonDOMElementFactorySpy.getExpandablePropertiesMap(STRING_CLASS_NAME); assertTrue(resultMap.isEmpty()); }
@Test public void getExpandableProperties_NotSimpleType() { Map<String, Map<String, String>> expectedResult = new HashMap<>(); expectedResult.put("a", Collections.singletonMap("z", "w")); Map<String, Map<String, String>> resultMap = collectionEditorSingletonDOMElementFactorySpy.getExpandablePropertiesMap(FULL_FACT_CLASSNAME); assertEquals(expectedResult, resultMap); }