public static String stringifyException(final Throwable e) {
        if (e == null) {
            return STRINGIFIED_NULL_EXCEPTION;
        }

        try {
            StringWriter stm = new StringWriter();
            PrintWriter wrt = new PrintWriter(stm);
            e.printStackTrace(wrt);
            wrt.close();
            return stm.toString();
        } catch (Throwable t) {
            return e.getClass().getName() + " (error while printing stack trace)";
        }
    }
@Test
    void testStringifyNullException() {
        assertThat(ExceptionUtils.STRINGIFIED_NULL_EXCEPTION)
                .isEqualTo(ExceptionUtils.stringifyException(null));
    }