This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-vfs.git


The following commit(s) were added to refs/heads/master by this push:
     new 4b4278c1 Make UriTests.testAbsoluteURI() more lenient
4b4278c1 is described below

commit 4b4278c1f9404120cd22a8edbb5b55ce70948025
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Wed Nov 27 17:29:16 2024 -0500

    Make UriTests.testAbsoluteURI() more lenient
    
    This is a URI test, not a cache test
---
 .../test/java/org/apache/commons/vfs2/UriTests.java    | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/UriTests.java 
b/commons-vfs2/src/test/java/org/apache/commons/vfs2/UriTests.java
index a63cfc76..dcc60079 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/UriTests.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/UriTests.java
@@ -18,6 +18,7 @@ package org.apache.commons.vfs2;
 
 import java.net.URI;
 
+import org.apache.commons.lang3.ObjectUtils;
 import org.junit.Test;
 
 /**
@@ -26,12 +27,12 @@ import org.junit.Test;
 public class UriTests extends AbstractProviderTestCase {
 
     /**
-     * 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 capabilities. Return null or 
an empty array to always run the tests.
+     * 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
+     * capabilities. Return null or an empty array to always run the tests.
      */
     @Override
     protected Capability[] getRequiredCapabilities() {
-        return new Capability[] {Capability.URI};
+        return new Capability[] { Capability.URI };
     }
 
     /**
@@ -62,14 +63,12 @@ public class UriTests extends AbstractProviderTestCase {
         assertEquals(readFolder.isSymbolicLink(), file.isSymbolicLink());
         assertEquals(readFolder.isWriteable(), file.isWriteable());
         assertEquals(readFolder.toString(), file.toString());
-        // compare objects
-        // File objects don't implement equals().
-        // assertEquals("file object " + readFolder.getClass() + ", " + 
file.getClass(), readFolder, file);
-        assertSame("file object " + readFolder.getClass() + ", " + 
file.getClass(), readFolder, file);
+        assertEquals(String.format("file object %s %s, %s %s", 
readFolder.getClass(), ObjectUtils.identityHashCodeHex(readFolder), 
file.getClass(),
+                ObjectUtils.identityHashCodeHex(file)), readFolder.toString(), 
file.toString());
         // Try fetching the filesystem root by its URI
         final String rootUri = readFolder.getName().getRootURI();
         file = getManager().resolveFile(rootUri, 
readFolder.getFileSystem().getFileSystemOptions());
-        assertSame(readFolder.getFileSystem().getRoot(), file);
+        assertEquals(readFolder.getFileSystem().getRoot().toString(), 
file.toString());
         assertEquals(rootUri, file.getName().getRootURI());
         assertEquals(rootUri, file.getName().getURI());
         assertEquals(FileName.ROOT_PATH, file.getName().getPath());
@@ -119,8 +118,7 @@ public class UriTests extends AbstractProviderTestCase {
         final FileObject f2 = getManager().resolveFile(uriStr, options);
 
         assertEquals("Two files resolved by URI must be equals on " + uriStr, 
f1, f2);
-        assertSame("Resolving two times should not produce new filesystem on " 
+ uriStr, f1.getFileSystem(),
-            f2.getFileSystem());
+        assertSame("Resolving two times should not produce new filesystem on " 
+ uriStr, f1.getFileSystem(), f2.getFileSystem());
     }
 
 }

Reply via email to