### Question:
MetsParser { public void parseMets(String folderName, String metsName) throws DocumentException, IOException { SAXReader saxReader = new SAXReader(); Document metsDoc = saxReader.read(new InputStreamReader(new FileInputStream(folderName+metsName), "UTF-8")); Element rootElt = metsDoc.getRootElement(); rootElt.addNamespace("mets", "http: rootElt.addNamespace("xlink", "http: Element imgGrpElt = (Element) rootElt.selectSingleNode(" Node imgZipAtt = imgGrpElt.selectSingleNode(" List<Node> fileElements4Img = imgGrpElt.selectNodes("mets:file/mets:file/mets:FLocat/@xlink:href"); Set<String> imgNameSetFromMets = new HashSet<String>(); for(Node file: fileElements4Img){ imgNameSetFromMets.add(formatImgMetsFilename(file.getText())); } String imgZipFileName = folderName + imgZipAtt.getText() + ".dat"; Set<String> imgFileNameSetInZip = ArchiveParser.getNames(new FileInputStream(imgZipFileName)); compareImgSets(imgNameSetFromMets, imgFileNameSetInZip); Element altoGrpElt = (Element) rootElt.selectSingleNode(" Node altoZipAtt = altoGrpElt.selectSingleNode(" List<Node> fileElements4Alto = altoGrpElt.selectNodes("mets:file/mets:file/mets:FLocat/@xlink:href"); Set<String> altoNameSetFromMets = new HashSet<String>(); for(Node file: fileElements4Alto){ altoNameSetFromMets.add(formatAltoMetsFilename(file.getText())); } String altoZipFileName = folderName + altoZipAtt.getText() + ".dat"; Set<String> altoFileNameSetInZip = ArchiveParser.getNames(new FileInputStream(altoZipFileName)); compareAltoSets(altoNameSetFromMets, altoFileNameSetInZip); Node pdfFileElt = rootElt.selectSingleNode(" String pdfFile = pdfFileElt.getText() + ".dat"; int numOfPages = PdfParser.getNumOfPages(folderName + pdfFile); if(numOfPages!=altoFileNameSetInZip.size() || numOfPages!=imgFileNameSetInZip.size()) this.misMatchPage = numOfPages + "," + imgFileNameSetInZip.size() + "," + altoFileNameSetInZip.size(); }  void parseMets(String folderName, String metsName); void compareImgSets(Set<String> mets, Set<String>zip); void compareAltoSets(Set<String> mets, Set<String>zip); void outputResult(String outputFolderName, String metsName);  }### Answer:
@Test public void testParseMets() throws DocumentException, IOException { MetsParser metsParser = new MetsParser(); for(String file: FileListLoader.getFileLisst()) { String[] f = file.split(","); metsParser.parseMets(f[0], f[1]); metsParser.outputResult("src/test/resources/", f[1]); } }