corrected a couple of refactoring items missed:
- in testGetThrowableI, replaced construction of explicit class instance with getThrowable abstract method - in testPrintPartialStackTrace, replaced class name in startsWith assert from explcit class name to class from getNestable abstract method - in testPrintStackTrace, replaced class name in startsWith assert from explicit class name to class name from getThrowableClass abstract method - in testPrintStackTrace, replaced class name in indexOf assert from explicit class name to class name from getNestable abstract method removed extranous commented code git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/lang/trunk@137010 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d1b1006b66
commit
8ac7a8a0f4
|
@ -66,7 +66,7 @@ import junit.textui.TestRunner;
|
||||||
* interface.
|
* interface.
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:steven@caswell.name">Steven Caswell</a>
|
* @author <a href="mailto:steven@caswell.name">Steven Caswell</a>
|
||||||
* @version $Id: AbstractNestableTestCase.java,v 1.1 2002/09/11 18:16:10 stevencaswell Exp $
|
* @version $Id: AbstractNestableTestCase.java,v 1.2 2002/09/11 19:40:14 stevencaswell Exp $
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractNestableTestCase extends TestCase
|
public abstract class AbstractNestableTestCase extends TestCase
|
||||||
{
|
{
|
||||||
|
@ -253,7 +253,7 @@ public abstract class AbstractNestableTestCase extends TestCase
|
||||||
throwables = new Class[2];
|
throwables = new Class[2];
|
||||||
throwables[0] = getTester1Class();
|
throwables[0] = getTester1Class();
|
||||||
throwables[1] = getThrowableClass();
|
throwables[1] = getThrowableClass();
|
||||||
n = new NestableExceptionTester1(getThrowable(msgs[1]));
|
n = getTester1(getThrowable(msgs[1]));
|
||||||
doNestableExceptionGetThrowableI(n, throwables, msgs);
|
doNestableExceptionGetThrowableI(n, throwables, msgs);
|
||||||
|
|
||||||
msgs = new String[5];
|
msgs = new String[5];
|
||||||
|
@ -324,7 +324,6 @@ public abstract class AbstractNestableTestCase extends TestCase
|
||||||
msgs[0] = null;
|
msgs[0] = null;
|
||||||
msgs[1] = "level 2";
|
msgs[1] = "level 2";
|
||||||
throwables = new Class[2];
|
throwables = new Class[2];
|
||||||
// throwables[0] = NestableExceptionTester1.class;
|
|
||||||
throwables[0] = getTester1Class();
|
throwables[0] = getTester1Class();
|
||||||
throwables[1] = getThrowableClass();
|
throwables[1] = getThrowableClass();
|
||||||
n = getTester1(getThrowable(msgs[1]));
|
n = getTester1(getThrowable(msgs[1]));
|
||||||
|
@ -514,8 +513,9 @@ public abstract class AbstractNestableTestCase extends TestCase
|
||||||
PrintWriter pw2 = new PrintWriter(ps2, true);
|
PrintWriter pw2 = new PrintWriter(ps2, true);
|
||||||
ne9.printPartialStackTrace(pw2);
|
ne9.printPartialStackTrace(pw2);
|
||||||
String stack2 = baos2.toString();
|
String stack2 = baos2.toString();
|
||||||
assertTrue("stack trace startsWith == org.apache.commons.lang.exception.NestableException: ne9: ne9 exception",
|
String startsWith = ne9.getClass().getName() + ": ne9: ne9 exception";
|
||||||
stack2.startsWith("org.apache.commons.lang.exception.NestableException: ne9: ne9 exception"));
|
assertTrue("stack trace startsWith == " + startsWith,
|
||||||
|
stack2.startsWith(startsWith));
|
||||||
assertEquals("stack trace indexOf rethrown == -1",
|
assertEquals("stack trace indexOf rethrown == -1",
|
||||||
stack2.indexOf("rethrown"), -1);
|
stack2.indexOf("rethrown"), -1);
|
||||||
}
|
}
|
||||||
|
@ -531,10 +531,12 @@ public abstract class AbstractNestableTestCase extends TestCase
|
||||||
PrintWriter pw1 = new PrintWriter(ps1, true);
|
PrintWriter pw1 = new PrintWriter(ps1, true);
|
||||||
ne8.printStackTrace(ps1);
|
ne8.printStackTrace(ps1);
|
||||||
String stack1 = baos1.toString();
|
String stack1 = baos1.toString();
|
||||||
assertTrue("stack trace startsWith == java.lang.Exception: ne8 exception",
|
String startsWith = getThrowableClass().getName() + ": ne8 exception";
|
||||||
stack1.startsWith("java.lang.Exception: ne8 exception"));
|
assertTrue("stack trace startsWith == " + startsWith,
|
||||||
assertTrue("stack trace indexOf org.apache.commons.lang.exception.NestableException: ne8: ne8 exception > -1",
|
stack1.startsWith(startsWith));
|
||||||
stack1.indexOf("org.apache.commons.lang.exception.NestableException: ne8: ne8 exception") > -1);
|
String indexOf = ne8.getClass().getName() + ": ne8: ne8 exception";
|
||||||
|
assertTrue("stack trace indexOf " + indexOf + " > -1",
|
||||||
|
stack1.indexOf(indexOf) > -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue