Package org.custommonkey.xmlunit

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


    @Test
    public void testParseNamespace() throws Exception {
        String xml = convertToXml(JSON, new JsonXmlReader("http://javacrumbs.net/test"));
        String xmlWithNamespace = XML.replace("<document>", "<document xmlns=\"http://javacrumbs.net/test\">");
        Diff diff = XMLUnit.compareXML(xmlWithNamespace, xml);
        assertTrue(diff.toString(), diff.similar());
    }

    @Test
    public void testParseNamespaceWithAttributes() throws Exception {
        String xml = convertToXml(JSON, new JsonXmlReader("http://javacrumbs.net/test", true));
View Full Code Here


    @Test
    public void testParseNamespaceWithAttributes() throws Exception {
        String xml = convertToXml(JSON, new JsonXmlReader("http://javacrumbs.net/test", true));
        Diff diff = XMLUnit.compareXML(XML_WITH_TYPES, xml);
        assertTrue(diff.toString(), diff.similar());
    }

    @Test
    public void testParseMultipleRootsArtificialRoot() throws Exception {
        String xml = convertToXml("{\"a\":1, \"b\":2}", new JsonXmlReader(null, false, "artificialRoot"));
View Full Code Here

    @Test
    public void testParseMultipleRootsArtificialRoot() throws Exception {
        String xml = convertToXml("{\"a\":1, \"b\":2}", new JsonXmlReader(null, false, "artificialRoot"));
        Diff diff = XMLUnit.compareXML("<artificialRoot><a>1</a><b>2</b></artificialRoot>", xml);
        assertTrue(diff.toString(), diff.similar());
    }

    @Test
    public void testParseMultipleRootsArtificialRootWithNamespace() throws Exception {
        String xml = convertToXml("{\"a\":1, \"b\":2}", new JsonXmlReader("http://javacrumbs.net/test", false, "artificialRoot"));
View Full Code Here

    @Test
    public void testParseMultipleRootsArtificialRootWithNamespace() throws Exception {
        String xml = convertToXml("{\"a\":1, \"b\":2}", new JsonXmlReader("http://javacrumbs.net/test", false, "artificialRoot"));
        Diff diff = XMLUnit.compareXML("<artificialRoot xmlns=\"http://javacrumbs.net/test\"><a>1</a><b>2</b></artificialRoot>", xml);
        assertTrue(diff.toString(), diff.similar());
    }

    @Test(expected = ParserException.class)
    public void testMultipleRoots() throws Exception {
        ContentHandler contentHandler = mock(ContentHandler.class);
View Full Code Here

            public String convertName(String name) {
                return name.replaceAll("@","_");
            }
        }));
        Diff diff = XMLUnit.compareXML("<_bum>1</_bum>", xml);
        assertTrue(diff.toString(), diff.similar());
    }

    @Test
    public void testArrayOfObjects() throws Exception {
        String xml = convertToXml("{\"root\":[{\"a\":1}, {\"b\":2}]}");
View Full Code Here

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

    @Test
    public void testArrayOfArraysOfObjects() throws Exception {
        String xml = convertToXml("{\"root\":[[{\"a\":1, \"e\":true}, {\"b\":2}],[{\"c\":3}, {\"d\":4}]]}");
View Full Code Here

                "      <root>\n" +
                "         <d>4</d>\n" +
                "      </root>\n" +
                "   </root>\n" +
                "</root>", xml);
        assertTrue(diff.toString(), diff.similar());
    }
    @Test
    public void testArrayOfArraysOfObjectsInRoot() throws Exception {
        String xml = convertToXml("[[{\"a\":1, \"e\":true}, {\"b\":2}],[{\"c\":3}, {\"d\":4}]]", new JsonXmlReader("", false, "root"));
        Diff diff = XMLUnit.compareXML(
View Full Code Here

                "      <root>\n" +
                "         <d>4</d>\n" +
                "      </root>\n" +
                "   </root>\n" +
                "</root>", xml);
        assertTrue(diff.toString(), diff.similar());
    }


    @Test
    public void testArrayOfScalars() throws Exception {
View Full Code Here

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

    @Test
    public void testMapOfObjects() throws Exception {
        String xml = convertToXml("{\"root\":{\"a\":1, \"b\":2}}");
View Full Code Here

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

    @Test
    public void testArrayOfComplexObjects() throws Exception {
        String xml = convertToXml("{\"root\":[{\"a\":{\"a1\":1}}, {\"b\":2}]}");
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.