private static String exceptionToString(Throwable t) {
        if (t == null) {
            return "(null)";
        }

        try {
            StringWriter stm = new StringWriter();
            PrintWriter wrt = new PrintWriter(stm);
            t.printStackTrace(wrt);
            wrt.close();
            return stm.toString();
        } catch (Throwable ignored) {
            return t.getClass().getName() + " (error while printing stack trace)";
        }
    }
Adds automatic test name logging. Every test which wants to log which test is currently executed
and why it failed, simply has to extend this class.

<p>Copied from Flink project.</p>
inlong-sort/sort-common/src/main/java/org/apache/inlong/sort/util/TestLogger.java