I have written a custom exception and invoking the getMessage() method inherited from java.lang.Throwable doesn't return the detail message string.
The following is my custom exception code:
The MyException(String) constructor calls super(message) to construct a throwable with the specified detail message. If I do call printStackTrace() method on a MyException reference it does print the stacktrace along with the detail message:
MyException: My Message at exTest.check(exTest.java:13)
The getMessage() method doesn't return the detail message. The following is the test class: