RESOLVED - issue BATCH-457: Error handling broken in SimpleJob
Wrong assertions in tests fixed
This commit is contained in:
@@ -19,8 +19,6 @@ package org.springframework.batch.repeat.exception;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.springframework.batch.repeat.RepeatContext;
|
||||
import org.springframework.batch.repeat.RepeatException;
|
||||
import org.springframework.batch.repeat.exception.DefaultExceptionHandler;
|
||||
|
||||
public class DefaultExceptionHandlerTests extends TestCase {
|
||||
|
||||
@@ -39,9 +37,9 @@ public class DefaultExceptionHandlerTests extends TestCase {
|
||||
public void testError() throws Exception {
|
||||
try {
|
||||
handler.handleException(context, new Error("Foo"));
|
||||
fail("Expected BatchException");
|
||||
} catch (RepeatException e) {
|
||||
assertEquals("Foo", e.getCause().getMessage());
|
||||
fail("Expected Error");
|
||||
} catch (Error e) {
|
||||
assertEquals("Foo", e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,8 +25,6 @@ import org.apache.log4j.Logger;
|
||||
import org.apache.log4j.SimpleLayout;
|
||||
import org.apache.log4j.WriterAppender;
|
||||
import org.springframework.batch.repeat.RepeatContext;
|
||||
import org.springframework.batch.repeat.RepeatException;
|
||||
import org.springframework.batch.repeat.exception.LogOrRethrowExceptionHandler;
|
||||
import org.springframework.batch.support.ExceptionClassifierSupport;
|
||||
|
||||
public class LogOrRethrowExceptionHandlerTests extends TestCase {
|
||||
@@ -57,9 +55,9 @@ public class LogOrRethrowExceptionHandlerTests extends TestCase {
|
||||
public void testError() throws Exception {
|
||||
try {
|
||||
handler.handleException(context, new Error("Foo"));
|
||||
fail("Expected BatchException");
|
||||
} catch (RepeatException e) {
|
||||
assertEquals("Foo", e.getCause().getMessage());
|
||||
fail("Expected Error");
|
||||
} catch (Error e) {
|
||||
assertEquals("Foo", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,10 +21,8 @@ import java.util.Collections;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.springframework.batch.repeat.RepeatContext;
|
||||
import org.springframework.batch.repeat.RepeatException;
|
||||
import org.springframework.batch.repeat.context.RepeatContextCounter;
|
||||
import org.springframework.batch.repeat.context.RepeatContextSupport;
|
||||
import org.springframework.batch.repeat.exception.RethrowOnThresholdExceptionHandler;
|
||||
import org.springframework.batch.support.ExceptionClassifierSupport;
|
||||
|
||||
public class RethrowOnThresholdExceptionHandlerTests extends TestCase {
|
||||
@@ -45,9 +43,9 @@ public class RethrowOnThresholdExceptionHandlerTests extends TestCase {
|
||||
public void testError() throws Exception {
|
||||
try {
|
||||
handler.handleException(context, new Error("Foo"));
|
||||
fail("Expected BatchException");
|
||||
} catch (RepeatException e) {
|
||||
assertEquals("Foo", e.getCause().getMessage());
|
||||
fail("Expected Error");
|
||||
} catch (Error e) {
|
||||
assertEquals("Foo", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user