chutney-testing/chutney-legacy

Bug: xpath function make report empty

Closed this issue · 0 comments

To reproduce the bug :

    private static final String STANDARD_XML =
        "<node1>\n" +
            "    <node2 attr1=\"val4\"/>\n" +
            "    <node3 attr1=\"val7\">text12</node3>\n" +
            "    <node4/>\n" +
            "    <node5>\n" +
            "        <![CDATA[some stuff]]>\n" +
            "    </node5>\n" +
            "</node1>";

    @Test
    void allow_xml_element_in_report() throws XmlUtils.InvalidXmlDocumentException, XmlUtils.InvalidXPathException, JsonProcessingException {
        WebConfiguration webConfiguration = new WebConfiguration();
        ObjectMapper reportObjectMapper = webConfiguration.reportObjectMapper();

        Object result = XPathFunction.xpath(STANDARD_XML, "/node1/node2");
        assertThat(reportObjectMapper.writeValueAsString(result)).isNotNull();
    }