/*
 * This file (PrintXMLTest.java) is part of DebGen-LabelPrintLib  developed by ASTRID Research.
 * All rights reserved. Reproduction, modification, use or disclosure
 * to third parties without express authority is forbidden.
 *
 *  Copyright ASTRID Research, Hungary, 2010.
 *
 *  ASTRID Research
 *  Headquaters: Csapó utca 42. Debrecen H-4029 HUNGARY
 *  Phone: +36-52-533-173        Fax: +36-52-533-174
 *  Web: http://www.astrid.hu    E-mail: info@astrid.hu
 *
 * Project name: DEBGEN-Biobank-Project.
 * File last modified at 2010.01.08 14:16
 */
package hu.astrid.debgen.labelprint.systemtest;

import hu.astrid.debgen.labelprint.test.control.TestLabelPrinter;
import hu.astrid.debgen.labelprint.util.ReadFromXML;
import org.junit.Test;
import org.w3c.dom.Document;

import java.util.List;

import static org.junit.Assert.assertEquals;

/**
 * Created by IntelliJ IDEA.
 * User: inagy
 * Date: Jan 8, 2010
 * Time: 2:16:58 PM
 */
public class PrintXMLTest {

    static final String SAMPLE_XML = "/namedpatientexample.xml";
    private static final String EXPECTED_RESOURCE = "/PrintXMLTest_expected.txt";

    @Test
    public void testXmlPrint() throws Exception {
          Document doc = ReadFromXML.readFromXml(getClass().getResource(SAMPLE_XML).toURI());
          TestLabelPrinter printer = new TestLabelPrinter();
          printer.printLabel(doc);
          List<String> result = printer.getResult();
          //String expected = new ResourceHelper().readResource(EXPECTED_RESOURCE);

          assertEquals(
                "^XA~TA000~JSN^LT0^MNW^MTT^PON^PMN^LH0,0^JMA^PR2,2^MD0^JUS^LRN^CI0^XZ\r\n" +
                "^XA\r\n" +
                "^MMT\r\n" +
                "^LL0118\r\n" +
                "^LS0\r\n" +
                "^BY2,3,59^FT94,71^BAN,,N,N\r\n" +
                "^FDDGBR10^FS\r\n" +
                "^FT130,108^A0N,37,36^FH\\^FDDGBR10^FS\r\n" +
                "^FO24,13^GB63,94,94^FS\r\n" +
                "^FT24,88^A0N,75,112^FR^FH\\^FDP^FS\r\n" +
                "^PQ1,0,1,Y^XZ\r\n", result.get(0));
          assertEquals(
                "^XA~TA000~JSN^LT0^MNW^MTT^PON^PMN^LH0,0^JMA^PR2,2^MD0^JUS^LRN^CI0^XZ\r\n" +
                "^XA\r\n" +
                "^MMT\r\n" +
                "^LL0118\r\n" +
                "^LS0\r\n" +
                "^BY2,3,59^FT94,71^BAN,,N,N\r\n" +
                "^FDDGBR10^FS\r\n" +
                "^FT130,108^A0N,37,36^FH\\^FDDGBR10^FS\r\n" +
                "^FO24,13^GB63,94,94^FS\r\n" +
                "^FT24,88^A0N,75,112^FR^FH\\^FDP^FS\r\n" +
                "^PQ1,0,1,Y^XZ\r\n", result.get(1));
          assertEquals(
                "^XA~TA000~JSN^LT0^MNW^MTT^PON^PMN^LH0,0^JMA^PR2,2^MD0^JUS^LRN^CI0^XZ\r\n" +
                "^XA\r\n" +
                "^MMT\r\n" +
                "^LL0118\r\n" +
                "^LS0\r\n" +
                "^BY2,3,59^FT94,71^BAN,,N,N\r\n" +
                "^FDDGBR10^FS\r\n" +
                "^FT130,108^A0N,37,36^FH\\^FDDGBR10^FS\r\n" +
                "^FO24,13^GB63,94,94^FS\r\n" +
                "^FT24,88^A0N,75,112^FR^FH\\^FDP^FS\r\n" +
                "^PQ1,0,1,Y^XZ\r\n", result.get(2));


          //assertEquals(expected, result);

        // TODO - fix compare problem related to "/r/n"


        //fail("TODO");
    }
}
