RESOLVED - issue BATCH-457: Error handling broken in SimpleJob

Wrong assertions in tests fixed
This commit is contained in:
dsyer
2008-03-14 09:20:25 +00:00
parent 4fd2968e5e
commit 9b1bd77e8a
3 changed files with 9 additions and 15 deletions

View File

@@ -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());
}
}
}

View File

@@ -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());
}
}

View File

@@ -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());
}
}