@Test(expected = RuntimeException.class) public void zapMissingParameter() throws IOException, SAXException { transformer.zap(source("/xquery/string.xml"), "/xquery/string-q2.xq"); }
@Test public void zapLocalFunction() throws IOException, SAXException { Map<String, Object> dynamicEvalParams = new HashMap<>(); dynamicEvalParams.put("language", "Bulgarian"); dynamicEvalParams.put("author_name", "John"); Object[] params = new Object[] { "/xquery/string-q3.xq", dynamicEvalParams }; String zapResult = transformer.zap(source("/xquery/string.xml"), params); assertTrue(XMLUnit.compareXML(result("/xquery/string-q3.xml"), zapResult).similar()); }
@Test public void zapStringParameter() throws IOException, SAXException { Map<String, Object> dynamicParams = new HashMap<>(); dynamicParams.put("language", "English"); Object[] params = new Object[] { "/xquery/string-q2.xq", dynamicParams }; String zapResult1 = transformer.zap(source("/xquery/string.xml"), params); assertTrue(XMLUnit.compareXML(result("/xquery/string-q2.xml"), zapResult1).similar()); dynamicParams.put("language", "German"); String zapResult2 = transformer.zap(source("/xquery/string.xml"), params); assertTrue(XMLUnit.compareXML(result("/xquery/string-q2g.xml"), zapResult2).similar()); }
@Test public void zapParametrisedConstructor() throws IOException, SAXException, XQException { Map<String, Object> configParams = new HashMap<>(); configParams.put(FeatureKeys.PRE_EVALUATE_DOC_FUNCTION, Boolean.TRUE); XqjTransmogrifier<String> localTransformer = new XqjTransmogrifier<>(String.class, configParams); String zapResult = localTransformer.zap(source("/xquery/string.xml"), "/xquery/string-q5.xq" ); assertTrue(XMLUnit.compareXML(result("/xquery/string.xml"), zapResult).similar()); }
@Test public void zapClasspathResolver() throws IOException, SAXException { String zapResult = transformer.zap(source("/xquery/string.xml"), "/xquery/string-q5.xq"); assertTrue(XMLUnit.compareXML(result("/xquery/string.xml"), zapResult).similar()); }
@Test public void zapWithNamespaces() throws IOException, SAXException { String zapResult = transformer.zap(source("/xquery/ns.xml"), "/xquery/ns-q1.xq"); assertTrue(XMLUnit.compareXML(result("/xquery/ns-q1.xml"), zapResult).similar()); }
@Test public void zapSimple() throws IOException, SAXException { String zapResult = transformer.zap(source("/xquery/string.xml"), "/xquery/string-q1.xq"); assertTrue(XMLUnit.compareXML(result("/xquery/string-q1.xml"), zapResult).similar()); }
@Test public void zapMainFunction() throws IOException, SAXException { String zapResult = transformer.zap(source("/xquery/string.xml"), "/xquery/string-q4.xq"); assertTrue(XMLUnit.compareXML(result("/xquery/string.xml"), zapResult).similar()); }
@Test public void zapParametrisedConstructorNoParams() throws IOException, SAXException, XQException { XqjTransmogrifier<String> localTransformer = new XqjTransmogrifier<>(String.class); String zapResult = localTransformer.zap(source("/xquery/string.xml"), "/xquery/string-q5.xq"); assertTrue(XMLUnit.compareXML(result("/xquery/string.xml"), zapResult).similar()); }