You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@depot.apache.org by "Adam R. B. Jack" <aj...@trysybase.com> on 2004/05/03 13:07:38 UTC

Fw: cvs commit: gump/project depot.xml

>   +        <depend project="xmlunit"/>

Cool, but what does it do & what do we use it for? Just curious.

regards

Adam

Re: Fw: cvs commit: gump/project depot.xml

Posted by Nick Chalko <ni...@chalko.com>.
Adam R. B. Jack wrote:

>>  +        <depend project="xmlunit"/>
>>    
>>
>
>Cool, but what does it do & what do we use it for? Just curious.
>  
>

JUnit asserts for XML
I use it to assert that the XML content of two files are "equal". 

Like this.

    /**
     * Test the exporting of cached set test1.
     * 
     */
    public void testExport1() throws FileNotFoundException, SAXException,
            IOException, ParserConfigurationException {
        try {
            executeTarget("testExport1");
            File generatedFile = new File("build/test1-export.build.xml");
            File expectedFile = new File(
                    
"src/test/org/apache/depot/update/ant/test1-export.build.xml");
            assertTrue("Expected " + generatedFile + " to  exists",
                    generatedFile.exists());
            XMLAssert
                    .assertXMLEqual("Exported cached set test1",
                            new FileReader(expectedFile), new FileReader(
                                    generatedFile));
        } finally {
            System.out.println(getOutput());
        }
    }