package com.alexanderlogistics.sepa;

import java.io.IOException;
import java.util.logging.Logger;

import org.imixs.workflow.exceptions.ModelException;
import org.imixs.workflow.exceptions.PluginException;
import org.junit.Before;
import org.junit.Test;

import junit.framework.Assert;

/**
 * Diese Klasse testet die SEPA XSLT Transformation
 * 
 * 
 * @author rsoika
 */
public class TestSEPATransform {

	final static String ENCODING = "UTF-8";

	private static Logger logger = Logger.getLogger(TestSEPATransform.class.getName());

	@Before
	public void setup() throws PluginException, ModelException {
		logger.info("setup test environment ...");

	}

	/**
	 * XSL Transformation for SEPA Standard file
	 * 
	 * @throws IOException
	 */
	@Test
	public void testDefault() throws IOException {
		String MODEL_PATH_XML = "sepa/beispiel-daten.xml";
		String MODEL_PATH_XSL = "sepa/sepa-2.0.5.xsl";
		try {
			XSLTester.transform(MODEL_PATH_XML, MODEL_PATH_XSL, "../reports/sepa/result_sepa01.xml");
		} catch (Exception e) {
			Assert.fail();
		}
	}

	/**
	 * XSL Transformation for SEPA file for Bank Polski
	 * 
	 * We also test the two-digits case. 10,5 need to become 10,50
	 * 
	 * @throws IOException
	 */
	@Test
	public void testBankPolski() throws IOException {
		String MODEL_PATH_XML = "sepa/beispiel-daten.xml";
		String MODEL_PATH_XSL = "sepa/sepa-2.0.10-pl.xsl";
		try {
			XSLTester.transform(MODEL_PATH_XML, MODEL_PATH_XSL, "../reports/sepa/result_sepa02.xml");
		} catch (Exception e) {
			Assert.fail();
		}
	}

}
