|
18 | 18 |
|
19 | 19 | import java.net.URI; |
20 | 20 |
|
| 21 | +import org.apache.commons.lang3.ObjectUtils; |
21 | 22 | import org.junit.Test; |
22 | 23 |
|
23 | 24 | /** |
|
26 | 27 | public class UriTests extends AbstractProviderTestCase { |
27 | 28 |
|
28 | 29 | /** |
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. |
31 | 32 | */ |
32 | 33 | @Override |
33 | 34 | protected Capability[] getRequiredCapabilities() { |
34 | | - return new Capability[] {Capability.URI}; |
| 35 | + return new Capability[] { Capability.URI }; |
35 | 36 | } |
36 | 37 |
|
37 | 38 | /** |
@@ -62,14 +63,12 @@ public void testAbsoluteURI() throws Exception { |
62 | 63 | assertEquals(readFolder.isSymbolicLink(), file.isSymbolicLink()); |
63 | 64 | assertEquals(readFolder.isWriteable(), file.isWriteable()); |
64 | 65 | 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()); |
69 | 68 | // Try fetching the filesystem root by its URI |
70 | 69 | final String rootUri = readFolder.getName().getRootURI(); |
71 | 70 | file = getManager().resolveFile(rootUri, readFolder.getFileSystem().getFileSystemOptions()); |
72 | | - assertSame(readFolder.getFileSystem().getRoot(), file); |
| 71 | + assertEquals(readFolder.getFileSystem().getRoot().toString(), file.toString()); |
73 | 72 | assertEquals(rootUri, file.getName().getRootURI()); |
74 | 73 | assertEquals(rootUri, file.getName().getURI()); |
75 | 74 | assertEquals(FileName.ROOT_PATH, file.getName().getPath()); |
@@ -119,8 +118,7 @@ public void testURIContentProvider() throws Exception { |
119 | 118 | final FileObject f2 = getManager().resolveFile(uriStr, options); |
120 | 119 |
|
121 | 120 | 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()); |
124 | 122 | } |
125 | 123 |
|
126 | 124 | } |
0 commit comments