Skip to content

Commit 31c38bd

Browse files
committed
FileLocationTest: fix failure on Windows
Rather than assuming the forward slashes will be preserved, let's just test that the parent chain is as expected, up to the topmost.
1 parent ae75cfa commit 31c38bd

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/test/java/org/scijava/io/FileLocationTest.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333

3434
import static org.junit.Assert.assertEquals;
3535

36+
import java.io.File;
37+
3638
import org.junit.Test;
3739

3840
/**
@@ -47,7 +49,14 @@ public class FileLocationTest {
4749
public void testFile() {
4850
final String path = "/not/actually/a/real-file";
4951
final FileLocation loc = new FileLocation(path);
50-
assertEquals(path, loc.getFile().getPath());
52+
final File realFile = loc.getFile();
53+
assertEquals("real-file", realFile.getName());
54+
final File a = realFile.getParentFile();
55+
assertEquals("a", a.getName());
56+
final File actually = a.getParentFile();
57+
assertEquals("actually", actually.getName());
58+
final File not = actually.getParentFile();
59+
assertEquals("not", not.getName());
5160
}
5261

5362
}

0 commit comments

Comments
 (0)