@Test /* * If append=true a new output file should still be created on the first run (not restart). */ public void testAppendToNotYetExistingFile() throws Exception { Resource toBeCreated = new FileSystemResource("build/FlatFileItemWriterTests.out"); File outputFile = toBeCreated.getFile(); //enable easy content reading and auto-delete the file assertFalse("output file does not exist yet", toBeCreated.exists()); this.writer.setResource(toBeCreated); this.writer.setAppendAllowed(true); this.writer.afterPropertiesSet(); this.writer.open(this.executionContext); assertTrue("output file was created", toBeCreated.exists()); this.writer.write(Collections.singletonList(this.trade1)); this.writer.close(); assertFileEquals( new File(EXPECTED_FILE_DIRECTORY + "expected-trades1.json"), outputFile); outputFile.delete(); }