Package org.custommonkey.xmlunit

Examples of org.custommonkey.xmlunit.Diff.identical()


            .withEmptyConfiguration()
            .setup(baos)
            .execute();

        Diff diff = new Diff("<?xml version=\"1.0\" encoding=\"UTF-8\"?><p></p>", new String(baos.toByteArray()));
        assertTrue("XSL transformation didn't work as expected " + diff, diff.identical());
    }
}
View Full Code Here


public class TransformationUtilsTest extends TestCase {

    public void testStringTransformation() throws Exception {
        String result = TransformationUtils.transform("<x>test</x>", this.getClass().getClassLoader().getResource("test.xslt"));
        Diff diff = new Diff("<?xml version=\"1.0\" encoding=\"UTF-8\"?><p></p>", result);
        assertTrue("XSL transformation didn't work as expected " + diff, diff.identical());
    }

    public void testStringTransformationWithParameter() throws Exception {
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("myParam", "abc");
View Full Code Here

        Map<String, Object> params = new HashMap<String, Object>();
        params.put("myParam", "abc");
        String result = TransformationUtils
                .transform("<x>test</x>", params, this.getClass().getClassLoader().getResource("test.xslt"));
        Diff diff = new Diff("<?xml version=\"1.0\" encoding=\"UTF-8\"?><p>abc</p>", result);
        assertTrue("XSL transformation didn't work as expected " + diff, diff.identical());
        assertTrue(result.startsWith("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"));
    }

    public void testStringTransformationWithProperties() throws Exception {
        Properties props = new Properties();
View Full Code Here

    public void testStringTransformationWithProperties() throws Exception {
        Properties props = new Properties();
        props.put("encoding", "iso-8859-1");
        String result = TransformationUtils.transform("<x>test</x>", props, this.getClass().getClassLoader().getResource("test.xslt"));
        Diff diff = new Diff("<?xml version=\"1.0\" encoding=\"iso-8859-1\"?><p/>", result);
        assertTrue("XSL transformation didn't work as expected " + diff, diff.identical());
        assertTrue(result.startsWith("<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>"));
    }

    public void testStringTransformationWithPropertiesAndParameters() throws Exception {
        Properties props = new Properties();
View Full Code Here

        Map<String, Object> params = new HashMap<String, Object>();
        params.put("myParam", "abc");
        String result = TransformationUtils.transform("<x>test</x>", params, props, this.getClass().getClassLoader().getResource(
                "test.xslt"));
        Diff diff = new Diff("<?xml version=\"1.0\" encoding=\"iso-8859-1\"?><p>abc</p>", result);
        assertTrue("XSL transformation didn't work as expected " + diff, diff.identical());
    }
}
View Full Code Here

       String actualDocument = new String(baos.toByteArray());

       Diff diff = new Diff(expectedDocument, actualDocument);
       assertTrue("XInclude transformation didn't work as expected " + diff,
               diff.identical());
   }

}
View Full Code Here

                "href=\"foundation", "href=\"http://www.apache.org/foundation");

        final Diff diff = new Diff(expectedDocument, actualDocument);

        assertTrue("LinkRewrite transformation didn't work as expected " + diff,
                diff.identical());
    }

    @Test
    public void testRegexpLinkRewriting()
            throws Exception {
View Full Code Here

                "href=\"/", "href=\"http://www.apache.org/");

        final Diff diff = new Diff(expectedDocument, actualDocument);

        assertTrue("RegexpLinkRewrite transformation didn't work as expected "
                + diff, diff.identical());
    }

    static class AbsoluteLinkRewriterTransformer
            extends AbstractLinkRewriterTransformer {
View Full Code Here

        expected.getDocumentElement().normalize();
        actual.getDocumentElement().normalize();

        Diff diff = compareXML(expected, actual);

        assertTrue(msg + ", " + diff.toString(), diff.identical());
    }

    /**
     * Assert that the result of an XML comparison is identical.
     *
 
View Full Code Here

        expected.getDocumentElement().normalize();
        actual.getDocumentElement().normalize();

        Diff diff = compareXML(expected, actual);

        assertTrue("Test if the assertion document is equal, " + diff.toString(), diff.identical());
    }

    /**
     * Assert that the result of a byte comparison is identical.
     *
 
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.