Package org.custommonkey.xmlunit

Examples of org.custommonkey.xmlunit.Diff


        XMLUnit.setIgnoreWhitespace(true);
    }

    @Override
    public final void match(WebServiceMessage message) throws IOException, AssertionError {
        Diff diff = createDiff(message);
        assertTrue("Messages are different, " + diff.toString(), diff.similar(), "Payload", message.getPayloadSource());
    }
View Full Code Here


   
    @Override
    protected void match(SoapMessage soapMessage) throws IOException, AssertionError {
      Document actualDocument = soapMessage.getDocument();
        Document expectedDocument = createDocumentFromSource(expected);
      Diff diff = new Diff(expectedDocument, actualDocument);
        assertTrue("Envelopes are different, " + diff.toString(), diff.similar());
    }
View Full Code Here

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

        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, null );

        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 = RepositoryMetadataReader.read( actualFile );
        RepositoryMetadataWriter.write( metadata, actualContents );

        DetailedDiff detailedDiff = new DetailedDiff( new Diff( expectedMetadataXml, actualContents.toString() ) );
        if ( !detailedDiff.similar() )
        {
            assertEquals( expectedMetadataXml, actualContents );
        }
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 );
        }
View Full Code Here

    }

    private void assertXMLEqual(String expectedXml,
                                String resultXml) {
        try {
            Diff diff = new Diff( expectedXml,
                                  resultXml );
            diff.overrideElementQualifier( new RecursiveElementNameAndTextQualifier() );
            XMLAssert.assertXMLEqual( diff,
                                      true );
        } catch ( Exception e ) {
            throw new RuntimeException( "XML Assertion failure",
                                        e );
View Full Code Here

        InputStream expectedPageCode = getExpectedPageCode(xmlunitPageName);
        if (expectedPageCode == null) {
            return;
        }

        Diff xmlDiff = new Diff(new InputStreamReader(expectedPageCode), new StringReader(pageCode));
        xmlDiff.overrideDifferenceListener(getDifferenceListener());

        if (!xmlDiff.similar()) {
            System.out.println("=== EXPECTED PAGE CODE ===");
            System.out.println(IOUtils.toString(getExpectedPageCode(xmlunitPageName)));
            System.out.println("==== ACTUAL PAGE CODE ====");
            System.out.println(pageCode);
            System.out.println("========= ERROR ==========");
            System.out.println(xmlDiff.toString());
            System.out.println("==========================");
            Assert.fail("XML was not similar:" + xmlDiff.toString());
        }
    }
View Full Code Here

    CheckoutShoppingCartRequest cart = new CheckoutShoppingCartRequest(
        dummyMerchantConstants);
    cart.addItem("HelloWorld 2GB MP3 Player",
        "HelloWorld, the simple MP3 player", 159.99f, 1);

    Diff myDiff = new Diff(shoppingCartSimple, cart.getXml());

    Validator v = new Validator(cart.getXml());
    //v.useXMLSchema(true);
    //v.setJAXP12SchemaSource(xsd);

    //assertTrue("XML valid ", v.isValid());

    assertTrue("XML similar " + myDiff.toString(), myDiff.similar());
  }
View Full Code Here

    ta.addCountryArea(USArea.FULL_50_STATES);
    cart.addDefaultTaxRule(0.0775, false, ta);
    cart.addFlatRateShippingMethod("UPS Ground", 4.99f);
    cart.addFlatRateShippingMethod("UPS 2nd Day Air", 8.99f);

    Diff myDiff = new Diff(shoppingCartTypical, cart.getXml());

    Validator v = new Validator(cart.getXml());
    //v.useXMLSchema(true);
    //v.setJAXP12SchemaSource(xsd);

    //assertTrue("XML valid ", v.isValid());

    assertTrue("XML similar " + myDiff.toString(), myDiff.similar());
  }
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.