@Test
    @Timeout(300)
    void testErrorWithStackTrace() throws InterruptedException, ExecutionException, IOException {
        String expected = "{"
                + "    \"root\": {"
                + "        \"errors\": ["
                + "            {"
                + "                \"code\": 1234,"
                + "                \"message\": \"top of the day\","
                + "                \"stackTrace\": \"java.lang.Throwable\\n\\tat com.yahoo.search.rendering.JsonRendererTestCase.testErrorWithStackTrace(JsonRendererTestCase.java:732)\\n\","
                + "                \"summary\": \"hello\""
                + "            }"
                + "        ],"
                + "        \"fields\": {"
                + "            \"totalCount\": 0"
                + "        },"
                + "        \"id\": \"toplevel\","
                + "        \"relevance\": 1.0"
                + "    }"
                + "}";
        Query q = new Query("/?query=a&tracelevel=5");
        Result r = new Result(q);
        Throwable t = new Throwable();
        StackTraceElement[] stack = new StackTraceElement[1];
        stack[0] = new StackTraceElement(
                "com.yahoo.search.rendering.JsonRendererTestCase",
                "testErrorWithStackTrace", "JsonRendererTestCase.java", 732);
        t.setStackTrace(stack);
        ErrorMessage e = new ErrorMessage(1234, "hello", "top of the day", t);
        r.hits().addError(e);
        String summary = render(r);
        assertEqualJsonContent(expected, summary);
    }
Functional testing of {@link JsonRenderer}.

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