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 2026/04/05 13:00:38 UTC
(commons-vfs) 01/03: Use static imports but only for JUnit instead of FQCN in code.
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 f10239d74056c7bbccec0c3e3a6def71fd440593
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Apr 5 08:47:16 2026 -0400
Use static imports but only for JUnit instead of FQCN in code.
---
.../java/org/apache/commons/vfs2/AbstractProviderTestSuite.java | 4 ++--
.../commons/vfs2/provider/sftp/SftpPermissionExceptionTest.java | 7 ++-----
.../org/apache/commons/vfs2/provider/sftp/SftpPutChannelTest.java | 5 ++---
3 files changed, 6 insertions(+), 10 deletions(-)
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/AbstractProviderTestSuite.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/AbstractProviderTestSuite.java
index f92002442..f62c7dbdc 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/AbstractProviderTestSuite.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/AbstractProviderTestSuite.java
@@ -20,6 +20,7 @@ import static org.apache.commons.vfs2.VfsTestUtils.getTestDirectory;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
+import static org.junit.jupiter.api.Assumptions.assumeTrue;
import java.io.File;
import java.lang.reflect.Method;
@@ -267,8 +268,7 @@ public abstract class AbstractProviderTestSuite {
for (final Capability cap : caps) {
if (!fs.hasCapability(cap)) {
// Skip test if capability is not supported
- org.junit.jupiter.api.Assumptions.assumeTrue(false,
- "Skipping test because file system does not have capability: " + cap);
+ assumeTrue(false, "Skipping test because file system does not have capability: " + cap);
}
}
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/SftpPermissionExceptionTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/SftpPermissionExceptionTest.java
index 27fcb9581..5f2961ad7 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/SftpPermissionExceptionTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/SftpPermissionExceptionTest.java
@@ -17,6 +17,7 @@
package org.apache.commons.vfs2.provider.sftp;
import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assumptions.assumeTrue;
import org.apache.commons.vfs2.AbstractProviderTestConfig;
import org.apache.commons.vfs2.FileObject;
@@ -63,21 +64,17 @@ public class SftpPermissionExceptionTest extends ProviderTestSuiteJunit5 {
*/
@Test
public void testGetOutputStreamException() throws Exception {
- org.junit.jupiter.api.Assumptions.assumeTrue(System.getProperty("test.sftp.uri") != null,
- "Test requires SFTP server configured via system property");
+ assumeTrue(System.getProperty("test.sftp.uri") != null, "Test requires SFTP server configured via system property");
final FileObject scratchFolder = getWriteFolder();
-
// Create a read-only file
final FileObject readOnlyFile = scratchFolder.resolveFile("read-only-file.txt");
readOnlyFile.createFile();
readOnlyFile.setWritable(false, false);
-
// Try to copy to the read-only file - should throw exception
final FileObject sourceFile = scratchFolder.resolveFile("file1.txt");
assertThrows(FileSystemException.class, () -> {
readOnlyFile.copyFrom(sourceFile, null);
});
-
// Clean up
readOnlyFile.setWritable(true, false);
readOnlyFile.delete();
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/SftpPutChannelTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/SftpPutChannelTest.java
index b4d531e64..6d625be20 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/SftpPutChannelTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/SftpPutChannelTest.java
@@ -17,6 +17,7 @@
package org.apache.commons.vfs2.provider.sftp;
import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assumptions.assumeTrue;
import java.io.InputStream;
@@ -69,15 +70,13 @@ public class SftpPutChannelTest extends ProviderTestSuiteJunit5 {
*/
@Test
public void testDoGetInputStream() throws Exception {
- org.junit.jupiter.api.Assumptions.assumeTrue(System.getProperty("test.sftp.uri") != null,
- "Test requires SFTP server configured via system property");
+ assumeTrue(System.getProperty("test.sftp.uri") != null, "Test requires SFTP server configured via system property");
final FileObject file = getReadFolder().resolveFile("file-does-not-exist.txt");
assertThrows(FileSystemException.class, () -> {
try (InputStream ignored = file.getContent().getInputStream()) {
// Should throw exception before reaching here
}
});
-
// Original test also verified channel count:
// final int channelCount = AbstractSftpProviderTestCase.getChannelCount();
// assertEquals(0, channelCount, "Expected 0 channels after exception");