public static String toString(Throwable cause) {
        StringWriter sw = new StringWriter();
        PrintWriter pw = new PrintWriter(sw);
        cause.printStackTrace(pw);
        return sw.toString();
    }
@Test
    public void testToString() {
        String result = ExceptionUtil.toString(throwable);

        assertContains(result, "RuntimeException");
        assertContains(result, "expected exception");
    }