BATCH-1665: added strict option to MultiResourceItemReader

This commit is contained in:
Robert Kasanicky
2011-01-12 20:37:24 +01:00
parent ff15bd0648
commit 6a496712ee
2 changed files with 55 additions and 19 deletions

View File

@@ -386,5 +386,28 @@ public class MultiResourceItemReaderIntegrationTests {
assertNull("There is no 'current' resource before read is called", tested.getCurrentResource());
}
/**
* No resources to read should result in error in strict mode.
*/
@Test(expected = IllegalStateException.class)
public void testStrictModeEnabled() throws Exception {
tested.setResources(new Resource[] {});
tested.setStrict(true);
tested.open(ctx);
}
/**
* No resources to read is OK when strict=false.
*/
@Test
public void testStrictModeDisabled() throws Exception {
tested.setResources(new Resource[] {});
tested.setStrict(false);
tested.open(ctx);
assertTrue("empty input doesn't cause an error", true);
}
}