### Question:
ExceptionUtil { public static String getErrorMessage(Throwable e) { if (null == e) { return null; } try (StringWriter stringWriter = new StringWriter(); PrintWriter writer = new PrintWriter(stringWriter)) { e.printStackTrace(writer); writer.flush(); stringWriter.flush(); StringBuffer buffer = stringWriter.getBuffer(); return buffer.toString(); } catch (Throwable ee) { logger.error("", ee); } return null; }  static String getErrorMessage(Throwable e);  }### Answer:
@Test public void testGetErrorMessage() { String result = ExceptionUtil.getErrorMessage(null); Assert.assertNull(result); try { ExceptionUtil.getErrorMessage(new IllegalArgumentException("error test")); } catch (Exception e) { Assert.fail(e.getMessage()); } }