package org.etsi.mts.ttcn.part9.xmldiff;

import static org.junit.Assert.*;

import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;

import org.junit.Test;

public class TestDiff_007_MultipleXSD {
	public static final String PREFIX = "xml/007_multiple_xsd";
	public static final String REFERENCE_XML = PREFIX + "/Pos_050101_namespaces_003.xml";
	public static final String[] XSDs = new String[]{
		"test_data/Pos_050101_namespaces_003_merged.xsd"
	};
	public static final String[] XSD_PATH = new String[]{
		PREFIX
	};
	
	
	@Test
	public void test_1() throws IOException, XmlDiffError {
		XmlDiff differ = new XmlDiff(REFERENCE_XML, XSDs, XSD_PATH);
		String textXml = "some.xml";
		String text = new String(Files.readAllBytes(Paths.get(PREFIX, textXml)), 
			StandardCharsets.UTF_8
		);
		StringBuilder error = new StringBuilder();
		
		boolean v = differ.diff(text, error);
		
		assertEquals("", error.toString());
		assertTrue("The XML files must be considered similar", v);
	}

}
