diff --git a/infrastructure/src/test/java/org/springframework/batch/io/support/FileUtilsTests.java b/infrastructure/src/test/java/org/springframework/batch/io/support/FileUtilsTests.java index 0a1615cda..7421b6363 100644 --- a/infrastructure/src/test/java/org/springframework/batch/io/support/FileUtilsTests.java +++ b/infrastructure/src/test/java/org/springframework/batch/io/support/FileUtilsTests.java @@ -106,12 +106,18 @@ public class FileUtilsTests extends TestCase { public void testBadFile(){ - File file = new File("#:/.out"); + File file = new File("new file"){ + public boolean createNewFile() throws IOException { + throw new IOException(); + } + }; try{ FileUtils.setUpOutputFile(file, false, false); fail(); }catch(DataAccessResourceFailureException ex){ assertTrue(ex.getCause() instanceof IOException); + }finally{ + file.delete(); } }