### Question:
SelectorDoc { protected String getSelectorDocumentation(ModelIndex modelIndex) { StringBuffer stringBuffer = new StringBuffer(); Map<String, ClassType> classTypes = modelIndex.getClassTypes(); for (Entry<String, ClassType> classTypeEntry : classTypes.entrySet()) { ClassType classType = classTypeEntry.getValue(); stringBuffer.append(String.format(SIMPLE_SECT_START, classType.getName())); stringBuffer.append(FEATURES_START); this.appendClassTypeAttributes(stringBuffer, classType); this.appendClassTypeAssociations(stringBuffer, classType, modelIndex); stringBuffer.append(FEATURES_END); stringBuffer.append(SIMPLE_SECT_END); } return stringBuffer.toString(); } SelectorDoc(String inputXmiFilename, String outputXmlFilename); static void main(String[] args); static final String ATTRIBUTE; static final String ASSOCIATION; }### Answer:
@Test public void testGetSelectorDocumentation() { String receivedResult = this.selectorDoc.getSelectorDocumentation(MODEL_INDEX); String part1 = String.format(SelectorDoc.SIMPLE_SECT_START, CLASS_TYPE_NAME) + SelectorDoc.FEATURES_START; String part2 = String.format(SelectorDoc.FEATURE, SelectorDoc.ATTRIBUTE, ATTRIBUTE1_NAME); String part3 = String.format(SelectorDoc.FEATURE, SelectorDoc.ATTRIBUTE, ATTRIBUTE2_NAME); String part4 = String.format(SelectorDoc.FEATURE, SelectorDoc.ASSOCIATION, ASSOCIATION_END1_NAME); String part5 = String.format(SelectorDoc.FEATURE, SelectorDoc.ASSOCIATION, ASSOCIATION_END2_NAME); String part6 = SelectorDoc.FEATURES_END + SelectorDoc.SIMPLE_SECT_END; String expectedToString = part1 + part2 + part3 + part4 + part5 + part6; assertEquals(expectedToString, receivedResult); }