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

commit 059b281365062a83c7bfdad4a8e9423926064262
Author: Gary Gregory <[email protected]>
AuthorDate: Wed Oct 11 16:05:00 2023 -0400

    Sort members
---
 .../commons/vfs2/AbstractProviderTestCase.java     |  22 ++--
 .../apache/commons/vfs2/FileSystemOptionsTest.java |  62 +++++-----
 .../commons/vfs2/impl/DefaultFileMonitorTest.java  | 132 ++++++++++-----------
 .../vfs2/impl/DefaultFileSystemManagerTest.java    |  30 ++---
 .../commons/vfs2/impl/VfsClassLoaderTests.java     |  44 +++----
 .../vfs2/operations/BasicOperationsTest.java       |  48 ++++----
 .../ftp/FtpFileSystemConfigBuilderTest.java        |  16 +--
 .../ftp/FtpMdtmOnRefreshLastModifiedTests.java     |  28 ++---
 .../vfs2/provider/ftp/FtpProviderTestCase.java     |  20 ++--
 .../ftps/AbstractFtpsProviderTestCase.java         |   8 +-
 .../vfs2/provider/ram/RamProviderTestCase.java     |   4 +-
 .../sftp/AbstractSftpProviderTestCase.java         |  18 +--
 .../vfs2/provider/url/UrlProviderHttpTestCase.java |   8 +-
 .../apache/commons/vfs2/util/NHttpFileServer.java  |  26 ++--
 14 files changed, 233 insertions(+), 233 deletions(-)

diff --git 
a/commons-vfs2/src/test/java/org/apache/commons/vfs2/AbstractProviderTestCase.java
 
