add unit test test showing bug in FlatFileItemWriter: output file is

deleted on restart if shouldDeleteIfEmpty property is set and no new
records have been written
This commit is contained in:
jpraet
2013-03-05 19:24:13 +01:00
committed by Michael Minella
parent 538d7b1abb
commit 3f2aa18460

View File

@@ -602,6 +602,19 @@ public class FlatFileItemWriterTests {
writer.write(Collections.singletonList("test2"));
assertEquals("test2", readLine());
}
@Test
public void testDeleteOnExitNoRecordsWrittenAfterRestart() throws Exception {
writer.setShouldDeleteIfEmpty(true);
writer.open(executionContext);
writer.write(Collections.singletonList("test2"));
writer.update(executionContext);
writer.close();
assertTrue(outputFile.exists());
writer.open(executionContext);
writer.close();
assertTrue(outputFile.exists());
}
@Test
public void testWriteHeaderAfterRestartOnFirstChunk() throws Exception {