SimpleExceptionUtils { public static String getRootMessage(Throwable t){ if (t==null){ return null; } String message = getRootMessage(t.getCause()); if (message==null){ return t.getMessage(); } return message; }  static String getRootMessage(Throwable t);  }
@Test public void throwable_ioexception_runtime_exception_root_message_found() { IOException e = new IOException(new RuntimeException("root message")); Throwable t = new Throwable(e); assertEquals("root message", SimpleExceptionUtils.getRootMessage(t)); }
@Test public void throwable_root_message_found() { Throwable t = new Throwable("root message"); assertEquals("root message", SimpleExceptionUtils.getRootMessage(t)); }
@Test public void throwable_message_null_is_null() { Throwable t = new Throwable(); assertEquals(null, SimpleExceptionUtils.getRootMessage(t)); }
@Test public void null_is_null() { assertEquals(null, SimpleExceptionUtils.getRootMessage(null)); }