Package org.custommonkey.xmlunit

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


    @Test
    public void testArrayOfComplexObjects() throws Exception {
        String xml = convertToXml("{\"root\":[{\"a\":{\"a1\":1}}, {\"b\":2}]}");
        Diff diff = XMLUnit.compareXML("<root><root><a><a1>1</a1></a></root><root><b>2</b></root></root>", xml);
        assertTrue(diff.toString(), diff.similar());
    }

    @Test
    public void testXmlEscaping() throws Exception {
        String xml = convertToXml("{\"root\":\"<a>\"}");
View Full Code Here


    @Test
    public void testXmlEscaping() throws Exception {
        String xml = convertToXml("{\"root\":\"<a>\"}");
        Diff diff = XMLUnit.compareXML("<root>&lt;a&gt;</root>", xml);
        assertTrue(diff.toString(), diff.similar());
    }

    public static String convertToXml(final String json) throws Exception {
        return convertToXml(json, new JsonXmlReader());
    }
View Full Code Here

      FitsMetadataElement item = fitsOut.getMetadataElement("filename");
        DifferenceListener myDifferenceListener = new IgnoreAttributeValuesDifferenceListener();
        Diff diff = new Diff(expectedStr,actualStr);
        diff.overrideDifferenceListener(myDifferenceListener);

        if(diff.similar()) {
          System.out.println("PASS: "+item.getValue());
          passed++;
        }
        else {
          System.err.println("FAIL: "+item.getValue());
View Full Code Here

        XMLStreamReader reader = new BeanXMLStreamReaderImpl(null, bean);
        XMLStreamReader2String t3 = new XMLStreamReader2String();
        String xml = t3.transform(reader, null);
        Diff diff = new Diff(XML_RESULT, xml);
        Diff diff1 = new Diff(XML_RESULT1, xml);
        assertTrue(diff.similar() || diff1.similar());
    }

    private static class MyBean {
        private long arr[];
        private String str;
View Full Code Here

    }

    @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());
    }

    /**
     * Creates a {@link Diff} for the given message.
     *
 
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());
    }

  private Document createDocumentFromSource(Source source) {
        try {
            DOMResult result = new DOMResult();
View Full Code Here

        }

        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 ==========");
View Full Code Here

    //v.useXMLSchema(true);
    //v.setJAXP12SchemaSource(xsd);

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

    assertTrue("XML similar " + myDiff.toString(), myDiff.similar());
  }

  public void testTypicalCartSample() throws Exception {
    CheckoutShoppingCartRequest cart = new CheckoutShoppingCartRequest(
        dummyMerchantConstants);
View Full Code Here

    //v.useXMLSchema(true);
    //v.setJAXP12SchemaSource(xsd);

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

    assertTrue("XML similar " + myDiff.toString(), myDiff.similar());
  }

  public void testComplexCartSample() throws Exception {
    CheckoutShoppingCartRequest cart = new CheckoutShoppingCartRequest(
        dummyMerchantConstants);
View Full Code Here

        marshaller.marshal(element, baos);

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

        Diff myDiff = new Diff(expected, actual);
        assertTrue("Files are similar " + myDiff, myDiff.similar());
    }
   
    /**
     * @throws Exception
     */
 
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.