add additional test case that shows a bug in the current

StaxEventItemWriter.shouldDeleteIfEmpty: when the writer restarts from a
previous execution where the output file was deleted, this fails because
FileUtils.setUpOutputFile expects the file to be there on restart
This commit is contained in:
jpraet
2013-03-07 19:36:31 +01:00
committed by Michael Minella
parent 3f2aa18460
commit 44d640990d

View File

@@ -431,6 +431,24 @@ public class StaxEventItemWriterTests {
writer.update(executionContext);
writer.close();
writer = createItemWriter();
writer.setShouldDeleteIfEmpty(true);
writer.open(executionContext);
writer.close();
String content = getOutputFileContent();
assertTrue("Wrong content: " + content, content.contains(TEST_STRING));
}
/**
* Test that the writer can restart if the previous execution deleted empty file.
*/
@Test
public void testDeleteIfEmptyRestart() throws Exception {
writer.setShouldDeleteIfEmpty(true);
writer.open(executionContext);
writer.update(executionContext);
writer.close();
assertFalse(resource.getFile().exists());
writer = createItemWriter();
writer.setShouldDeleteIfEmpty(true);
writer.open(executionContext);