blob: ba590c8ddddb01d4328ad26c693576e978cf8f0d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
package eu.equalparts.cardbase.testutils;
public class TestUtils {
public static TestFile createValidTestFile(String fileName) throws Exception {
TestFile testFile = new TestFile(fileName);
if (!testFile.exists()) {
if (testFile.createNewFile()) {
if (testFile.canWrite()) {
return testFile;
} else {
throw new IllegalArgumentException("Cannot write to " + testFile.getAbsolutePath() + ", aborting...");
}
} else {
throw new IllegalArgumentException(testFile.getAbsolutePath() + " could not be created, aborting...");
}
} else {
throw new IllegalArgumentException(testFile.getAbsolutePath() + " already exists, aborting...");
}
}
}
|