@Test public void toStringTest() throws ComponentLookupException { UIExtensionManager m = mock(UIExtensionManager.class); UIExtension ex = mock(UIExtension.class); UIExtensionFilter filter = mock(UIExtensionFilter.class, "sortByParameter"); UIExtensionFilter realFilter = new SortByParameterFilter(); Map<String, String> params = new HashMap<>(); params.put("title", "Patient information"); when(ex.getParameters()).thenReturn(params); when(ex.getId()).thenReturn("org.phenotips.patientSheet.section.patient-info"); RecordSection s = new UIXRecordSection(ex, m, filter); List<UIExtension> fields = new LinkedList<>(); ex = mock(UIExtension.class); params = new HashMap<>(); params.put("title", "Name"); params.put("enabled", ""); params.put(ORDER, "2"); when(ex.getParameters()).thenReturn(params); fields.add(ex); ex = mock(UIExtension.class); params = new HashMap<>(); params.put("title", "Identifier"); params.put("enabled", "true"); params.put(ORDER, "1"); when(ex.getParameters()).thenReturn(params); fields.add(ex); ex = mock(UIExtension.class); params = new HashMap<>(); params.put("title", "Age"); params.put("enabled", "false"); params.put(ORDER, "3"); when(ex.getParameters()).thenReturn(params); fields.add(ex); ex = mock(UIExtension.class); params = new HashMap<>(); when(ex.getParameters()).thenReturn(params); params.put("title", "Indication for referral"); fields.add(ex); ex = mock(UIExtension.class); params = new HashMap<>(); params.put("title", "Onset"); params.put(ORDER, "4"); when(ex.getParameters()).thenReturn(params); fields.add(ex); when(m.get("org.phenotips.patientSheet.section.patient-info")).thenReturn(fields); List<UIExtension> sorted = realFilter.filter(fields, ORDER); when(filter.filter(fields, ORDER)).thenReturn(sorted); Assert.assertEquals("Patient information [Identifier, Name, Onset, Indication for referral]", s.toString()); }
@Override public String toString() { StringBuilder result = new StringBuilder(getName()); result.append(" ["); result.append(StringUtils.join(getEnabledElements(), ", ")); result.append(']'); return result.toString(); }
UIXRecordSection implements RecordSection { @Override public String toString() { StringBuilder result = new StringBuilder(getName()); result.append(" ["); result.append(StringUtils.join(getEnabledElements(), ", ")); result.append(']'); return result.toString(); } }
UIXRecordSection implements RecordSection { @Override public String toString() { StringBuilder result = new StringBuilder(getName()); result.append(" ["); result.append(StringUtils.join(getEnabledElements(), ", ")); result.append(']'); return result.toString(); } UIXRecordSection(UIExtension extension, UIExtensionManager uixManager, UIExtensionFilter orderFilter); }
UIXRecordSection implements RecordSection { @Override public String toString() { StringBuilder result = new StringBuilder(getName()); result.append(" ["); result.append(StringUtils.join(getEnabledElements(), ", ")); result.append(']'); return result.toString(); } UIXRecordSection(UIExtension extension, UIExtensionManager uixManager, UIExtensionFilter orderFilter); @Override UIExtension getExtension(); @Override String getName(); @Override boolean isEnabled(); @Override void setEnabled(boolean enabled); @Override boolean isExpandedByDefault(); @Override void setExpandedByDefault(boolean expanded); @Override List<RecordElement> getAllElements(); @Override List<RecordElement> getEnabledElements(); @Override void setElements(List<RecordElement> elements); @Override String toString(); }
UIXRecordSection implements RecordSection { @Override public String toString() { StringBuilder result = new StringBuilder(getName()); result.append(" ["); result.append(StringUtils.join(getEnabledElements(), ", ")); result.append(']'); return result.toString(); } UIXRecordSection(UIExtension extension, UIExtensionManager uixManager, UIExtensionFilter orderFilter); @Override UIExtension getExtension(); @Override String getName(); @Override boolean isEnabled(); @Override void setEnabled(boolean enabled); @Override boolean isExpandedByDefault(); @Override void setExpandedByDefault(boolean expanded); @Override List<RecordElement> getAllElements(); @Override List<RecordElement> getEnabledElements(); @Override void setElements(List<RecordElement> elements); @Override String toString();  }