b/commons-vfs2/src/test/java/org/apache/commons/vfs2/AbstractProviderTestCase.java
index 0de55f5c..fd1a75f5 100644
--- 
a/commons-vfs2/src/test/java/org/apache/commons/vfs2/AbstractProviderTestCase.java
+++ 
b/commons-vfs2/src/test/java/org/apache/commons/vfs2/AbstractProviderTestCase.java
@@ -44,20 +44,9 @@ public abstract class AbstractProviderTestCase extends 
TestCase {
     public static final String FILE1_CONTENT = "This is a test file.";
     // Expected contents of test files
     public static final String TEST_FILE_CONTENT = "A test file.";
-    private FileObject baseFolder;
-    private FileObject readFolder;
-    private FileObject writeFolder;
-    private DefaultFileSystemManager manager;
-    private ProviderTestConfig providerConfig;
-
-    private Method method;
-
-    private boolean addEmptyDir;
-
     protected static Test notConfigured(final Class<?> testClass) {
         return warning(testClass + " is not configured for tests, skipping");
     }
-
     private static Test warning(final String message) {
         return new TestCase("warning") {
             @Override
@@ -66,6 +55,17 @@ public abstract class AbstractProviderTestCase extends 
TestCase {
             }
         };
     }
+    private FileObject baseFolder;
+    private FileObject readFolder;
+    private FileObject writeFolder;
+
+    private DefaultFileSystemManager manager;
+
+    private ProviderTestConfig providerConfig;
+
+    private Method method;
+
+    private boolean addEmptyDir;
 
     protected void addEmptyDir(final boolean addEmptyDir) {
         this.addEmptyDir = addEmptyDir;
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 363702df..81509f86 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
@@ -57,6 +57,37 @@ public class FileSystemOptionsTest {
         }
     }
 
+    private static void assertSftpOptionsEquals(final File privKey, final File 
pubKey, final byte[] passphrase) {
+        final SftpFileSystemConfigBuilder builder = 
SftpFileSystemConfigBuilder.getInstance();
+
+        final FileSystemOptions expected = new FileSystemOptions();
+        final IdentityInfo info1 = new IdentityInfo(privKey, pubKey, 
passphrase);
+        builder.setIdentityProvider(expected, info1);
+
+        final FileSystemOptions actual = new FileSystemOptions();
+        final IdentityInfo info2 = new IdentityInfo(privKey, pubKey, 
passphrase);
+        builder.setIdentityProvider(actual, info2);
+
+        assertEquals(0, expected.compareTo(actual));
+        assertEquals(expected.hashCode(), actual.hashCode());
+    }
+
+    private static void assertSftpOptionsNotEquals(final File privKey1, final 
File pubKey1, final byte[] passphrase1,
+        File privKey2, File pubKey2, byte[] passphrase2) {
+        final SftpFileSystemConfigBuilder builder = 
SftpFileSystemConfigBuilder.getInstance();
+
+        final FileSystemOptions expected = new FileSystemOptions();
+        final IdentityInfo info1 = new IdentityInfo(privKey1, pubKey1, 
passphrase1);
+        builder.setIdentityProvider(expected, info1);
+
+        final FileSystemOptions actual = new FileSystemOptions();
+        final IdentityInfo info2 = new IdentityInfo(privKey2, pubKey2, 
passphrase2);
+        builder.setIdentityProvider(actual, info2);
+
+        assertNotEquals(0, expected.compareTo(actual));
+        assertNotEquals(expected.hashCode(), actual.hashCode());
+    }
+
     @Test
     public void testClone() {
         final FileSystemOptions fileSystemOptions = new FileSystemOptions();
@@ -130,35 +161,4 @@ public class FileSystemOptionsTest {
             new File(privKey1), new File(pubKey1), new byte[] {1, 2, 4}
         );
     }
-
-    private static void assertSftpOptionsEquals(final File privKey, final File 
pubKey, final byte[] passphrase) {
-        final SftpFileSystemConfigBuilder builder = 
SftpFileSystemConfigBuilder.getInstance();
-
-        final FileSystemOptions expected = new FileSystemOptions();
-        final IdentityInfo info1 = new IdentityInfo(privKey, pubKey, 
passphrase);
-        builder.setIdentityProvider(expected, info1);
-
-        final FileSystemOptions actual = new FileSystemOptions();
-        final IdentityInfo info2 = new IdentityInfo(privKey, pubKey, 
passphrase);
-        builder.setIdentityProvider(actual, info2);
-
-        assertEquals(0, expected.compareTo(actual));
-        assertEquals(expected.hashCode(), actual.hashCode());
-    }
-
-    private static void assertSftpOptionsNotEquals(final File privKey1, final 
File pubKey1, final byte[] passphrase1,
-        File privKey2, File pubKey2, byte[] passphrase2) {
-        final SftpFileSystemConfigBuilder builder = 
SftpFileSystemConfigBuilder.getInstance();
-
-        final FileSystemOptions expected = new FileSystemOptions();
-        final IdentityInfo info1 = new IdentityInfo(privKey1, pubKey1, 
passphrase1);
-        builder.setIdentityProvider(expected, info1);
-
-        final FileSystemOptions actual = new FileSystemOptions();
-        final IdentityInfo info2 = new IdentityInfo(privKey2, pubKey2, 
passphrase2);
-        builder.setIdentityProvider(actual, info2);
-
-        assertNotEquals(0, expected.compareTo(actual));
-        assertNotEquals(expected.hashCode(), actual.hashCode());
-    }
 }
diff --git 
a/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/DefaultFileMonitorTest.java
 
b/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/DefaultFileMonitorTest.java
index eda372e4..e82a0fce 100644
--- 
a/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/DefaultFileMonitorTest.java
+++ 
b/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/DefaultFileMonitorTest.java
@@ -120,72 +120,6 @@ public class DefaultFileMonitorTest {
         throw new IllegalStateException();
     }
 
