BATCH-1218: changed instanceof to ==

This commit is contained in:
dsyer
2009-04-27 13:03:33 +00:00
parent 546ab820c0
commit 1d1d0b85ca
2 changed files with 55 additions and 3 deletions

View File

@@ -33,6 +33,7 @@ import org.springframework.batch.core.step.skip.SkipPolicy;
import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.item.ItemProcessor;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.ItemStream;
import org.springframework.batch.item.ItemStreamException;
import org.springframework.batch.item.ItemStreamReader;
import org.springframework.batch.item.ItemWriter;
@@ -695,6 +696,56 @@ public class FaultTolerantStepFactoryBeanTests {
assertEquals(BatchStatus.COMPLETED, stepExecution.getStatus());
}
/**
* Check ItemStream is opened
*/
@Test
public void testNestedItemStreamOpened() throws Exception {
ItemStreamReader<String> reader = new ItemStreamReader<String>() {
public void close() throws ItemStreamException {
}
public void open(ExecutionContext executionContext) throws ItemStreamException {
}
public void update(ExecutionContext executionContext) throws ItemStreamException {
}
public String read() throws Exception, UnexpectedInputException, ParseException {
return null;
}
};
ItemStreamReader<String> stream = new ItemStreamReader<String>() {
public void close() throws ItemStreamException {
closed = true;
}
public void open(ExecutionContext executionContext) throws ItemStreamException {
opened = true;
}
public void update(ExecutionContext executionContext) throws ItemStreamException {
}
public String read() throws Exception, UnexpectedInputException, ParseException {
return null;
}
};
factory.setItemReader(reader);
factory.setStreams(new ItemStream[] {stream, reader});
Step step = (Step) factory.getObject();
step.execute(stepExecution);
assertTrue(opened);
assertTrue(closed);
assertEquals(BatchStatus.COMPLETED, stepExecution.getStatus());
}
private static class SkipProcessorStub implements ItemProcessor<String, String> {
private final Collection<String> failures;