mirror of
https://github.com/corda/corda.git
synced 2025-01-08 14:03:06 +00:00
30 lines
566 B
Java
30 lines
566 B
Java
|
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);
|
||
|
}
|
||
|
|
||
|
}
|