Package org.custommonkey.xmlunit

Examples of org.custommonkey.xmlunit.Diff


  public final void assertEqual(Document expected, Document actual)
  {
    expected.getDocumentElement().normalize();
    actual.getDocumentElement().normalize();

    Diff diff = compareXML(expected, actual);

    if (!diff.similar())
    {
      try
      {
        System.out.println("expected:");
        print(expected);
        System.out.println("actual:");
        print(actual);
      }
      catch (Exception e)
      {
        e.printStackTrace();
      }
    }

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


   *
   * @return Diff object describing differences in documents
   */
  public final Diff compareXML(Document control, Document test)
  {
    return new Diff(control, test);
  }
View Full Code Here

  public final void assertEqual(String msg, Document expected, Document actual)
  {
    expected.getDocumentElement().normalize();
    actual.getDocumentElement().normalize();

    Diff diff = compareXML(expected, actual);

    if (!diff.similar())
    {
      try
      {
        System.out.println("expected:");
        print(expected);
        System.out.println("actual:");
        print(actual);
      }
      catch (Exception e)
      {
        e.printStackTrace();
      }
    }

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

  public final void assertEqual(Document expected, Document actual)
  {
    expected.getDocumentElement().normalize();
    actual.getDocumentElement().normalize();

    Diff diff = compareXML(expected, actual);

    if (!diff.similar())
    {
      try
      {
        System.out.println("expected:");
        print(expected);
        System.out.println("actual:");
        print(actual);
      }
      catch (Exception e)
      {
        e.printStackTrace();
      }
    }

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

            iterator.next();
            nsCount++;
        }
        assertTrue(nsCount == 2);
   
        Diff diff = XMLUnit.compareXML(expectedXML, omElement.toString());
        XMLAssert.assertXMLEqual(diff, true);
    }
View Full Code Here

    wrapper.pageable = pageable;
    wrapper.sort = sort;
    wrapper.pageableWithoutSort = new PageRequest(10, 20);
    marshaller.marshal(wrapper, writer);

    assertThat(new Diff(reference, writer.toString()).similar(), is(true));
  }
View Full Code Here

        }
        Assert.assertFalse("The XML message has encrypted data.", hasEncryptedData(inDoc));
       
        // verify that the decrypted message matches what was sent
        Document fragmentDoc = createDocumentfromInputStream(new ByteArrayInputStream(fragment.getBytes()), context);
        Diff xmlDiff = XMLUnit.compareXML(fragmentDoc, inDoc);
       
        Assert.assertTrue("The decrypted document does not match the control document.", xmlDiff.identical());           
    }
View Full Code Here

        XMLUnit.setNormalizeWhitespace(true);
        XMLUnit.setIgnoreDiffBetweenTextAndCDATA(true);
        XMLUnit.setIgnoreWhitespace(true);
        XMLUnit.setIgnoreComments(true);

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

        if (!xmlDiff.similar()) {
            System.out.println("=== ACTUAL PAGE CODE ===");
            System.out.println(pageCode);
            System.out.println("======== ERROR =========");
            System.out.println(xmlDiff.toString());
            System.out.println("========================");
            fail("XML was not similar:" + xmlDiff.toString());
        }
    }
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

        // compare the results to the expected results
        if (expectedFileName != null) {
            in = getClass().getClassLoader().getResourceAsStream(expectedFileName);
            String expected = readContent(in);
            String actual = toString(appModule.getCmpMappings());
            Diff myDiff = new Diff(expected, actual);
            assertTrue("Files are similar " + myDiff, myDiff.similar());
        }
        return appModule.getCmpMappings();
    }
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.