### Question:
MappingFileReader extends DefaultHandler { public Collection<FieldDescription> readFieldDescriptionsFromFile( File mappingFile) throws IOException, SAXException { parseFile(mappingFile); return fieldDescriptions; } MappingFileReader(SAXParser parser,
			Map<String, ElementMapper<?>> elementMappers); Collection<FieldDescription> readFieldDescriptionsFromFile(
			File mappingFile); @Override void setDocumentLocator(Locator locator); @Override void startElement(String uri, String localName, String qName,
			Attributes attributes); final static String FIELD; final static String TERM_SET_COVER_DEFINITION; final static String FILTER; final static String ANNOTATION; final static String FEATURE; }### Answer:
@Test public void testCreateFieldDescriptions() throws IOException, SAXException{ Collection<FieldDescription> fieldDescriptions = mappingFileReader.readFieldDescriptionsFromFile(new File(MAPPING_FILE)); assertEquals(1, fieldDescriptions.size()); FieldDescription fieldDescription = fieldDescriptions.iterator().next(); assertEquals(FIELD_NAME, fieldDescription.getName()); assertEquals(YES, fieldDescription.getIndex()); assertEquals(NO, fieldDescription.getTermVector()); assertEquals(YES, fieldDescription.getStored()); assertEquals(true, fieldDescription.getMerge()); assertEquals(26, fieldDescription.getLineNumber()); assertEquals(16, fieldDescription.getColumnNumber()); Collection<FilterDescription> filterDescriptions = fieldDescription.getFilterDescriptions(); assertEquals(1, filterDescriptions.size()); FilterDescription filterDescription = filterDescriptions.iterator().next(); assertEquals(TESTCLASS, filterDescription.getClassName()); assertEquals(TESTFACTORY, filterDescription.getFactoryClassName()); assertEquals(FACTORY_NAME, filterDescription.getName()); assertTrue(filterDescription.isReuseFactory()); assertEquals(31, filterDescription.getLineNumber()); assertEquals(56, filterDescription.getColumnNumber()); Properties properties = filterDescription.getProperties(); assertEquals(VALUE, properties.getProperty(KEY)); Collection<AnnotationDescription> annotationDescriptions = fieldDescription.getAnnotationDescriptions(); assertEquals(1, annotationDescriptions.size()); Iterator<AnnotationDescription> annotationDescriptionIterator = annotationDescriptions.iterator(); AnnotationDescription annotationDescription = annotationDescriptionIterator.next(); assertEquals(ANNOTATION1_TYPE, annotationDescription.getType()); assertEquals(SOFA, annotationDescription.getSofa()); assertEquals(FEATURE_PATH, annotationDescription.getFeaturePath()); assertEquals(VALUE_DELIMITER_STRING, annotationDescription.getFeatureValueDelimiterString()); assertEquals(TOKENIZER, annotationDescription.getTokenizer()); assertEquals(35, annotationDescription.getLineNumber()); assertEquals(113, annotationDescription.getColumnNumber()); filterDescriptions = annotationDescription.getFilterDescriptions(); assertEquals(1, filterDescriptions.size()); filterDescription = filterDescriptions.iterator().next(); assertEquals(TESTCLASS, filterDescription.getClassName()); assertEquals(TESTFACTORY, filterDescription.getFactoryClassName()); assertEquals(FACTORY_NAME, filterDescription.getName()); assertTrue(filterDescription.isReuseFactory()); assertEquals(38, filterDescription.getLineNumber()); assertEquals(58, filterDescription.getColumnNumber()); properties = filterDescription.getProperties(); assertEquals(VALUE, properties.getProperty(KEY)); Collection<FeatureDescription> featureDescriptions = annotationDescription.getFeatureDescriptions(); assertEquals(1, featureDescriptions.size()); FeatureDescription featureDescription = featureDescriptions.iterator().next(); assertEquals(FEATURE_NAME, featureDescription.getFeatureName()); assertEquals(NUMBER_FORMAT, featureDescription.getNumberFormat()); assertEquals(41, featureDescription.getLineNumber()); assertEquals(57, featureDescription.getColumnNumber()); TermCoverDescription termCoverDescription = fieldDescription.getTermCoverDescription(); assertNotNull(termCoverDescription); assertEquals(COVER_FILE_PATH, termCoverDescription.getCoverDefinitionFile()); assertEquals(GENERATE_FIELD_NAME_METHOD, termCoverDescription.getGenerateFieldNameMethod()); assertTrue(termCoverDescription.getIgnoreCaseOfSelectedTerms()); assertEquals(28, termCoverDescription.getLineNumber()); assertEquals(72, termCoverDescription.getColumnNumber()); }