diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2011-01-16 12:22:46 -0500 |
---|---|---|
committer | Code Review <codereview-daemon@eclipse.org> | 2011-01-16 12:22:46 -0500 |
commit | de1d057d72e101a240ac877f8513d9a66c389c17 (patch) | |
tree | b31cdd21661aa11bf8a0de02f5443109068518d8 /org.eclipse.jgit.test/tst/org/eclipse/jgit | |
parent | 67e176e529877f7dad0356019ab0ebec6888739a (diff) | |
parent | c45f2aec56a323a55119de0d17951fdb302f1c72 (diff) | |
download | jgit-de1d057d72e101a240ac877f8513d9a66c389c17.tar.gz jgit-de1d057d72e101a240ac877f8513d9a66c389c17.zip |
Merge "File utility for creating a new empty file"
Diffstat (limited to 'org.eclipse.jgit.test/tst/org/eclipse/jgit')
-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); + } + } |