Fixing test short file name failures Some of the tests were mixing the usage of short files names and long file names. This was caused by using ".toPath().toString()". I changed the tests to use ".toPath().toRealPath().toString()".
diff --git a/test/com/google/enterprise/adaptor/fs/NioFileDelegateTest.java b/test/com/google/enterprise/adaptor/fs/NioFileDelegateTest.java index ae5eaa7..4db3dce 100644 --- a/test/com/google/enterprise/adaptor/fs/NioFileDelegateTest.java +++ b/test/com/google/enterprise/adaptor/fs/NioFileDelegateTest.java
@@ -45,15 +45,16 @@ public TemporaryFolder temp = new TemporaryFolder(); private Path newTempDir(String name) throws IOException { - return temp.newFolder(name).toPath(); + return temp.newFolder(name).toPath().toRealPath(); } private Path newTempFile(String name) throws IOException { - return temp.newFile(name).toPath(); + return temp.newFile(name).toPath().toRealPath(); } private Path newTempFile(Path parent, String name) throws IOException { - Preconditions.checkArgument(parent.startsWith(temp.getRoot().toPath())); + Preconditions.checkArgument(parent.startsWith(temp.getRoot().toPath() + .toRealPath())); return Files.createFile(parent.resolve(name)); } @@ -162,7 +163,7 @@ @Test public void testNewDocId() throws Exception { - Path root = temp.getRoot().toPath(); + Path root = temp.getRoot().toPath().toRealPath(); Path dir = newTempDir("testDir"); Path file = newTempFile(dir, "test");
diff --git a/test/com/google/enterprise/adaptor/fs/WindowsFileDelegateTest.java b/test/com/google/enterprise/adaptor/fs/WindowsFileDelegateTest.java index f345598..0a536eb 100644 --- a/test/com/google/enterprise/adaptor/fs/WindowsFileDelegateTest.java +++ b/test/com/google/enterprise/adaptor/fs/WindowsFileDelegateTest.java
@@ -72,11 +72,11 @@ } private Path newTempDir(String name) throws IOException { - return temp.newFolder(name).toPath(); + return temp.newFolder(name).toPath().toRealPath(); } private Path newTempFile(String name) throws IOException { - return temp.newFile(name).toPath(); + return temp.newFile(name).toPath().toRealPath(); } private Path newTempFile(Path parent, String name) throws IOException {