mirror of
https://github.com/corda/corda.git
synced 2025-01-19 03:06:36 +00:00
Adding unit tests for File.isAbsolute() method.
This commit is contained in:
parent
a0c12ad259
commit
d76191d2bb
29
test/Files.java
Normal file
29
test/Files.java
Normal file
@ -0,0 +1,29 @@
|
||||
import java.io.File;
|
||||
|
||||
public class Files {
|
||||
private static void expect(boolean v) {
|
||||
if (! v) throw new RuntimeException();
|
||||
}
|
||||
|
||||
private static void isAbsoluteTest(boolean absolutePath) {
|
||||
File file = new File("test.txt");
|
||||
if (absolutePath) {
|
||||
file = file.getAbsoluteFile();
|
||||
}
|
||||
|
||||
boolean isAbsolute = file.isAbsolute();
|
||||
|
||||
if (absolutePath) {
|
||||
expect(isAbsolute);
|
||||
} else {
|
||||
expect(!isAbsolute);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
isAbsoluteTest(true);
|
||||
isAbsoluteTest(false);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user