* if the constructed objects fail to pass various tests
*/
public <T extends Exception> int test(Class<T> claz) {
- int ncons = testException(claz);
+ int ncons = testAllException(claz);
assertTrue(ncons > 0);
* @throws AssertionError
* if the constructed objects fail to pass various tests
*/
- public <T extends Exception> int testException(Class<T> claz) {
+ public <T extends Exception> int testAllException(Class<T> claz) {
int ncons = 0;
- ncons += testThrowable(claz);
- ncons += testException_Exception(claz);
- ncons += testException_StringException(claz);
- ncons += testException_StringExceptionBooleanBoolean(claz);
+ ncons += testAllThrowable(claz);
+ ncons += testException(claz);
+ ncons += testStringException(claz);
+ ncons += testStringExceptionBooleanBoolean(claz);
return ncons;
}
* @throws AssertionError
* if the constructed objects fail to pass various tests
*/
- public <T extends Exception> int testException_Exception(Class<T> claz) {
+ public <T extends Exception> int testException(Class<T> claz) {
Constructor<T> cons = getConstructor(claz, "exception", Exception.class);
if (cons == null) {
return 0;
* @throws ConstructionError
* if the Exception subclass cannot be constructed
*/
- public <T extends Exception> int testException_StringException(Class<T> claz) {
+ public <T extends Exception> int testStringException(Class<T> claz) {
Constructor<T> cons = getConstructor(claz, "string-exception", String.class, Exception.class);
if (cons == null) {
return 0;
* @throws ConstructionError
* if the Exception subclass cannot be constructed
*/
- public <T extends Exception> int testException_StringExceptionBooleanBoolean(Class<T> claz) {
+ public <T extends Exception> int testStringExceptionBooleanBoolean(Class<T> claz) {
Constructor<T> cons = getConstructor(claz, "string-exception-flags", String.class, Exception.class,
Boolean.TYPE, Boolean.TYPE);
if (cons == null) {
}
// test each combination of "message" and "cause"
- testThrowable_MessageCauseCombos(cons);
+ testMessageCauseCombos(cons);
// test each combination of the boolean flags
- testThrowable_FlagCombos(cons);
+ testFlagCombos(cons);
return 1;
}
* @throws AssertionError
* if the constructed objects fail to pass various tests
*/
- public <T extends Throwable> int testThrowable(Class<T> claz) {
+ public final <T extends Throwable> int testAllThrowable(Class<T> claz) {
int ncons = 0;
- ncons += testThrowable_Default(claz);
- ncons += testThrowable_StringConstuctor(claz);
- ncons += testThrowable_Throwable(claz);
- ncons += testThrowable_StringThrowable(claz);
- ncons += testThrowable_StringThrowableBooleanBoolean(claz);
+ ncons += testDefault(claz);
+ ncons += testString(claz);
+ ncons += testThrowable(claz);
+ ncons += testStringThrowable(claz);
+ ncons += testStringThrowableBooleanBoolean(claz);
return ncons;
}
* @throws AssertionError
* if the constructed objects fail to pass various tests
*/
- public <T extends Throwable> int testThrowable_Default(Class<T> claz) {
+ public final <T extends Throwable> int testDefault(Class<T> claz) {
Constructor<T> cons = getConstructor(claz, "default");
if (cons == null) {
return 0;
* @throws AssertionError
* if the constructed objects fail to pass various tests
*/
- public <T extends Throwable> int testThrowable_StringConstuctor(Class<T> claz) {
+ public final <T extends Throwable> int testString(Class<T> claz) {
Constructor<T> cons = getConstructor(claz, "string", String.class);
if (cons == null) {
return 0;
* @throws AssertionError
* if the constructed objects fail to pass various tests
*/
- public <T extends Throwable> int testThrowable_Throwable(Class<T> claz) {
+ public final <T extends Throwable> int testThrowable(Class<T> claz) {
Constructor<T> cons = getConstructor(claz, "throwable", Throwable.class);
if (cons == null) {
return 0;
* @throws AssertionError
* if the constructed objects fail to pass various tests
*/
- public <T extends Throwable> int testThrowable_StringThrowable(Class<T> claz) {
+ public final <T extends Throwable> int testStringThrowable(Class<T> claz) {
Constructor<T> cons = getConstructor(claz, "string-throwable", String.class, Throwable.class);
if (cons == null) {
return 0;
* @throws AssertionError
* if the constructed objects fail to pass various tests
*/
- public <T extends Throwable> int testThrowable_StringThrowableBooleanBoolean(Class<T> claz) {
+ public final <T extends Throwable> int testStringThrowableBooleanBoolean(Class<T> claz) {
Constructor<T> cons = getConstructor(claz, "string-throwable-flags", String.class, Throwable.class,
Boolean.TYPE, Boolean.TYPE);
if (cons == null) {
}
// test each combination of "message" and "cause"
- testThrowable_MessageCauseCombos(cons);
+ testMessageCauseCombos(cons);
// test each combination of the boolean flags
- testThrowable_SuppressStack(cons);
- testThrowable_SuppressNoStack(cons);
- testThrowable_NoSuppressStack(cons);
- testThrowable_NoSuppressNoStack(cons);
+ testSuppressStack(cons);
+ testSuppressNoStack(cons);
+ testNoSuppressStack(cons);
+ testNoSuppressNoStack(cons);
return 1;
}
* @throws AssertionError
* if the constructed objects fail to pass various tests
*/
- public <T extends Throwable> void testThrowable_MessageCauseCombos(Constructor<T> cons) {
+ public final <T extends Throwable> void testMessageCauseCombos(Constructor<T> cons) {
T ex;
ex = newInstance(cons, null, null, true, true);
* @throws AssertionError
* if the constructed objects fail to pass various tests
*/
- public <T extends Throwable> void testThrowable_FlagCombos(Constructor<T> cons) {
- testThrowable_SuppressStack(cons);
- testThrowable_SuppressNoStack(cons);
- testThrowable_NoSuppressStack(cons);
- testThrowable_NoSuppressNoStack(cons);
+ public final <T extends Throwable> void testFlagCombos(Constructor<T> cons) {
+ testSuppressStack(cons);
+ testSuppressNoStack(cons);
+ testNoSuppressStack(cons);
+ testNoSuppressNoStack(cons);
}
/**
* @throws AssertionError
* if the constructed objects fail to pass various tests
*/
- public <T extends Throwable> void testThrowable_SuppressStack(Constructor<T> cons) {
+ public final <T extends Throwable> void testSuppressStack(Constructor<T> cons) {
T ex = newInstance(cons, "yes,yes", CAUSE, true, true);
ex.addSuppressed(SUPPRESSED);
* @throws AssertionError
* if the constructed objects fail to pass various tests
*/
- public <T extends Throwable> void testThrowable_SuppressNoStack(Constructor<T> cons) {
+ public final <T extends Throwable> void testSuppressNoStack(Constructor<T> cons) {
T ex = newInstance(cons, "yes,no", CAUSE, true, false);
ex.addSuppressed(SUPPRESSED);
* @throws AssertionError
* if the constructed objects fail to pass various tests
*/
- public <T extends Throwable> void testThrowable_NoSuppressStack(Constructor<T> cons) {
+ public final <T extends Throwable> void testNoSuppressStack(Constructor<T> cons) {
T ex = newInstance(cons, "no,yes", CAUSE, false, true);
ex.addSuppressed(SUPPRESSED);
* @throws AssertionError
* if the constructed objects fail to pass various tests
*/
- public <T extends Throwable> void testThrowable_NoSuppressNoStack(Constructor<T> cons) {
+ public final <T extends Throwable> void testNoSuppressNoStack(Constructor<T> cons) {
T ex = newInstance(cons, "no,no", CAUSE, false, false);
ex.addSuppressed(SUPPRESSED);
@Test
public void test() {
- assertEquals(2, new ThrowablesTester().testThrowable(SimpleThrowable.class));
- assertEquals(5, new ThrowablesTester().testThrowable(StaticThrowable.class));
+ assertEquals(2, new ThrowablesTester().testAllThrowable(SimpleThrowable.class));
+ assertEquals(5, new ThrowablesTester().testAllThrowable(StaticThrowable.class));
}
@Test
public void testNoConstructorsThrowable() {
// this will not throw an error, but it should return 0, as there are
// no matching constructors
- assertEquals(0, new ThrowablesTester().testThrowable(NoConstructorsThrowable.class));
+ assertEquals(0, new ThrowablesTester().testAllThrowable(NoConstructorsThrowable.class));
}
@Test(expected = AssertionError.class)
public void testIgnoreMessageThrowable() {
- new ThrowablesTester().testThrowable(IgnoreMessageThrowable.class);
+ new ThrowablesTester().testAllThrowable(IgnoreMessageThrowable.class);
}
@Test(expected = AssertionError.class)
public void testIgnoreCauseThrowable() {
- new ThrowablesTester().testThrowable(IgnoreCauseThrowable.class);
+ new ThrowablesTester().testAllThrowable(IgnoreCauseThrowable.class);
}
@Test(expected = AssertionError.class)
public void testAlwaysSuppressThrowable() {
- new ThrowablesTester().testThrowable(AlwaysSuppressThrowable.class);
+ new ThrowablesTester().testAllThrowable(AlwaysSuppressThrowable.class);
}
@Test(expected = AssertionError.class)
public void testNeverSuppressThrowable() {
- new ThrowablesTester().testThrowable(NeverSuppressThrowable.class);
+ new ThrowablesTester().testAllThrowable(NeverSuppressThrowable.class);
}
@Test(expected = AssertionError.class)
public void testAlwaysWritableThrowable() {
- new ThrowablesTester().testThrowable(AlwaysWritableThrowable.class);
+ new ThrowablesTester().testAllThrowable(AlwaysWritableThrowable.class);
}
@Test(expected = AssertionError.class)
public void testNeverWritableThrowable() {
- new ThrowablesTester().testThrowable(NeverWritableThrowable.class);
+ new ThrowablesTester().testAllThrowable(NeverWritableThrowable.class);
}
@Test(expected = ConstructionError.class)
public void testThrowInstantiationException() {
- new ThrowablesTester().testThrowable(ThrowInstantiationException.class);
+ new ThrowablesTester().testAllThrowable(ThrowInstantiationException.class);
}
/**