IN PROGRESS - issue BATCH-491: checked exception handling
http://jira.springframework.org/browse/BATCH-491 exception handler signature changed to 'throws Throwable' so that it can simply rethrow without wrapping.
This commit is contained in:
@@ -29,7 +29,7 @@ public class CompositeExceptionHandlerTests extends TestCase {
|
||||
|
||||
private CompositeExceptionHandler handler = new CompositeExceptionHandler();
|
||||
|
||||
public void testNewHandler() throws Exception {
|
||||
public void testNewHandler() throws Throwable {
|
||||
try {
|
||||
handler.handleException(null, new RuntimeException());
|
||||
}
|
||||
@@ -38,7 +38,7 @@ public class CompositeExceptionHandlerTests extends TestCase {
|
||||
}
|
||||
}
|
||||
|
||||
public void testDelegation() throws Exception {
|
||||
public void testDelegation() throws Throwable {
|
||||
final List list = new ArrayList();
|
||||
handler.setHandlers(new ExceptionHandler[] {
|
||||
new ExceptionHandler() {
|
||||
|
||||
@@ -25,7 +25,7 @@ public class DefaultExceptionHandlerTests extends TestCase {
|
||||
private DefaultExceptionHandler handler = new DefaultExceptionHandler();
|
||||
private RepeatContext context = null;
|
||||
|
||||
public void testRuntimeException() throws Exception {
|
||||
public void testRuntimeException() throws Throwable {
|
||||
try {
|
||||
handler.handleException(context, new RuntimeException("Foo"));
|
||||
fail("Expected RuntimeException");
|
||||
@@ -34,7 +34,7 @@ public class DefaultExceptionHandlerTests extends TestCase {
|
||||
}
|
||||
}
|
||||
|
||||
public void testError() throws Exception {
|
||||
public void testError() throws Throwable {
|
||||
try {
|
||||
handler.handleException(context, new Error("Foo"));
|
||||
fail("Expected Error");
|
||||
|
||||
@@ -43,7 +43,7 @@ public class LogOrRethrowExceptionHandlerTests extends TestCase {
|
||||
logger.addAppender(new WriterAppender(new SimpleLayout(), writer));
|
||||
}
|
||||
|
||||
public void testRuntimeException() throws Exception {
|
||||
public void testRuntimeException() throws Throwable {
|
||||
try {
|
||||
handler.handleException(context, new RuntimeException("Foo"));
|
||||
fail("Expected RuntimeException");
|
||||
@@ -52,7 +52,7 @@ public class LogOrRethrowExceptionHandlerTests extends TestCase {
|
||||
}
|
||||
}
|
||||
|
||||
public void testError() throws Exception {
|
||||
public void testError() throws Throwable {
|
||||
try {
|
||||
handler.handleException(context, new Error("Foo"));
|
||||
fail("Expected Error");
|
||||
@@ -61,7 +61,7 @@ public class LogOrRethrowExceptionHandlerTests extends TestCase {
|
||||
}
|
||||
}
|
||||
|
||||
public void testNotRethrownErrorLevel() throws Exception {
|
||||
public void testNotRethrownErrorLevel() throws Throwable {
|
||||
handler.setExceptionClassifier(new ExceptionClassifierSupport() {
|
||||
public Object classify(Throwable throwable) {
|
||||
return LogOrRethrowExceptionHandler.ERROR;
|
||||
@@ -72,7 +72,7 @@ public class LogOrRethrowExceptionHandlerTests extends TestCase {
|
||||
assertNotNull(writer.toString());
|
||||
}
|
||||
|
||||
public void testNotRethrownWarnLevel() throws Exception {
|
||||
public void testNotRethrownWarnLevel() throws Throwable {
|
||||
handler.setExceptionClassifier(new ExceptionClassifierSupport() {
|
||||
public Object classify(Throwable throwable) {
|
||||
return LogOrRethrowExceptionHandler.WARN;
|
||||
@@ -83,7 +83,7 @@ public class LogOrRethrowExceptionHandlerTests extends TestCase {
|
||||
assertNotNull(writer.toString());
|
||||
}
|
||||
|
||||
public void testNotRethrownDebugLevel() throws Exception {
|
||||
public void testNotRethrownDebugLevel() throws Throwable {
|
||||
handler.setExceptionClassifier(new ExceptionClassifierSupport() {
|
||||
public Object classify(Throwable throwable) {
|
||||
return LogOrRethrowExceptionHandler.DEBUG;
|
||||
@@ -94,7 +94,7 @@ public class LogOrRethrowExceptionHandlerTests extends TestCase {
|
||||
assertNotNull(writer.toString());
|
||||
}
|
||||
|
||||
public void testUnclassifiedException() throws Exception {
|
||||
public void testUnclassifiedException() throws Throwable {
|
||||
handler.setExceptionClassifier(new ExceptionClassifierSupport() {
|
||||
public Object classify(Throwable throwable) {
|
||||
return "DEFAULT";
|
||||
|
||||
@@ -31,7 +31,7 @@ public class RethrowOnThresholdExceptionHandlerTests extends TestCase {
|
||||
private RepeatContext parent = new RepeatContextSupport(null);
|
||||
private RepeatContext context = new RepeatContextSupport(parent);
|
||||
|
||||
public void testRuntimeException() throws Exception {
|
||||
public void testRuntimeException() throws Throwable {
|
||||
try {
|
||||
handler.handleException(context, new RuntimeException("Foo"));
|
||||
fail("Expected RuntimeException");
|
||||
@@ -40,7 +40,7 @@ public class RethrowOnThresholdExceptionHandlerTests extends TestCase {
|
||||
}
|
||||
}
|
||||
|
||||
public void testError() throws Exception {
|
||||
public void testError() throws Throwable {
|
||||
try {
|
||||
handler.handleException(context, new Error("Foo"));
|
||||
fail("Expected Error");
|
||||
@@ -49,7 +49,7 @@ public class RethrowOnThresholdExceptionHandlerTests extends TestCase {
|
||||
}
|
||||
}
|
||||
|
||||
public void testNotRethrownWithThreshold() throws Exception {
|
||||
public void testNotRethrownWithThreshold() throws Throwable {
|
||||
handler.setExceptionClassifier(new ExceptionClassifierSupport() {
|
||||
public Object classify(Throwable throwable) {
|
||||
return "RuntimeException";
|
||||
@@ -63,7 +63,7 @@ public class RethrowOnThresholdExceptionHandlerTests extends TestCase {
|
||||
assertEquals(1, counter.getCount());
|
||||
}
|
||||
|
||||
public void testRethrowOnThreshold() throws Exception {
|
||||
public void testRethrowOnThreshold() throws Throwable {
|
||||
handler.setExceptionClassifier(new ExceptionClassifierSupport() {
|
||||
public Object classify(Throwable throwable) {
|
||||
return "RuntimeException";
|
||||
@@ -92,7 +92,7 @@ public class RethrowOnThresholdExceptionHandlerTests extends TestCase {
|
||||
}
|
||||
}
|
||||
|
||||
public void testNotUseParent() throws Exception {
|
||||
public void testNotUseParent() throws Throwable {
|
||||
handler.setExceptionClassifier(new ExceptionClassifierSupport() {
|
||||
public Object classify(Throwable throwable) {
|
||||
return "RuntimeException";
|
||||
@@ -111,7 +111,7 @@ public class RethrowOnThresholdExceptionHandlerTests extends TestCase {
|
||||
}
|
||||
}
|
||||
|
||||
public void testUseParent() throws Exception {
|
||||
public void testUseParent() throws Throwable {
|
||||
handler.setExceptionClassifier(new ExceptionClassifierSupport() {
|
||||
public Object classify(Throwable throwable) {
|
||||
return "RuntimeException";
|
||||
|
||||
@@ -36,7 +36,7 @@ public class SimpleLimitExceptionHandlerTests extends TestCase {
|
||||
// object under test
|
||||
private SimpleLimitExceptionHandler handler = new SimpleLimitExceptionHandler();
|
||||
|
||||
public void testInitializeWithNullContext() throws Exception {
|
||||
public void testInitializeWithNullContext() throws Throwable {
|
||||
try {
|
||||
handler.handleException(null, new RuntimeException("foo"));
|
||||
fail("Expected IllegalArgumentException");
|
||||
@@ -45,7 +45,7 @@ public class SimpleLimitExceptionHandlerTests extends TestCase {
|
||||
}
|
||||
}
|
||||
|
||||
public void testInitializeWithNullContextAndNullException() throws Exception {
|
||||
public void testInitializeWithNullContextAndNullException() throws Throwable {
|
||||
try {
|
||||
handler.handleException(null, null);
|
||||
} catch (NullPointerException e) {
|
||||
@@ -58,7 +58,7 @@ public class SimpleLimitExceptionHandlerTests extends TestCase {
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public void testNormalExceptionThrown() throws Exception {
|
||||
public void testNormalExceptionThrown() throws Throwable {
|
||||
Throwable throwable = new RuntimeException("foo");
|
||||
|
||||
final int MORE_THAN_ZERO = 1;
|
||||
@@ -79,7 +79,7 @@ public class SimpleLimitExceptionHandlerTests extends TestCase {
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public void testLimitedExceptionTypeNotThrown() throws Exception {
|
||||
public void testLimitedExceptionTypeNotThrown() throws Throwable {
|
||||
final int MORE_THAN_ZERO = 1;
|
||||
handler.setLimit(MORE_THAN_ZERO);
|
||||
handler.setExceptionClasses(new Class[] {RuntimeException.class} );
|
||||
@@ -96,7 +96,7 @@ public class SimpleLimitExceptionHandlerTests extends TestCase {
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public void testLimitedExceptionNotThrownFromSiblings() throws Exception {
|
||||
public void testLimitedExceptionNotThrownFromSiblings() throws Throwable {
|
||||
Throwable throwable = new RuntimeException("foo");
|
||||
|
||||
final int MORE_THAN_ZERO = 1;
|
||||
@@ -120,7 +120,7 @@ public class SimpleLimitExceptionHandlerTests extends TestCase {
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public void testLimitedExceptionThrownFromSiblingsWhenUsingParent() throws Exception {
|
||||
public void testLimitedExceptionThrownFromSiblingsWhenUsingParent() throws Throwable {
|
||||
Throwable throwable = new RuntimeException("foo");
|
||||
|
||||
final int MORE_THAN_ZERO = 1;
|
||||
@@ -145,7 +145,7 @@ public class SimpleLimitExceptionHandlerTests extends TestCase {
|
||||
* TransactionInvalidExceptions are swallowed until the exception limit is exceeded. After the limit is exceeded
|
||||
* exceptions are rethrown as BatchCriticalExceptions
|
||||
*/
|
||||
public void testExceptionNotThrownBelowLimit() throws Exception {
|
||||
public void testExceptionNotThrownBelowLimit() throws Throwable {
|
||||
|
||||
final int EXCEPTION_LIMIT = 3;
|
||||
handler.setLimit(EXCEPTION_LIMIT);
|
||||
@@ -178,7 +178,7 @@ public class SimpleLimitExceptionHandlerTests extends TestCase {
|
||||
* TransactionInvalidExceptions are swallowed until the exception limit is exceeded. After the limit is exceeded
|
||||
* exceptions are rethrown as BatchCriticalExceptions
|
||||
*/
|
||||
public void testExceptionThrownAboveLimit() throws Exception {
|
||||
public void testExceptionThrownAboveLimit() throws Throwable {
|
||||
|
||||
final int EXCEPTION_LIMIT = 3;
|
||||
handler.setLimit(EXCEPTION_LIMIT);
|
||||
|
||||
Reference in New Issue
Block a user