Corrected semantics of ExceptionWithoutCause broken in CVS rev 1.3.

The point of the ExceptionWithoutCause is to test for false-positive
nested exception method signature matches.  Documented this in the
header JavaDoc for both the ExceptionWithCause and
ExceptionWithoutCause classes, and changed the nested exception method
name of the latter from getCause() to getTargetException() to avoid
conflicts with getCause() method of JDK 1.4's Exception class (which
returns Throwable).


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/lang/trunk@137060 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Daniel Rall 2002-09-25 05:50:49 +00:00
parent 9545c70a75
commit c7f2404b97
1 changed files with 11 additions and 2 deletions

View File

@ -107,6 +107,11 @@ public class ExceptionUtilsTestCase extends junit.framework.TestCase
assertEquals(ExceptionUtils.getThrowableCount(null), 0);
}
/**
* Provides a method with a well known chained/nested exception
* name which matches the full signature (e.g. has a return value
* of <code>Throwable</code>.
*/
private static class ExceptionWithCause extends Exception
{
private Throwable cause;
@ -122,11 +127,15 @@ public class ExceptionUtilsTestCase extends junit.framework.TestCase
}
}
/**
* Provides a method with a well known chained/nested exception
* name which does not match the full signature (e.g. lacks a
* return value of <code>Throwable</code>.
*/
private static class ExceptionWithoutCause extends Exception
{
public Throwable getCause()
public void getTargetException()
{
return null;
}
}
}