Added a test case for isNestedThrowable

git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/lang/trunk@137260 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Henri Yandell 2003-03-18 06:14:23 +00:00
parent ff33134d11
commit 47fc18a02e
1 changed files with 13 additions and 0 deletions

View File

@ -149,6 +149,19 @@ public class ExceptionUtilsTestCase extends junit.framework.TestCase
assertTrue("printRootCauseStackTrace(Throwable, PrintWriter) failed",
stackTrace.indexOf(ExceptionUtils.WRAPPED_MARKER) == -1);
}
public void testIsNestedThrowable() {
assertTrue("SQLException not nested",
ExceptionUtils.isNestedThrowable(new java.sql.SQLException() ) );
assertTrue("InvocationTargetException not nested",
ExceptionUtils.isNestedThrowable(new java.lang.reflect.InvocationTargetException( new Exception() ) ) );
assertTrue("NestableRuntimeException not nested",
ExceptionUtils.isNestedThrowable(new NestableRuntimeException() ) );
// TODO: Come up with a way to test if java.lang.Throwable is nested.
// bearing in mind that in JDK 1.4 it is, and in 1.3 and previous
// it isn't.
}
/**
* Provides a method with a well known chained/nested exception