-    /**
-     * VFS-299: Handlers are not removed. One instance is {@link 
DefaultFileMonitor#removeFile(FileObject)}.
-     *
-     * As a result, the file monitor will fire two created events.
-     */
-    @Disabled("VFS-299")
-    @Test
-    public void testIgnoreTestAddRemove() throws Exception {
-        try (FileObject fileObject = 
fileSystemManager.resolveFile(testFile.toURI().toString())) {
-            final CountingListener listener = new CountingListener();
-            try (DefaultFileMonitor monitor = new 
DefaultFileMonitor(listener)) {
-                monitor.setDelay(DELAY_MILLIS);
-                monitor.addFile(fileObject);
-                monitor.removeFile(fileObject);
-                monitor.addFile(fileObject);
-                monitor.start();
-                writeToFile(testFile);
-                Thread.sleep(DELAY_MILLIS * 3);
-                assertEquals(1, listener.created.get(), "Created event is only 
fired once");
-            }
-        }
-    }
-
-    /**
-     * VFS-299: Handlers are not removed. There is no API for properly 
decommissioning a file monitor.
-     *
-     * As a result, listeners of stopped monitors still receive events.
-     */
-    @Disabled("VFS-299")
-    @Test
-    public void testIgnoreTestStartStop() throws Exception {
-        try (FileObject fileObject = 
fileSystemManager.resolveFile(testFile.toURI().toString())) {
-            final CountingListener stoppedListener = new CountingListener();
-            try (DefaultFileMonitor stoppedMonitor = new 
DefaultFileMonitor(stoppedListener)) {
-                stoppedMonitor.start();
-                stoppedMonitor.addFile(fileObject);
-            }
-
-            // Variant 1: it becomes documented behavior to manually remove 
all files after stop() such that all
-            // listeners
-            // are removed
-            // This currently does not work, see 
DefaultFileMonitorTests#testAddRemove above.
-            // stoppedMonitor.removeFile(file);
-
-            // Variant 2: change behavior of stop(), which then removes all 
handlers.
-            // This would remove the possibility to pause watching files. 
Resuming watching for the same files via
-            // start();
-            // stop(); start(); would not work.
-
-            // Variant 3: introduce new method DefaultFileMonitor#close which 
definitely removes all resources held by
-            // DefaultFileMonitor.
-
-            final CountingListener activeListener = new CountingListener();
-            try (DefaultFileMonitor activeMonitor = new 
DefaultFileMonitor(activeListener)) {
-                activeMonitor.setDelay(DELAY_MILLIS);
-                activeMonitor.addFile(fileObject);
-                activeMonitor.start();
-                writeToFile(testFile);
-                Thread.sleep(DELAY_MILLIS * 10);
-
-                assertEquals(1, activeListener.created.get(), "The listener of 
the active monitor received one created event");
-                assertEquals(0, stoppedListener.created.get(), "The listener 
of the stopped monitor received no events");
-            }
-        }
-    }
-
     private void resetStatus() {
         status.clear();
     }
@@ -341,6 +275,72 @@ public class DefaultFileMonitorTest {
         }
     }
 
+    /**
+     * VFS-299: Handlers are not removed. One instance is {@link 
DefaultFileMonitor#removeFile(FileObject)}.
+     *
+     * As a result, the file monitor will fire two created events.
+     */
+    @Disabled("VFS-299")
+    @Test
+    public void testIgnoreTestAddRemove() throws Exception {
+        try (FileObject fileObject = 
fileSystemManager.resolveFile(testFile.toURI().toString())) {
+            final CountingListener listener = new CountingListener();
+            try (DefaultFileMonitor monitor = new 
DefaultFileMonitor(listener)) {
+                monitor.setDelay(DELAY_MILLIS);
+                monitor.addFile(fileObject);
+                monitor.removeFile(fileObject);
+                monitor.addFile(fileObject);
+                monitor.start();
+                writeToFile(testFile);
+                Thread.sleep(DELAY_MILLIS * 3);
+                assertEquals(1, listener.created.get(), "Created event is only 
fired once");
+            }
+        }
+    }
+
+    /**
+     * VFS-299: Handlers are not removed. There is no API for properly 
decommissioning a file monitor.
+     *
+     * As a result, listeners of stopped monitors still receive events.
+     */
+    @Disabled("VFS-299")
+    @Test
+    public void testIgnoreTestStartStop() throws Exception {
+        try (FileObject fileObject = 
fileSystemManager.resolveFile(testFile.toURI().toString())) {
+            final CountingListener stoppedListener = new CountingListener();
+            try (DefaultFileMonitor stoppedMonitor = new 
DefaultFileMonitor(stoppedListener)) {
+                stoppedMonitor.start();
+                stoppedMonitor.addFile(fileObject);
+            }
+
+            // Variant 1: it becomes documented behavior to manually remove 
all files after stop() such that all
+            // listeners
+            // are removed
+            // This currently does not work, see 
DefaultFileMonitorTests#testAddRemove above.
+            // stoppedMonitor.removeFile(file);
+
+            // Variant 2: change behavior of stop(), which then removes all 
handlers.
+            // This would remove the possibility to pause watching files. 
Resuming watching for the same files via
+            // start();
+            // stop(); start(); would not work.
+
+            // Variant 3: introduce new method DefaultFileMonitor#close which 
definitely removes all resources held by
+            // DefaultFileMonitor.
+
+            final CountingListener activeListener = new CountingListener();
+            try (DefaultFileMonitor activeMonitor = new 
DefaultFileMonitor(activeListener)) {
+                activeMonitor.setDelay(DELAY_MILLIS);
+                activeMonitor.addFile(fileObject);
+                activeMonitor.start();
+                writeToFile(testFile);
+                Thread.sleep(DELAY_MILLIS * 10);
+
+                assertEquals(1, activeListener.created.get(), "The listener of 
the active monitor received one created event");
+                assertEquals(0, stoppedListener.created.get(), "The listener 
of the stopped monitor received no events");
+            }
+        }
+    }
+
     private void waitFor(final Status expected, final long timeoutMillis, 
final PeekLocation peekLocation) throws InterruptedException {
         if (expected == getStatus(peekLocation)) {
             return;
diff --git 
a/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/DefaultFileSystemManagerTest.java
 
b/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/DefaultFileSystemManagerTest.java
index 2e55250e..0101d1a5 100644
--- 
a/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/DefaultFileSystemManagerTest.java
+++ 
b/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/DefaultFileSystemManagerTest.java
@@ -53,21 +53,6 @@ import org.mockito.Mockito;
  */
 public class DefaultFileSystemManagerTest {
 
-    /**
-     * Tests {@link DefaultFileSystemManager#close()}.
-     *
-     * @throws FileSystemException
-     */
-    @Test
-    public void testClose() throws FileSystemException {
-        try (FileSystemManager fileSystemManager = new 
DefaultFileSystemManager()) {
-            VFS.setManager(fileSystemManager);
-            VFS.setManager(null);
-        }
-        assertNotNull(VFS.getManager());
-        
assertFalse(VFS.getManager().resolveFile(Paths.get("DoesNotExist.not").toUri()).exists());
-    }
-
     @Test
     public void testAddAndRemoveProvider() throws FileSystemException {
         try (DefaultFileSystemManager fileSystemManager = new 
DefaultFileSystemManager()) {
@@ -91,6 +76,21 @@ public class DefaultFileSystemManagerTest {
         }
     }
 
+    /**
+     * Tests {@link DefaultFileSystemManager#close()}.
+     *
+     * @throws FileSystemException
+     */
+    @Test
+    public void testClose() throws FileSystemException {
+        try (FileSystemManager fileSystemManager = new 
DefaultFileSystemManager()) {
+            VFS.setManager(fileSystemManager);
+            VFS.setManager(null);
+        }
+        assertNotNull(VFS.getManager());
+        
assertFalse(VFS.getManager().resolveFile(Paths.get("DoesNotExist.not").toUri()).exists());
+    }
+
     @Test
     public void testCreateBz2FileSystem() throws FileSystemException {
         testCreateFileSystem("src/test/resources/test-data/bla.txt.bz2", 
Bzip2FileObject.class);
diff --git 
a/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/VfsClassLoaderTests.java
 
b/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/VfsClassLoaderTests.java
index 57d413ca..9c00cda4 100644
--- 
a/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/VfsClassLoaderTests.java
+++ 
b/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/VfsClassLoaderTests.java
@@ -49,6 +49,28 @@ import org.junit.Test;
  */
 public class VfsClassLoaderTests extends AbstractProviderTestCase {
 
+    private class LoadClass implements Runnable {
+        private final VFSClassLoader loader;
+        public LoadClass(VFSClassLoader loader) {
+            this.loader = loader;
+        }
+
+        @Override
+        public void run() {
+            try {
+                final Class<?> testClass = 
loader.findClass("code.ClassToLoad");
+                final Package pack = testClass.getPackage();
+                assertEquals("code", pack.getName());
+                verifyPackage(pack, false);
+
+                final Object testObject = 
testClass.getConstructor().newInstance();
+                assertEquals("**PRIVATE**", testObject.toString());
+            } catch (ReflectiveOperationException e) {
+                throw new IllegalStateException(e);
+            }
+        }
+    }
+
     /**
      * Non-Delegating Class Loader.
      */
@@ -280,28 +302,6 @@ public class VfsClassLoaderTests extends 
AbstractProviderTestCase {
         }
     }
 
-    private class LoadClass implements Runnable {
-        private final VFSClassLoader loader;
-        public LoadClass(VFSClassLoader loader) {
-            this.loader = loader;
-        }
-
-        @Override
-        public void run() {
-            try {
-                final Class<?> testClass = 
loader.findClass("code.ClassToLoad");
-                final Package pack = testClass.getPackage();
-                assertEquals("code", pack.getName());
-                verifyPackage(pack, false);
-
-                final Object testObject = 
testClass.getConstructor().newInstance();
-                assertEquals("**PRIVATE**", testObject.toString());
-            } catch (ReflectiveOperationException e) {
-                throw new IllegalStateException(e);
-            }
-        }
-    }
-
     /**
      * Verify the package loaded with class loader.
      */
diff --git 
a/commons-vfs2/src/test/java/org/apache/commons/vfs2/operations/BasicOperationsTest.java
 
b/commons-vfs2/src/test/java/org/apache/commons/vfs2/operations/BasicOperationsTest.java
index 96034289..764a9d60 100644
--- 
a/commons-vfs2/src/test/java/org/apache/commons/vfs2/operations/BasicOperationsTest.java
+++ 
b/commons-vfs2/src/test/java/org/apache/commons/vfs2/operations/BasicOperationsTest.java
@@ -42,6 +42,30 @@ import org.junit.jupiter.api.Test;
  */
 public class BasicOperationsTest {
 
+    /**
+     * Base class for different Test Providers. This is also a compile test to 
ensure interface stability.
+     */
+    static class MyFileOperationProviderBase implements FileOperationProvider {
+        int ops; // bit array to record invocations (poor man's mock)
+
+        @Override
+        public void collectOperations(final Collection<Class<? extends 
FileOperation>> operationsList,
+                final FileObject file) throws FileSystemException {
+            assertNotNull(operationsList, "collect operationsList");
+            assertNotNull(file, "collect file");
+            ops |= 16;
+        }
+
+        @Override
+        public FileOperation getOperation(final FileObject file, final Class<? 
extends FileOperation> operationClass)
+                throws FileSystemException {
+            assertNotNull(file, "file object");
+            assertNotNull(operationClass, "operationClass");
+            ops |= 32;
+            return null;
+        }
+    }
+
     /** This FileOperationsProvider is a VfsComponent and records invocations. 
*/
     static class MyFileOperationProviderComp extends 
MyFileOperationProviderBase implements VfsComponent {
         @Override
@@ -72,30 +96,6 @@ public class BasicOperationsTest {
         // empty
     }
 
-    /**
-     * Base class for different Test Providers. This is also a compile test to 
ensure interface stability.
-     */
-    static class MyFileOperationProviderBase implements FileOperationProvider {
-        int ops; // bit array to record invocations (poor man's mock)
-
-        @Override
-        public void collectOperations(final Collection<Class<? extends 
FileOperation>> operationsList,
-                final FileObject file) throws FileSystemException {
-            assertNotNull(operationsList, "collect operationsList");
-            assertNotNull(file, "collect file");
-            ops |= 16;
-        }
-
-        @Override
-        public FileOperation getOperation(final FileObject file, final Class<? 
extends FileOperation> operationClass)
-                throws FileSystemException {
-            assertNotNull(file, "file object");
-            assertNotNull(operationClass, "operationClass");
-            ops |= 32;
-            return null;
-        }
-    }
-
     /** FSM to work with, maintained by JUnit Fixture. */
     private DefaultFileSystemManager manager;
 
diff --git 
a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftp/FtpFileSystemConfigBuilderTest.java
 
b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftp/FtpFileSystemConfigBuilderTest.java
index b87c63f1..54ffd519 100644
--- 
a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftp/FtpFileSystemConfigBuilderTest.java
+++ 
b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftp/FtpFileSystemConfigBuilderTest.java
@@ -29,6 +29,14 @@ import org.junit.jupiter.api.Test;
  */
 public class FtpFileSystemConfigBuilderTest {
 
+    @Test
+    public void testActivePortRange() {
+        final FtpFileSystemConfigBuilder instance = 
FtpFileSystemConfigBuilder.getInstance();
+        final FileSystemOptions options = new FileSystemOptions();
+        instance.setActivePortRange(options, Range.between(2121, 2125));
+        assertEquals(Range.between(2121, 2125), 
instance.getActivePortRange(options));
+    }
+
     @Test
     public void testControlKeepAliveReplyTimeout() {
         final FtpFileSystemConfigBuilder instance = 
FtpFileSystemConfigBuilder.getInstance();
@@ -44,12 +52,4 @@ public class FtpFileSystemConfigBuilderTest {
         instance.setControlKeepAliveTimeout(options, Duration.ofSeconds(10));
         assertEquals(Duration.ofSeconds(10), 
instance.getControlKeepAliveTimeout(options));
     }
-
-    @Test
-    public void testActivePortRange() {
-        final FtpFileSystemConfigBuilder instance = 
FtpFileSystemConfigBuilder.getInstance();
-        final FileSystemOptions options = new FileSystemOptions();
-        instance.setActivePortRange(options, Range.between(2121, 2125));
-        assertEquals(Range.between(2121, 2125), 
instance.getActivePortRange(options));
-    }
 }
diff --git 
a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftp/FtpMdtmOnRefreshLastModifiedTests.java
 
b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftp/FtpMdtmOnRefreshLastModifiedTests.java
index 48543449..e2820c49 100644
--- 
a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftp/FtpMdtmOnRefreshLastModifiedTests.java
+++ 
b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftp/FtpMdtmOnRefreshLastModifiedTests.java
@@ -32,20 +32,6 @@ import org.junit.jupiter.api.Assertions;
 
 public class FtpMdtmOnRefreshLastModifiedTests extends LastModifiedTests {
 
-    /**
-     * Tests {@link FileContent#getLastModifiedTime()} re-calls {@link 
FtpClient#mdtmInstant(String)} after refresh.
-     */
-    @Test
-    public void testGetLastModifiedFileExactMatchRefresh() throws IOException {
-        final String fileName = "file1.txt";
-        final FileObject readFolder = getReadFolder();
-        final FtpFileObject fileObject = (FtpFileObject) 
readFolder.resolveFile(fileName);
-
-        returnsCorrectMdtmValue(fileObject);
-        fileObject.refresh();
-        returnsCorrectMdtmValue(fileObject);
-    }
-
     private void returnsCorrectMdtmValue(final FtpFileObject fileObject) 
throws IOException {
         final String relPath = fileObject.getRelPath();
         final FtpClient ftpClient = spyClient(fileObject);
@@ -68,4 +54,18 @@ public class FtpMdtmOnRefreshLastModifiedTests extends 
LastModifiedTests {
         return ftpClientSpy;
     }
 
+    /**
+     * Tests {@link FileContent#getLastModifiedTime()} re-calls {@link 
FtpClient#mdtmInstant(String)} after refresh.
+     */
+    @Test
+    public void testGetLastModifiedFileExactMatchRefresh() throws IOException {
+        final String fileName = "file1.txt";
+        final FileObject readFolder = getReadFolder();
+        final FtpFileObject fileObject = (FtpFileObject) 
readFolder.resolveFile(fileName);
+
+        returnsCorrectMdtmValue(fileObject);
+        fileObject.refresh();
+        returnsCorrectMdtmValue(fileObject);
+    }
+
 }
diff --git 
a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftp/FtpProviderTestCase.java
 
b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftp/FtpProviderTestCase.java
index 09f1a9f7..88df01ce 100644
--- 
a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftp/FtpProviderTestCase.java
+++ 
b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftp/FtpProviderTestCase.java
@@ -60,16 +60,6 @@ public class FtpProviderTestCase extends 
AbstractProviderTestConfig {
 
     private static final String USER_PROPS_RES = 
"org.apache.ftpserver/users.properties";
 
-    private final boolean mdtmLastModifiedTime;
-
-    public FtpProviderTestCase() {
-        this(false);
-    }
-
-    public FtpProviderTestCase(final boolean mdtmLastModifiedTime) {
-        this.mdtmLastModifiedTime = mdtmLastModifiedTime;
-    }
-
     static String getConnectionUri() {
         return connectionUri;
     }
@@ -185,6 +175,16 @@ public class FtpProviderTestCase extends 
AbstractProviderTestConfig {
         }
     }
 
+    private final boolean mdtmLastModifiedTime;
+
+    public FtpProviderTestCase() {
+        this(false);
+    }
+
+    public FtpProviderTestCase(final boolean mdtmLastModifiedTime) {
+        this.mdtmLastModifiedTime = mdtmLastModifiedTime;
+    }
+
     /**
      * Returns the base folder for tests. You can override the DEFAULT_URI by 
using the system property name defined by
      * TEST_URI.
diff --git 
a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftps/AbstractFtpsProviderTestCase.java
 
b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftps/AbstractFtpsProviderTestCase.java
index ad8e8de5..3657946d 100644
--- 
a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftps/AbstractFtpsProviderTestCase.java
+++ 
b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftps/AbstractFtpsProviderTestCase.java
@@ -45,8 +45,6 @@ import org.junit.jupiter.api.Assertions;
  */
 abstract class AbstractFtpsProviderTestCase extends AbstractProviderTestConfig 
{
 
-    private static final String LISTENER_NAME = "default";
-
     static final class FtpProviderTestSuite extends ProviderTestSuite {
         
         private final boolean implicit;
@@ -78,6 +76,8 @@ abstract class AbstractFtpsProviderTestCase extends 
AbstractProviderTestConfig {
         }
     }
 
+    private static final String LISTENER_NAME = "default";
+
     private static int socketPort;
 
     /**
@@ -93,8 +93,6 @@ abstract class AbstractFtpsProviderTestCase extends 
AbstractProviderTestConfig {
 
     private static final String SERVER_JKS_RES = 
"org.apache.ftpsserver/ftpserver.jks";
 
-    protected FileSystemOptions fileSystemOptions;
-
     static String getConnectionUri() {
         return connectionUri;
     }
@@ -190,6 +188,8 @@ abstract class AbstractFtpsProviderTestCase extends 
AbstractProviderTestConfig {
         }
     }
 
+    protected FileSystemOptions fileSystemOptions;
+
     /**
      * Returns the base folder for tests. You can override the DEFAULT_URI by 
using the system property name defined by TEST_URI.
      */
diff --git 
a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ram/RamProviderTestCase.java
 
b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ram/RamProviderTestCase.java
index 843a7252..7a014e50 100644
--- 
a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ram/RamProviderTestCase.java
+++ 
b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ram/RamProviderTestCase.java
@@ -37,8 +37,6 @@ public class RamProviderTestCase extends 
AbstractProviderTestConfig {
     /** logger */
     private static final Log log = 
LogFactory.getLog(RamProviderTestCase.class);
 
-    private boolean inited;
-
     /**
      * Creates the test suite for the ram file system.
      */
@@ -46,6 +44,8 @@ public class RamProviderTestCase extends 
AbstractProviderTestConfig {
         return new ProviderTestSuite(new RamProviderTestCase());
     }
 
+    private boolean inited;
+
     /**
      * Returns the base folder for tests.
      */
diff --git 
a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/AbstractSftpProviderTestCase.java
 
b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/AbstractSftpProviderTestCase.java
index c05d4ed2..938c0427 100644
--- 
a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/AbstractSftpProviderTestCase.java
+++ 
b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/AbstractSftpProviderTestCase.java
@@ -431,11 +431,6 @@ abstract class AbstractSftpProviderTestCase extends 
AbstractProviderTestConfig {
 
     private static final String TEST_URI = "test.sftp.uri";
 
-    /**
-     * The underlying file system
-     */
-    protected SftpFileSystem fileSystem;
-
     /**
      * Creates a pipe thread that connects an input to an output
      *
@@ -571,6 +566,11 @@ abstract class AbstractSftpProviderTestCase extends 
AbstractProviderTestConfig {
         }
     }
 
+    /**
+     * The underlying file system
+     */
+    protected SftpFileSystem fileSystem;
+
     /**
      * Returns the base folder for tests.
      */
@@ -596,10 +596,6 @@ abstract class AbstractSftpProviderTestCase extends 
AbstractProviderTestConfig {
 
     protected abstract boolean isExecChannelClosed();
 
-    protected SessionFactory sessionFactory() {
-        return null;
-    }
-
     /**
      * Prepares the file system manager.
      */
@@ -608,4 +604,8 @@ abstract class AbstractSftpProviderTestCase extends 
AbstractProviderTestConfig {
         manager.addProvider("sftp", new SftpFileProvider());
     }
 
+    protected SessionFactory sessionFactory() {
+        return null;
+    }
+
 }
diff --git 
a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/url/UrlProviderHttpTestCase.java
 
b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/url/UrlProviderHttpTestCase.java
index 52ec639d..fefb13ff 100644
--- 
a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/url/UrlProviderHttpTestCase.java
+++ 
b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/url/UrlProviderHttpTestCase.java
@@ -47,10 +47,6 @@ public class UrlProviderHttpTestCase extends 
AbstractProviderTestConfig {
      */
     private static String connectionUri;
 
-    public UrlProviderHttpTestCase() throws IOException {
-        // empty
-    }
-
     private static String getSystemTestUriOverride() {
         return System.getProperty(TEST_URI);
     }
@@ -94,6 +90,10 @@ public class UrlProviderHttpTestCase extends 
AbstractProviderTestConfig {
         }
     }
 
+    public UrlProviderHttpTestCase() throws IOException {
+        // empty
+    }
+
     /**
      * Returns the base folder for tests.
      */
diff --git 
a/commons-vfs2/src/test/java/org/apache/commons/vfs2/util/NHttpFileServer.java 
b/commons-vfs2/src/test/java/org/apache/commons/vfs2/util/NHttpFileServer.java
index a2d37579..9e84229a 100644
--- 
a/commons-vfs2/src/test/java/org/apache/commons/vfs2/util/NHttpFileServer.java
+++ 
b/commons-vfs2/src/test/java/org/apache/commons/vfs2/util/NHttpFileServer.java
@@ -167,19 +167,6 @@ public class NHttpFileServer {
 
     public static final boolean DEBUG = 
Boolean.getBoolean(NHttpFileServer.class.getSimpleName() + ".debug");
 
-    private final File docRoot;
-
-    private ListenerEndpoint listenerEndpoint;
-
-    private final int port;
-
-    private HttpAsyncServer server;
-
-    private NHttpFileServer(final int port, final File docRoot) {
-        this.port = port;
-        this.docRoot = docRoot;
-    }
-
     public static void main(final String[] args) throws Exception {
         if (args.length < 1) {
             System.err.println("Please specify document root directory");
@@ -205,6 +192,19 @@ public class NHttpFileServer {
         return new NHttpFileServer(port, docRoot).start();
     }
 
+    private final File docRoot;
+
+    private ListenerEndpoint listenerEndpoint;
+
+    private final int port;
+
+    private HttpAsyncServer server;
+
+    private NHttpFileServer(final int port, final File docRoot) {
+        this.port = port;
+        this.docRoot = docRoot;
+    }
+
     private void awaitTermination() throws InterruptedException {
         server.awaitShutdown(TimeValue.MAX_VALUE);
     }

Reply via email to