### Question:
SystemException extends BaseSystemException { public String getMessage(Throwable t) { String oldMessage; if (t instanceof InvocationTargetException) { oldMessage = getMessage(((InvocationTargetException) t).getTargetException()); } else if (t instanceof SystemException) { oldMessage = t.getMessage(); } else if (t instanceof SQLException) { oldMessage = getSQLException(t); } else if (t instanceof RuntimeException) { if (t.getMessage() != null) { oldMessage = t.getMessage(); } else if (null != t.getCause() && null != t.getCause().getMessage()) { oldMessage = t.getCause().getMessage(); } else { oldMessage = getCommonMessage(t); } } else { oldMessage = getCommonMessage(t); } return oldMessage; } SystemException(String msg, Throwable t, String... args);  SystemException(String msg);  SystemException(Throwable t);  SystemException(String msg, Throwable t); String getMessage(Throwable t);  }### Answer:
@Test public void testGetMessageCustomExceptionAndCustomMessage() { try { try { String s = null; s.toString(); } catch (Exception e) { String[] str = {"a", "b"}; throw new SystemException("first={0}, second={1}", e, str); } } catch (Exception e) { assertEquals(e.getMessage(), "first=a, second=b"); } }
@Test public void testGetMessageCustomMessage() { try { try { String s = null; s.toString(); } catch (Exception e) { throw new SystemException("自定义异常信息"); } } catch (Exception e) { assertEquals(e.getMessage(), "自定义异常信息"); } }
@Test public void testGetMessageNullPointerException() { try { try { String s = null; s.toString(); } catch (Exception e) { throw new SystemException(e); } } catch (SystemException e) { assertEquals(e.getMessage(), "空指针异常"); } }
@Test public void testGetMessageCustomExceptionAndMessage() { try { try { String s = null; s.toString(); } catch (Exception e) { throw new SystemException("自定义异常信息", e); } } catch (Exception e) { assertEquals(e.getMessage(), "空指针异常"); } }