Skip to content

Commit dc17ccb

Browse files
committed
Testing prerequisites for touch() test, making it safer.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/io/trunk@140590 13f79535-47bb-0310-9956-ffa450edef68
1 parent f0bd378 commit dc17ccb

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/test/org/apache/commons/io/FileUtilsTestCase.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
*
3434
* @author Peter Donald
3535
* @author Matthew Hawthorne
36-
* @version $Id: FileUtilsTestCase.java,v 1.21 2004/07/15 08:21:14 scolebourne Exp $
36+
* @version $Id: FileUtilsTestCase.java,v 1.22 2004/07/15 09:49:53 jeremias Exp $
3737
* @see FileUtils
3838
*/
3939
public class FileUtilsTestCase extends FileBasedTestCase {
@@ -453,6 +453,10 @@ public void testFileUtils() throws Exception {
453453

454454
public void testTouch() throws IOException {
455455
File file = new File(getTestDirectory(), "touch.txt") ;
456+
if (file.exists()) {
457+
file.delete();
458+
}
459+
assertTrue("Prerequisite failed, test file exists", !file.exists());
456460
FileUtils.touch(file);
457461
assertTrue("FileUtils.touch() created file.", file.exists());
458462
FileOutputStream out = new FileOutputStream(file) ;

0 commit comments

Comments
 (0)