@Test public void populateListGroupItemView() { listGroupItemPresenter.populateListGroupItemView(listGroupItemViewMock, "", FACT_MODEL_TREE.getFactName(), FACT_MODEL_TREE); verify(listGroupItemViewMock, times(1)).setFactName(eq(FACT_MODEL_TREE.getFactName())); Map<String, FactModelTree.PropertyTypeName> simpleProperties = FACT_MODEL_TREE.getSimpleProperties(); InOrder inOrder = inOrder(fieldItemPresenterSpy); simpleProperties.keySet().stream().sorted().forEach(key -> { FactModelTree.PropertyTypeName value = simpleProperties.get(key); inOrder.verify(fieldItemPresenterSpy, times(1)).getLIElement(eq(FACT_MODEL_TREE.getFactName()), eq(FACT_MODEL_TREE.getFactName()), eq(key), eq(value.getTypeName()), eq(value.getPropertyTypeNameToVisualize())); }); verify(listGroupItemViewMock, times(simpleProperties.size())).addFactField(anyObject()); reset(listGroupItemViewMock); Map<String, String> expandableProperties = FACT_MODEL_TREE.getExpandableProperties(); expandableProperties.entrySet().stream().sorted().forEach(entry -> inOrder.verify(listGroupItemPresenter, times(1)).getDivElement(eq(""), eq(entry.getKey()), eq(entry.getValue()))); verify(listGroupItemViewMock, times(expandableProperties.size())).addExpandableFactField(anyObject()); }
protected void populateListGroupItemView(ListGroupItemView toPopulate, String parentPath, String factName, FactModelTree factModelTree) { if (factName.equals(factModelTree.getFactName())) { toPopulate.setFactName(factName); } else { toPopulate.setFactNameAndType(factName, factModelTree.getFactName()); } String fullPath = parentPath.isEmpty() ? factName : parentPath + "." + factName; factModelTree.getSimpleProperties().entrySet().stream().sorted(Map.Entry.comparingByKey()).forEach(entry -> toPopulate.addFactField(fieldItemPresenter.getLIElement(fullPath, factName, entry.getKey(), entry.getValue().getTypeName(), entry.getValue().getPropertyTypeNameToVisualize()))); factModelTree.getExpandableProperties().entrySet().stream().sorted(Map.Entry.comparingByValue()).forEach(entry -> toPopulate.addExpandableFactField(getDivElement(fullPath, entry.getKey(), entry.getValue()))); }
ListGroupItemPresenter implements ListGroupItemView.Presenter { protected void populateListGroupItemView(ListGroupItemView toPopulate, String parentPath, String factName, FactModelTree factModelTree) { if (factName.equals(factModelTree.getFactName())) { toPopulate.setFactName(factName); } else { toPopulate.setFactNameAndType(factName, factModelTree.getFactName()); } String fullPath = parentPath.isEmpty() ? factName : parentPath + "." + factName; factModelTree.getSimpleProperties().entrySet().stream().sorted(Map.Entry.comparingByKey()).forEach(entry -> toPopulate.addFactField(fieldItemPresenter.getLIElement(fullPath, factName, entry.getKey(), entry.getValue().getTypeName(), entry.getValue().getPropertyTypeNameToVisualize()))); factModelTree.getExpandableProperties().entrySet().stream().sorted(Map.Entry.comparingByValue()).forEach(entry -> toPopulate.addExpandableFactField(getDivElement(fullPath, entry.getKey(), entry.getValue()))); } }
ListGroupItemPresenter implements ListGroupItemView.Presenter { protected void populateListGroupItemView(ListGroupItemView toPopulate, String parentPath, String factName, FactModelTree factModelTree) { if (factName.equals(factModelTree.getFactName())) { toPopulate.setFactName(factName); } else { toPopulate.setFactNameAndType(factName, factModelTree.getFactName()); } String fullPath = parentPath.isEmpty() ? factName : parentPath + "." + factName; factModelTree.getSimpleProperties().entrySet().stream().sorted(Map.Entry.comparingByKey()).forEach(entry -> toPopulate.addFactField(fieldItemPresenter.getLIElement(fullPath, factName, entry.getKey(), entry.getValue().getTypeName(), entry.getValue().getPropertyTypeNameToVisualize()))); factModelTree.getExpandableProperties().entrySet().stream().sorted(Map.Entry.comparingByValue()).forEach(entry -> toPopulate.addExpandableFactField(getDivElement(fullPath, entry.getKey(), entry.getValue()))); }  }
ListGroupItemPresenter implements ListGroupItemView.Presenter { protected void populateListGroupItemView(ListGroupItemView toPopulate, String parentPath, String factName, FactModelTree factModelTree) { if (factName.equals(factModelTree.getFactName())) { toPopulate.setFactName(factName); } else { toPopulate.setFactNameAndType(factName, factModelTree.getFactName()); } String fullPath = parentPath.isEmpty() ? factName : parentPath + "." + factName; factModelTree.getSimpleProperties().entrySet().stream().sorted(Map.Entry.comparingByKey()).forEach(entry -> toPopulate.addFactField(fieldItemPresenter.getLIElement(fullPath, factName, entry.getKey(), entry.getValue().getTypeName(), entry.getValue().getPropertyTypeNameToVisualize()))); factModelTree.getExpandableProperties().entrySet().stream().sorted(Map.Entry.comparingByValue()).forEach(entry -> toPopulate.addExpandableFactField(getDivElement(fullPath, entry.getKey(), entry.getValue()))); }  @Override void enable(); @Override void enable(String filterTerm); @Override void unselectAll(); @Override void showAll(); @Override void selectProperty(String factName, List<String> propertyParts); @Override void hideProperty(String factName, List<String> propertyParts); @Override boolean isInstanceAssigned(String factName); @Override void setInstanceAssigned(String factName, boolean assigned); @Override void disable(); @Override void init(TestToolsView.Presenter testToolsPresenter); @Override DivElement getDivElement(String factName, FactModelTree factModelTree); @Override DivElement getDivElement(String fullPath, String factName, String factModelTreeClass); @Override void onToggleRowExpansion(ListGroupItemView listGroupItemView, boolean currentlyShown); @Override void onSelectedElement(ListGroupItemView selected); @Override void onSelectedElement(FieldItemView selected); @Override void reset(); @Override String getFilterTerm(); }
ListGroupItemPresenter implements ListGroupItemView.Presenter { protected void populateListGroupItemView(ListGroupItemView toPopulate, String parentPath, String factName, FactModelTree factModelTree) { if (factName.equals(factModelTree.getFactName())) { toPopulate.setFactName(factName); } else { toPopulate.setFactNameAndType(factName, factModelTree.getFactName()); } String fullPath = parentPath.isEmpty() ? factName : parentPath + "." + factName; factModelTree.getSimpleProperties().entrySet().stream().sorted(Map.Entry.comparingByKey()).forEach(entry -> toPopulate.addFactField(fieldItemPresenter.getLIElement(fullPath, factName, entry.getKey(), entry.getValue().getTypeName(), entry.getValue().getPropertyTypeNameToVisualize()))); factModelTree.getExpandableProperties().entrySet().stream().sorted(Map.Entry.comparingByValue()).forEach(entry -> toPopulate.addExpandableFactField(getDivElement(fullPath, entry.getKey(), entry.getValue()))); }  @Override void enable(); @Override void enable(String filterTerm); @Override void unselectAll(); @Override void showAll(); @Override void selectProperty(String factName, List<String> propertyParts); @Override void hideProperty(String factName, List<String> propertyParts); @Override boolean isInstanceAssigned(String factName); @Override void setInstanceAssigned(String factName, boolean assigned); @Override void disable(); @Override void init(TestToolsView.Presenter testToolsPresenter); @Override DivElement getDivElement(String factName, FactModelTree factModelTree); @Override DivElement getDivElement(String fullPath, String factName, String factModelTreeClass); @Override void onToggleRowExpansion(ListGroupItemView listGroupItemView, boolean currentlyShown); @Override void onSelectedElement(ListGroupItemView selected); @Override void onSelectedElement(FieldItemView selected); @Override void reset(); @Override String getFilterTerm();  }