Package org.custommonkey.xmlunit

Examples of org.custommonkey.xmlunit.Diff


    public final void assertIdentical(String msg, Document expected, Document actual) {

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

        Diff diff = compareXML(expected, actual);

        assertEquals(msg + ", " + diff.toString(), true, diff.identical());
    }
View Full Code Here


    public final void assertIdentical(Document expected, Document actual) {

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

        Diff diff = compareXML(expected, actual);

        assertEquals("Test if the assertion document is equal, " + diff.toString(), true, diff.identical());
    }
View Full Code Here

           
            final String remoteRepositoryURL = getRemoteRepositoryURL();

            XMLUnit.setNormalizeWhitespace( true );
           
            Diff diff = XMLUnit.compareXML( expected, actual );
           
            diff.overrideDifferenceListener( new DifferenceListener()
            {
               
                public void skippedComparison( Node arg0, Node arg1 )
                {
                    //do nothing
                }
               
                public int differenceFound( Difference difference )
                {
                    if ( "${remoterepo}".equals( difference.getControlNodeDetail().getValue() ) &&
                                    remoteRepositoryURL.equals( difference.getTestNodeDetail().getValue() ) )
                    {
                        return DifferenceListener.RETURN_IGNORE_DIFFERENCE_NODES_IDENTICAL;
                    }
                    else
                    {
                        return DifferenceListener.RETURN_ACCEPT_DIFFERENCE;
                    }
                }
            });
            diff.appendMessage( sb );
           
            XMLAssert.assertXMLIdentical( diff, true );
        }
        catch ( SAXException e )
        {
View Full Code Here

        String actual = JaxbWls.marshal(WeblogicEjbJar.class, element);

        XMLUnit.setIgnoreWhitespace(true);
        try {
            Diff myDiff = new DetailedDiff(new Diff(expected, actual));
            assertTrue("Files are not similar " + myDiff, myDiff.similar());
        } catch (AssertionFailedError e) {
            assertEquals(expected, actual);
            throw e;
        }
    }
View Full Code Here

        } else {
            expected = readContent(getInputStream(expectedFile));
        }
        XMLUnit.setIgnoreWhitespace(true);
        try {
            Diff myDiff = new DetailedDiff(new Diff(expected, actual));
            assertTrue("Files are not similar " + myDiff, myDiff.similar());
        } catch (AssertionFailedError e) {
            e.printStackTrace();
            assertEquals(expected, actual);
            throw e;
        }
View Full Code Here

        JAXBElement root = new JAXBElement(new QName("http://geronimo.apache.org/xml/ns/j2ee/ejb/openejb-2.0","ejb-jar"), GeronimoEjbJarType.class, g2);
        String result = JaxbOpenejbJar2.marshal(GeronimoEjbJarType.class, root);
        String expected = readContent(getInputStream("geronimo-openejb-converted.xml"));

        Diff myDiff = new DetailedDiff(new Diff(expected, result));
        assertTrue("Files are not similar " + myDiff, myDiff.similar());
    }
View Full Code Here

        if (xmlFileName.equals(expectedFile)) {
            expected = readContent(getInputStream(xmlFileName));
        } else {
            expected = readContent(getInputStream(expectedFile));
        }
        Diff myDiff = new Diff(expected, actual);
        assertTrue("Files are similar " + myDiff, myDiff.similar());
    }
View Full Code Here

        // DIRTY HACK WARNING: we add the "xmlns:wi" attribute reported
        // by DOM, as expected, but not generated by the method under test,
        // otherwise the comparison would fail.
        actual.getDocumentElement().setAttribute(Constants.INSTANCE_PREFIX,
                Constants.INSTANCE_NS);
        Diff diff =  new Diff(expected, actual);
        assertTrue(message + ", " + diff.toString(), diff.similar());
    }
View Full Code Here

        // otherwise the comparison would fail.
        actual.getDocumentElement().setAttribute(Constants.INSTANCE_PREFIX,
                Constants.INSTANCE_NS);
        actual.getDocumentElement().setAttribute("i18n",
                I18nTransformer.I18N_NAMESPACE_URI);
        Diff diff =  new Diff(expected, actual);
        assertTrue(message + ", " + diff.toString(), diff.similar());
    }
View Full Code Here

    public static void assertXMLIgnorePrefix(String aMessage, Document aExpected, Document aActual) throws Exception {
        XMLUnit.setIgnoreComments(true);
        XMLUnit.setIgnoreWhitespace(true);
        XMLUnit.setIgnoreAttributeOrder(true);

        Diff diff = new Diff(aExpected, aActual);
        diff.overrideDifferenceListener(new DifferenceListener() {

            public void skippedComparison(Node aArg0, Node aArg1) {
            }

            public int differenceFound(Difference aDifference) {
View Full Code Here

TOP

Related Classes of org.custommonkey.xmlunit.Diff

Copyright © 2018 www.massapicom. 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.