public void test_with_groupref() throws IOException, SAXException, EDIConfigurationException {
EdifactModel model1 = EDIParser.parseMappingModel(getClass().getResourceAsStream("../MSG1-model.xml"));
EdifactModel model2 = EDIParser.parseMappingModel(getClass().getResourceAsStream("../MSG2-model.xml"));
UNEdifactInterchangeParser parser = new UNEdifactInterchangeParser();
parser.setMappingsRegistry(new DefaultMappingsRegistry(model1, model2));
parser.ignoreNewLines(true);
MockContentHandlerNS handler;
// Test message 01 - no UNA segment...
handler = new MockContentHandlerNS();
NamespaceDeclarationStack namespaceDeclarationStack = new NamespaceDeclarationStack(parser);
parser.setContentHandler(new NamespaceAwareHandler(handler, namespaceDeclarationStack));
parser.parse(new InputSource(getClass().getResourceAsStream("unedifact-msg-01.edi")));
//System.out.println(handler.xmlMapping);
XMLUnit.setIgnoreWhitespace( true );
XMLAssert.assertXMLEqual(new InputStreamReader(getClass().getResourceAsStream("unedifact-msg-expected-01.xml")), new StringReader(handler.xmlMapping.toString()));
// Test message 01 - has a UNA segment...
handler = new MockContentHandlerNS();
parser.setContentHandler(handler);
parser.parse(new InputSource(getClass().getResourceAsStream("unedifact-msg-02.edi")));
// System.out.println(handler.xmlMapping);
XMLUnit.setIgnoreWhitespace( true );
XMLAssert.assertXMLEqual(new InputStreamReader(getClass().getResourceAsStream("unedifact-msg-expected-01.xml")), new StringReader(handler.xmlMapping.toString()));
}