ExceptionUtils { public static String errorInfo(Exception e) { return errorInfo(e, null); } private  ExceptionUtils(); static String errorInfo(Exception e); static String errorInfo(Exception e, String detail);  }
@Test public void errorInfo() { assertEquals("RuntimeException: Connection is closed!", ExceptionUtils.errorInfo(new RuntimeException("Connection is closed!"))); assertEquals("RuntimeException: Connection is closed!", ExceptionUtils.errorInfo(new RuntimeException("Connection is closed!"), null)); assertEquals("RuntimeException: Connection is closed, Detail: port is 31", ExceptionUtils.errorInfo(new RuntimeException("Connection is closed"), "port is 31")); }