@Test
    void testXmlRendering() throws Exception {
        Query q = new Query("/?query=a");

        Result result = new Result(q);
        result.setCoverage(new Coverage(500, 1, 1));

        FastHit h = new FastHit("http://localhost/", .95);
        h.setField("$a", "Hello, world.");
        h.setField("b", "foo");
        result.hits().add(h);

        HitGroup g = new HitGroup("usual");
        h = new FastHit("http://localhost/1", .90);
        h.setField("c", "d");
        g.add(h);
        result.hits().add(g);

        HitGroup gg = new HitGroup("type grouphit");
        gg.types().add("grouphit");
        gg.setField("e", "f");
        result.hits().add(gg);
        result.hits().addError(ErrorMessage.createInternalServerError("message"));

        String summary = render(result);

        String expected =
                "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n" +
                        "<result total-hit-count=\"0\" coverage-docs=\"500\" coverage-nodes=\"1\" coverage-full=\"false\" coverage=\"0\" results-full=\"0\" results=\"1\">\n" +
                        "  <error code=\"18\">Internal server error.</error>\n" +
                        "  <errordetails>\n" +
                        "    <error error=\"Internal server error.\" code=\"18\">message</error>\n" +
                        "  </errordetails>\n" +
                        "  <group relevancy=\"1.0\">\n" +
                        "    <hit type=\"summary\" relevancy=\"0.9\">\n" +
                        "      <field name=\"relevancy\">0.9</field>\n" +
                        "      <field name=\"c\">d</field>\n" +
                        "    </hit>\n" +
                        "  </group>\n" +
                        "  <hit type=\"grouphit\" relevancy=\"1.0\">\n" +
                        "    <id>type grouphit</id>\n" +
                        "  </hit>\n" +
                        "  <hit type=\"summary\" relevancy=\"0.95\">\n" +
                        "    <field name=\"relevancy\">0.95</field>\n" +
                        "    <field name=\"b\">foo</field>\n" +
                        "  </hit>\n" +
                        "</result>\n";

        assertEquals(expected, summary);
    }
Test the XML renderer

@author Steinar Knutsen
@author bratseth
container-search/src/test/java/com/yahoo/search/rendering/XMLRendererTestCase.java