Package org.custommonkey.xmlunit

Examples of org.custommonkey.xmlunit.DetailedDiff


        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

    protected RemoteRepoInfo remotePrivateSnapshots;

    protected void assertExpectedMetadata( String expectedMetadata, String actualMetadata )
        throws Exception
    {
        DetailedDiff detailedDiff = new DetailedDiff( new Diff( expectedMetadata, actualMetadata ) );
        if ( !detailedDiff.similar() )
        {
            // If it isn't similar, dump the difference.
            assertEquals( expectedMetadata, actualMetadata );
        }
        // XMLAssert.assertXMLEqual( "Expected Metadata:", expectedMetadata, actualMetadata );
View Full Code Here

        throws LayoutException, IOException, SAXException, ParserConfigurationException
    {
        File metadataFile = new File( repository.getRepoRoot(), tools.toPath( reference ) );
        String actualMetadata = FileUtils.readFileToString( metadataFile, Charset.defaultCharset() );

        DetailedDiff detailedDiff = new DetailedDiff( new Diff( expectedMetadata, actualMetadata ) );
        if ( !detailedDiff.similar() )
        {
            // If it isn't similar, dump the difference.
            assertEquals( expectedMetadata, actualMetadata );
        }
    }
View Full Code Here

        throws LayoutException, IOException, SAXException, ParserConfigurationException
    {
        File metadataFile = new File( repository.getRepoRoot(), tools.toPath( reference ) );
        String actualMetadata = FileUtils.readFileToString( metadataFile, Charset.defaultCharset() );

        DetailedDiff detailedDiff = new DetailedDiff( new Diff( expectedMetadata, actualMetadata ) );
        if ( !detailedDiff.similar() )
        {
            // If it isn't similar, dump the difference.
            assertEquals( expectedMetadata, actualMetadata );
        }
    }
View Full Code Here

        StringWriter actualContents = new StringWriter();
        ArchivaRepositoryMetadata metadata = MavenMetadataReader.read( actualFile );
        RepositoryMetadataWriter.write( metadata, actualContents );

        DetailedDiff detailedDiff = new DetailedDiff( new Diff( expectedMetadataXml, actualContents.toString() ) );
        if ( !detailedDiff.similar() )
        {
            assertEquals( expectedMetadataXml, actualContents );
        }

        // assertEquals( "Check file contents.", expectedMetadataXml, actualContents );
View Full Code Here

    }

    protected void assertXMLisEqual(String actual, String expected) throws Exception {
        XMLUnit.setIgnoreWhitespace(true);
        final Diff diff = new Diff(expected, actual);
        DetailedDiff myDiff = new DetailedDiff(diff);
        List<?> allDifferences = myDiff.getAllDifferences();
        assertEquals(myDiff.toString(), 0, allDifferences.size());
    }
View Full Code Here

                            + "Bad Message Body</span>";
            assertEquals(body, message.getBody());
           
            assertXMLNotEqual(control, message.toXML());
           
            DetailedDiff diffs = new DetailedDiff(new Diff(control, message.toXML()));
           
            // body has no namespace URI, span is escaped
            assertEquals(4, diffs.getAllDifferences().size());
        } catch(XmlPullParserException e) {
            fail("No parser exception should be thrown" + e.getMessage());
        }
       
    }
View Full Code Here

        WebAppDD webappdd = underTest.read(descriptorStream);
        underTest.write(webappdd, out);
       
        final InputStream expectedDescriptorStream = getExpectedDescriptorStream();
        // Use DetailedDiff to list all differences
        final DetailedDiff diff = new DetailedDiff(
                new Diff(new InputStreamReader(expectedDescriptorStream), new FileReader(outputFile))
                );
        final List diffs = diff.getAllDifferences();
        // diffs.size() will be 0 if no differences were found.
        assertEquals( "Encountered differences in XML: " + System.getProperty( "line.separator" ) +
                diff.toString(),
                0, diffs.size() );
       
        // now round-trip it
        WebAppDD webappdd2 = underTest.read(new FileInputStream(outputFile));
        assertNotNull(webappdd2);
View Full Code Here

TOP

Related Classes of org.custommonkey.xmlunit.DetailedDiff

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.