Add unit test for append on restart
This commit is contained in:
@@ -153,6 +153,33 @@ public class FlatFileItemWriterTests {
|
||||
assertEquals("test2", readLine());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteWithAppendRestartOnSecondChunk() throws Exception {
|
||||
writer.setAppendAllowed(true);
|
||||
writer.open(executionContext);
|
||||
writer.write(Collections.singletonList("test1"));
|
||||
writer.close();
|
||||
assertEquals("test1", readLine());
|
||||
reader = null;
|
||||
writer.open(executionContext);
|
||||
writer.write(Collections.singletonList(TEST_STRING));
|
||||
writer.update(executionContext);
|
||||
writer.write(Collections.singletonList(TEST_STRING));
|
||||
writer.close();
|
||||
assertEquals("test1", readLine());
|
||||
assertEquals(TEST_STRING, readLine());
|
||||
assertEquals(TEST_STRING, readLine());
|
||||
assertEquals(null, readLine());
|
||||
writer.open(executionContext);
|
||||
writer.write(Collections.singletonList(TEST_STRING));
|
||||
writer.close();
|
||||
reader = null;
|
||||
assertEquals("test1", readLine());
|
||||
assertEquals(TEST_STRING, readLine());
|
||||
assertEquals(TEST_STRING, readLine());
|
||||
assertEquals(null, readLine());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOpenTwice() {
|
||||
// opening the writer twice should cause no issues
|
||||
|
||||
Reference in New Issue
Block a user