RESOLVED - BATCH-435 Tasklet step now propagates JobInterruptedException up to job

This commit is contained in:
robokaso
2008-03-10 09:38:43 +00:00
parent 383a9587be
commit 21325042ef
2 changed files with 24 additions and 0 deletions

View File

@@ -133,6 +133,27 @@ public class TaskletStepTests extends TestCase {
assertNotNull(stepExecution.getEndTime());
}
}
/**
* When job is interrupted the {@link JobInterruptedException} should be propagated up.
*/
public void testJobInterrupted() throws Exception {
TaskletStep step = new TaskletStep(
new Tasklet(){
public ExitStatus execute() throws Exception {
throw new JobInterruptedException("Interrupted while executing tasklet");
}
},
new JobRepositorySupport());
try {
step.execute(stepExecution);
fail();
}
catch (JobInterruptedException expected) {
assertEquals("Interrupted while executing tasklet", expected.getMessage());
}
}
private class StubTasklet extends StepListenerSupport implements Tasklet {