public static String getStackTrace(final Throwable t) {
        if (t == null) {
            return "";
        }
        
        final ByteArrayOutputStream out = new ByteArrayOutputStream();
        final PrintStream ps = new PrintStream(out);
        t.printStackTrace(ps);
        ps.flush();
        return out.toString();
    }
@Test
    void testGetStackTrace() {
        assertEquals("", ExceptionUtil.getStackTrace(null));
        String stackTrace = ExceptionUtil.getStackTrace(nacosRuntimeException);
        assertTrue(
                stackTrace.contains("com.alibaba.nacos.api.exception.runtime.NacosRuntimeException: errCode: 500, errMsg: Test"));
        assertTrue(stackTrace.contains("at"));
        assertTrue(stackTrace.contains("Caused by: java.lang.RuntimeException: I'm caused exception."));
    }