You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2021/11/29 18:43:49 UTC

[commons-vfs] branch master updated: More clone testing.

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 53aa383  More clone testing.
53aa383 is described below

commit 53aa383a5f413a65f5b8ea875c417202201acc8a
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Nov 29 13:43:46 2021 -0500

    More clone testing.
---
 .../src/main/java/org/apache/commons/vfs2/FileSystemOptions.java    | 6 +++++-
 .../test/java/org/apache/commons/vfs2/FileSystemOptionsTest.java    | 2 ++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemOptions.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemOptions.java
index 1daf299..6727e35 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemOptions.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemOptions.java
@@ -218,7 +218,11 @@ public final class FileSystemOptions implements Cloneable, Comparable<FileSystem
         options.put(new FileSystemOptionKey(fileSystemClass, name), value);
     }
 
-    @Override
+    int size() {
+        return options.size();
+    }
+
+     @Override
     public String toString() {
         return options.toString();
     }
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileSystemOptionsTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileSystemOptionsTest.java
index 43bf82d..afe8cc4 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileSystemOptionsTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileSystemOptionsTest.java
@@ -56,7 +56,9 @@ public class FileSystemOptionsTest {
     public void testClone() throws CloneNotSupportedException {
         final FileSystemOptions fileSystemOptions = new FileSystemOptions();
         assertEquals(fileSystemOptions.getClass(), fileSystemOptions.clone().getClass());
+        assertEquals(0, ((FileSystemOptions) fileSystemOptions.clone()).size());
         fileSystemOptions.setOption(FileSystem.class, "key", "value");
+        assertEquals(1, ((FileSystemOptions) fileSystemOptions.clone()).size());
         final FileSystemOptions clone = (FileSystemOptions) fileSystemOptions.clone();
         assertEquals("value", clone.getOption(FileSystem.class, "key"));
     }