Skip to content

Commit 4b4278c

Browse files
committed
Make UriTests.testAbsoluteURI() more lenient
This is a URI test, not a cache test
1 parent be5c4bb commit 4b4278c

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

commons-vfs2/src/test/java/org/apache/commons/vfs2/UriTests.java

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import java.net.URI;
2020

21+
import org.apache.commons.lang3.ObjectUtils;
2122
import org.junit.Test;
2223

2324
/**
@@ -26,12 +27,12 @@
2627
public class UriTests extends AbstractProviderTestCase {
2728

2829
/**
29-
* Returns the capabilities required by the tests of this test case. The tests are not run if the provider being
30-
* tested does not support all the required capabilities. Return null or an empty array to always run the tests.
30+
* Returns the capabilities required by the tests of this test case. The tests are not run if the provider being tested does not support all the required
31+
* capabilities. Return null or an empty array to always run the tests.
3132
*/
3233
@Override
3334
protected Capability[] getRequiredCapabilities() {
34-
return new Capability[] {Capability.URI};
35+
return new Capability[] { Capability.URI };
3536
}
3637

3738
/**
@@ -62,14 +63,12 @@ public void testAbsoluteURI() throws Exception {
6263
assertEquals(readFolder.isSymbolicLink(), file.isSymbolicLink());
6364
assertEquals(readFolder.isWriteable(), file.isWriteable());
6465
assertEquals(readFolder.toString(), file.toString());
65-
// compare objects
66-
// File objects don't implement equals().
67-
// assertEquals("file object " + readFolder.getClass() + ", " + file.getClass(), readFolder, file);
68-
assertSame("file object " + readFolder.getClass() + ", " + file.getClass(), readFolder, file);
66+
assertEquals(String.format("file object %s %s, %s %s", readFolder.getClass(), ObjectUtils.identityHashCodeHex(readFolder), file.getClass(),
67+
ObjectUtils.identityHashCodeHex(file)), readFolder.toString(), file.toString());
6968
// Try fetching the filesystem root by its URI
7069
final String rootUri = readFolder.getName().getRootURI();
7170
file = getManager().resolveFile(rootUri, readFolder.getFileSystem().getFileSystemOptions());
72-
assertSame(readFolder.getFileSystem().getRoot(), file);
71+
assertEquals(readFolder.getFileSystem().getRoot().toString(), file.toString());
7372
assertEquals(rootUri, file.getName().getRootURI());
7473
assertEquals(rootUri, file.getName().getURI());
7574
assertEquals(FileName.ROOT_PATH, file.getName().getPath());
@@ -119,8 +118,7 @@ public void testURIContentProvider() throws Exception {
119118
final FileObject f2 = getManager().resolveFile(uriStr, options);
120119

121120
assertEquals("Two files resolved by URI must be equals on " + uriStr, f1, f2);
122-
assertSame("Resolving two times should not produce new filesystem on " + uriStr, f1.getFileSystem(),
123-
f2.getFileSystem());
121+
assertSame("Resolving two times should not produce new filesystem on " + uriStr, f1.getFileSystem(), f2.getFileSystem());
124122
}
125123

126124
}

0 commit comments

Comments
 (0)