diff options
Diffstat (limited to 'org.eclipse.jgit.test/tst')
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/util/FileUtilTest.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/FileUtilTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/FileUtilTest.java index 4ad4234868..d81e686c14 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/FileUtilTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/FileUtilTest.java @@ -175,4 +175,19 @@ public class FileUtilTest { assertTrue(f.delete()); } + public void testCreateNewFile() throws IOException { + File f = new File(trash, "x"); + FileUtils.createNewFile(f); + assertTrue(f.exists()); + + try { + FileUtils.createNewFile(f); + fail("creation of already existing file must fail"); + } catch (IOException e) { + // expected + } + + FileUtils.delete(f); + } + } |