@Test
void testExceptionLogging() throws Exception {

    record.setThrown(new RuntimeException("Example Exception Message") {
        @Override
        public void printStackTrace(PrintWriter pw) {
            pw.println("co.elastic.logging.jboss.logmanager.EcsFormatterTest$1: Example Exception Message");
            pw.println("\tat co.elastic.logging.jboss.logmanager.EcsFormatterTest.testExceptionLogging(EcsFormatterTest.java:125)");
        }
    });
    JsonNode result = objectMapper.readTree(formatter.format(record));
    assertThat(result.get("error.type").textValue()).isEqualTo("co.elastic.logging.jboss.logmanager.EcsFormatterTest$1");
    assertThat(result.get("error.message").textValue()).isEqualTo("Example Exception Message");
    assertThat(result.get("error.stack_trace").textValue())
            .isEqualTo("co.elastic.logging.jboss.logmanager.EcsFormatterTest$1: Example Exception Message\n" +
                    "\tat co.elastic.logging.jboss.logmanager.EcsFormatterTest.testExceptionLogging(EcsFormatterTest.java:125)\n");
}