Package org.custommonkey.xmlunit

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


        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


            expected = readContent(getInputStream(xmlFileName));
        } else {
            expected = readContent(getInputStream(expectedFile));
        }
        Diff myDiff = new Diff(expected, actual);
        assertTrue("Files are similar " + myDiff, myDiff.similar());
    }

    private <T>InputStream getInputStream(String xmlFileName) {
        return getClass().getClassLoader().getResourceAsStream(xmlFileName);
    }
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());
    }

    private java.lang.String readContent(InputStream in) throws IOException {
        StringBuffer sb = new StringBuffer();
        in = new BufferedInputStream(in);
View Full Code Here

        expected.getDocumentElement().normalize();
        actual.getDocumentElement().normalize();

        Diff diff = compareXML(expected, actual);

        assertEquals(msg + ", " + diff.toString(), true, diff.similar());
    }

    /**
     * Assert that the result of an XML comparison is similar.
     *
 
View Full Code Here

        expected.getDocumentElement().normalize();
        actual.getDocumentElement().normalize();

        Diff diff = compareXML(expected, actual);

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

    /**
     * Assert that the result of an XML comparison is identical.
     *
 
View Full Code Here

        expected.getDocumentElement().normalize();
        actual.getDocumentElement().normalize();

        Diff diff = compareXML(expected, actual);

        assertEquals(msg + ", " + diff.toString(), true, diff.similar());
    }

    /**
     * Assert that the result of an XML comparison is similar.
     *
 
View Full Code Here

    @Test
    public void testParse() throws Exception {
        String xml = convertToXml(JSON);
        Diff diff = XMLUnit.compareXML(XML, xml);
        assertTrue(diff.toString(), diff.similar());
    }

    @Test
    public void testParseArray() throws Exception {
        String xml = convertToXml("[{\"name\":\"smith\"},{\"skill\":\"java\"}]", new JsonXmlReader(null, false, "elem"));
View Full Code Here

    @Test
    public void testParseArray() throws Exception {
        String xml = convertToXml("[{\"name\":\"smith\"},{\"skill\":\"java\"}]", new JsonXmlReader(null, false, "elem"));
        Diff diff = XMLUnit.compareXML("<elem><elem><name>smith</name></elem><elem><skill>java</skill></elem></elem>", xml);
        assertTrue(diff.toString(), diff.similar());
    }

    @Test
    public void testParseArrayOfObjects() throws Exception {
        String xml = convertToXml("{\"equipments\":[{\"type\":\"charger\",\"cost\":\"1$\"},{\"type\":\"battery\",\"cost\":\"2$\"}]}", new JsonXmlReader());
View Full Code Here

                "      <equipments>\n" +
                "         <type>battery</type>\n" +
                "         <cost>2$</cost>\n" +
                "      </equipments>\n" +
                "   </equipments>", xml);
        assertTrue(diff.toString(), diff.similar());
    }

    @Test
    public void testParseSimple() throws Exception {
        String xml = convertToXml("1", new JsonXmlReader(null, false, "elem"));
View Full Code Here

    @Test
    public void testParseSimple() throws Exception {
        String xml = convertToXml("1", new JsonXmlReader(null, false, "elem"));
        Diff diff = XMLUnit.compareXML("<elem>1</elem>", xml);
        assertTrue(diff.toString(), diff.similar());
    }

    @Test(expected = ParserException.class)
    public void testParseSimpleNoRoot() throws Exception {
        ContentHandler contentHandler = mock(ContentHandler.class);
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.