RESOLVED - BATCH-962: refactor TaskletStep's exception handling for better clarity

collapsed repeating try-catch-rethrow blocks into one
This commit is contained in:
robokaso
2008-12-09 13:10:19 +00:00
parent 8f2620123d
commit eaa359b916
4 changed files with 8 additions and 20 deletions

View File

@@ -107,9 +107,9 @@ public class AsyncTaskletStepTests {
step.execute(stepExecution);
assertEquals(25, processed.size());
assertEquals(25, stepExecution.getReadCount());
assertEquals(BatchStatus.COMPLETED, stepExecution.getStatus());
assertEquals(25, stepExecution.getReadCount());
assertEquals(25, processed.size());
}

View File

@@ -142,7 +142,7 @@ public class ChunkOrientedStepIntegrationTests {
// STARTED instead of UNKNOWN
assertEquals(BatchStatus.UNKNOWN, lastStepExecution.getStatus());
String msg = stepExecution.getExitStatus().getExitDescription();
assertTrue(msg.contains("Fatal error detected during commit"));
assertTrue(msg.contains("Fatal failure detected"));
// The original rollback was caused by this one:
assertEquals("Simulate commit failure", stepExecution.getFailureExceptions().get(0).getCause().getMessage());

View File

@@ -319,7 +319,7 @@ public class TaskletStepTests {
step.execute(stepExecution);
Throwable e = stepExecution.getFailureExceptions().get(0);
assertEquals("Fatal error detected during save of step execution context", e.getMessage());
assertEquals("Fatal failure detected", e.getMessage());
assertEquals("foo", e.getCause().getMessage());
assertEquals(BatchStatus.UNKNOWN, stepExecution.getStatus());
}
@@ -643,10 +643,10 @@ public class TaskletStepTests {
step.execute(stepExecution);
assertEquals(BatchStatus.UNKNOWN, stepExecution.getStatus());
String msg = stepExecution.getExitStatus().getExitDescription();
assertTrue(msg.contains("Fatal error detected during commit"));
assertTrue(msg.contains("Fatal failure detected"));
Throwable ex = stepExecution.getFailureExceptions().get(0);
msg = ex.getMessage();
assertTrue(msg.contains("Fatal error detected during commit"));
assertTrue(msg.contains("Fatal failure detected"));
// The original rollback was caused by this one:
assertEquals("Bar", ex.getCause().getMessage());
}