// Path: xml-doc/src/main/java/de/ubleipzig/iiifproducer/doc/MetsManifestBuilder.java
// static MetsData getMetsFromFile(final String url) {
//     try {
//         final XBProjector projector = new XBProjector(TO_STRING_RENDERS_XML);
//         return projector.io().file(url).read(MetsData.class);
//     } catch (IOException e) {
//         e.printStackTrace();
//         throw new RuntimeException("Cannot Read XML: " + e.getMessage());
//     }
// }
// 
// Path: xml-doc/src/main/java/de/ubleipzig/iiifproducer/doc/ResourceLoader.java
// public static MetsData getMetsAnchor(final String sourceFileUri) {
//     final File metsFile = new File(sourceFileUri);
//     if (metsFile.exists()) {
//         final String baseFileName = getBaseName(metsFile.getName());
//         final String anchorFileName = baseFileName + "_anchor.xml";
//         final String anchorFilePath = metsFile.getParent() + separator + anchorFileName;
//         final File anchorfile = new File(anchorFilePath);
//         if (anchorfile.exists()) {
//             return getMetsFromFile(anchorfile);
//         }
//     }
//     return null;
// }


import static de.ubleipzig.iiifproducer.doc.MetsManifestBuilder.getMetsFromFile;
import static de.ubleipzig.iiifproducer.doc.ResourceLoader.getMetsAnchor;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import java.io.File;
import java.util.Objects;
import org.junit.jupiter.api.Test;
/*
 * IIIFProducer
 * Copyright (C) 2017 Leipzig University Library <info@ub.uni-leipzig.de>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
 */

package de.ubleipzig.iiifproducer.doc;




public class GetXMLFileTest {

    @Test
    void testGetAnchorFile() {
        final String testFileSource = GetXMLFileTest.class.getResource("/mets/BntItin_021340072.xml").getPath();
// Path: xml-doc/src/main/java/de/ubleipzig/iiifproducer/doc/MetsManifestBuilder.java
// static MetsData getMetsFromFile(final String url) {
//     try {
//         final XBProjector projector = new XBProjector(TO_STRING_RENDERS_XML);
//         return projector.io().file(url).read(MetsData.class);
//     } catch (IOException e) {
//         e.printStackTrace();
//         throw new RuntimeException("Cannot Read XML: " + e.getMessage());
//     }
// }
// 
// Path: xml-doc/src/main/java/de/ubleipzig/iiifproducer/doc/ResourceLoader.java
// public static MetsData getMetsAnchor(final String sourceFileUri) {
//     final File metsFile = new File(sourceFileUri);
//     if (metsFile.exists()) {
//         final String baseFileName = getBaseName(metsFile.getName());
//         final String anchorFileName = baseFileName + "_anchor.xml";
//         final String anchorFilePath = metsFile.getParent() + separator + anchorFileName;
//         final File anchorfile = new File(anchorFilePath);
//         if (anchorfile.exists()) {
//             return getMetsFromFile(anchorfile);
//         }
//     }
//     return null;
// }


// Path: xml-doc/src/test/java/de/ubleipzig/iiifproducer/doc/GetXMLFileTest.java
import static de.ubleipzig.iiifproducer.doc.MetsManifestBuilder.getMetsFromFile;
import static de.ubleipzig.iiifproducer.doc.ResourceLoader.getMetsAnchor;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import java.io.File;
import java.util.Objects;
import org.junit.jupiter.api.Test;

/*
 * IIIFProducer
 * Copyright (C) 2017 Leipzig University Library <info@ub.uni-leipzig.de>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
 */

package de.ubleipzig.iiifproducer.doc;




public class GetXMLFileTest {

    @Test
    void testGetAnchorFile() {
        final String testFileSource = GetXMLFileTest.class.getResource("/mets/BntItin_021340072.xml").getPath();
        final MetsData mets = getMetsAnchor(testFileSource);