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 2022/03/05 18:23:57 UTC
[commons-vfs] branch master updated: JUnitj v5 more progression (#243)
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 9c49b83 JUnitj v5 more progression (#243)
9c49b83 is described below
commit 9c49b835225b9a275490b13892e4667b3ec2d69a
Author: John Patrick <14...@users.noreply.github.com>
AuthorDate: Sat Mar 5 18:23:02 2022 +0000
JUnitj v5 more progression (#243)
* JUnit v5 format tests
* JUnit v5 AndFileFilterTest
* JUnit v5 AbstractFileNameTest
* JUnit v5 AbstractFtpsProviderTestCase
* JUnit v5 BasicOperationsTest
* JUnit v5 Bzip2TestCase
* JUnit v5 CanExecuteFileFilterTest
* JUnit v5 CreateFileSystemTest
* JUnit v5 ConversionTest
* JUnit v5 DefaultFileSystemManagerTest
* JUnit v5 DefaultFileContentTest
* JUnit v5 DefaultFileMonitorTest
* JUnit v5 EncryptDecryptTest
* JUnit v5 FileChangeEventTest static imports
(cherry picked from commit 19bd187d6b5a099e2c46862f0bd60f0cab983437)
* JUnit v5 FileExtensionSelectorTest static imports
(cherry picked from commit 8bd6e0b5560d1ec19fa74244a8fbcff321727f8f)
* JUnit v5 FileIteratorTest
* JUnit v5 FileLockTest
* JUnit v5 FileObjectSortTest
* JUnit v5 FileObjectUtilsTest
* JUnit v5 FileSystemOptionsTest
* JUnit v5 FileTypeSelectorTest
* JUnit v5 FileTypeTest
* JUnit v5 FileNameTests
* JUnit v5 FileObjectEscapeCharacterInPathTest
* JUnit v5 FileSystemExceptionTest
* JUnit v5 FtpFileNameParserTest
* JUnit v5 FtpFileSystemConfigBuilderTest
* JUnit v5 FtpMdtmOnRefreshLastModifiedTests
* JUnit v5 FtpProviderTestCase
* JUnit v5 FileLockTest
* JUnit v5 FileTypeTest
* JUnit v5 GetContentInfoFunctionalTest
* JUnit v5 HttpGetContentInfoFunctionalTest
* JUnit v5 HttpsGetContentInfoFunctionalTest
* JUnit v5 HdfsFileProviderTest
* JUnit v5 Http4FilesCacheTest
* JUnit v5 Http4GetContentInfoTest
* JUnit v5 Http4ProviderTestCase
* JUnit v5 Http4sGetContentInfoTest
* JUnit v5 Http5FilesCacheTest
* JUnit v5 Http5GetContentInfoTest
* JUnit v5 Http5ProviderTestCase
* JUnit v5 Http5sGetContentInfoTest
* JUnit v5 HttpFilesCacheTest
* JUnit v5 HttpProviderTestCase
* JUnit v5 InvertIncludeFileSelectorTest
* JUnit v5 JarAttributesTest
* JUnit v5 Jira733Test
* JUnit v5 LocalFileRandomAccessContentTest
* JUnit v5 LastModifiedTests
* JUnit v5 LRUFilesCacheTests
* JUnit v5 LargeTarTest
* JUnit v5 NameFileFilterTest
* JUnit v5 NotFileFilterTest
* JUnit v5 NullFilesCacheTests
* JUnit v5 NamingTests
* JUnit v5 NHttpFileServer
* JUnit v5 OrFileFilterTest
* JUnit v5 PrefixFileFilterTest
* JUnit v5 ParseXmlInZipTest
* JUnit v5 PatternFileSelectorTest
* JUnit v5 PermissionsTests
* JUnit v5 ProviderRandomSetLengthTests
* JUnit v5 ProviderReadTests
* JUnit v5 ProviderWriteTests
* JUnit v5 ProviderWriteTests
* JUnit v5 RegexFileFilterTest
* JUnit v5 RegexFileFilterTest
* JUnit v5 RamFileRandomAccessContentTest
* JUnit v5 ResSchemeTest
* JUnit v5 RandomAccessModeTest
* JUnit v5 SuffixFileFilterTest
* JUnit v5 SymbolicLinkFileFilterTest
* JUnit v5 SymbolicLinkFileFilterTest
* JUnit v5 StandardFileSystemManagerTest
* JUnit v5 SftpFileSystemConfigBuilderTest
* JUnit v5 SftpPermissionExceptionTestCase
* JUnit v5 TarFileObjectTest
* JUnit v5 TarFileSystemTest
* JUnit v5 UriParserTest
* JUnit v5 UrlFileNameParserTest
* JUnit v5 UserAuthenticationDataTest
* JUnit v5 VFSTest
* JUnit v5 Vfs444TestCase
* JUnit v5 VfsClassLoaderTests
* JUnit v5 VfsTestUtils
* JUnit v5 WildcardFileFilterTest
* JUnit v5 WebDav4FilesTest
* JUnit v5 Webdav4FileObjectTest
* JUnit v5 WindowsFileNameTests
* JUnit v5 ZipFileSystemTest
* JUnit v5 ZipProviderWithCharsetNullTestCase
* JUnit v5 ZipProviderWithCharsetTestCase
---
.../webdav/test/WebdavProviderTestCase.java | 2 +-
.../webdav/test/WebdavProviderTestSuite.java | 2 +
.../provider/webdav4/Webdav4FileObjectTest.java | 4 +-
.../provider/webdav4/test/WebDav4FilesTest.java | 5 +-
.../provider/smb/test/SmbProviderTestCase.java | 2 +
.../commons/vfs2/provider/AbstractFileName.java | 1 -
.../vfs2/provider/temp/TemporaryFileProvider.java | 1 -
.../commons/vfs2/AbstractProviderTestCase.java | 1 +
.../commons/vfs2/AbstractProviderTestConfig.java | 1 +
.../org/apache/commons/vfs2/AbstractTestSuite.java | 1 +
.../org/apache/commons/vfs2/CacheTestSuite.java | 2 +
.../java/org/apache/commons/vfs2/ContentTests.java | 1 +
.../apache/commons/vfs2/FileChangeEventTest.java | 9 +-
.../commons/vfs2/FileExtensionSelectorTest.java | 27 ++--
.../java/org/apache/commons/vfs2/FileInfo.java | 1 +
.../org/apache/commons/vfs2/FileIteratorTest.java | 13 +-
.../vfs2/FileObjectEscapeCharacterInPathTest.java | 5 +-
.../commons/vfs2/FileSystemExceptionTest.java | 2 +-
.../apache/commons/vfs2/FileSystemOptionsTest.java | 26 ++--
.../apache/commons/vfs2/FileTypeSelectorTest.java | 10 +-
.../java/org/apache/commons/vfs2/FileTypeTest.java | 22 +--
.../vfs2/InvertIncludeFileSelectorTest.java | 7 +-
.../org/apache/commons/vfs2/LastModifiedTests.java | 10 +-
.../java/org/apache/commons/vfs2/NamingTests.java | 21 +--
.../java/org/apache/commons/vfs2/PathTests.java | 1 +
.../commons/vfs2/PatternFileSelectorTest.java | 12 +-
.../org/apache/commons/vfs2/PermissionsTests.java | 44 +++---
.../commons/vfs2/ProviderCacheStrategyTests.java | 2 +
.../apache/commons/vfs2/ProviderDeleteTests.java | 1 +
.../commons/vfs2/ProviderRandomReadTests.java | 2 +-
.../commons/vfs2/ProviderRandomReadWriteTests.java | 3 +-
.../commons/vfs2/ProviderRandomSetLengthTests.java | 15 +-
.../org/apache/commons/vfs2/ProviderReadTests.java | 17 +--
.../apache/commons/vfs2/ProviderRenameTests.java | 2 +
.../apache/commons/vfs2/ProviderTestConfig.java | 3 +-
.../org/apache/commons/vfs2/ProviderTestSuite.java | 1 +
.../commons/vfs2/ProviderWriteAppendTests.java | 1 +
.../apache/commons/vfs2/ProviderWriteTests.java | 29 ++--
.../test/java/org/apache/commons/vfs2/RunTest.java | 2 +
.../java/org/apache/commons/vfs2/UriTests.java | 1 +
.../org/apache/commons/vfs2/UrlStructureTests.java | 1 +
.../commons/vfs2/UserAuthenticationDataTest.java | 7 +-
.../test/java/org/apache/commons/vfs2/VFSTest.java | 19 +--
.../java/org/apache/commons/vfs2/VfsTestUtils.java | 14 +-
.../vfs2/auth/StaticUserAuthenticatorTest.java | 1 +
.../vfs2/cache/AbstractFilesCacheTestsBase.java | 1 +
.../vfs2/cache/DefaultFilesCacheTestCase.java | 2 +
.../commons/vfs2/cache/DefaultFilesCacheTests.java | 1 +
.../commons/vfs2/cache/LRUFilesCacheTestCase.java | 1 +
.../commons/vfs2/cache/LRUFilesCacheTests.java | 7 +-
.../commons/vfs2/cache/NullFilesCacheTestCase.java | 2 +
.../commons/vfs2/cache/NullFilesCacheTests.java | 10 +-
.../vfs2/cache/SoftRefFilesCacheTestCase.java | 2 +
.../vfs2/cache/WeakRefFilesCacheTestCase.java | 2 +
.../commons/vfs2/cache/WeakRefFilesCacheTests.java | 1 +
.../commons/vfs2/filter/AgeFileFilterTest.java | 7 -
.../commons/vfs2/filter/AndFileFilterTest.java | 39 +++---
.../apache/commons/vfs2/filter/BaseFilterTest.java | 3 -
.../vfs2/filter/CanExecuteFileFilterTest.java | 18 +--
.../commons/vfs2/filter/CanReadFileFilterTest.java | 6 -
.../vfs2/filter/CanWriteFileFilterTest.java | 5 -
.../vfs2/filter/DirectoryAndFileFilterTest.java | 5 -
.../commons/vfs2/filter/EmptyFileFilterTest.java | 4 -
.../commons/vfs2/filter/HiddenFileFilterTest.java | 4 -
.../commons/vfs2/filter/NameFileFilterTest.java | 71 +++++-----
.../commons/vfs2/filter/NotFileFilterTest.java | 13 +-
.../commons/vfs2/filter/OrFileFilterTest.java | 24 ++--
.../commons/vfs2/filter/PrefixFileFilterTest.java | 71 +++++-----
.../commons/vfs2/filter/RegexFileFilterTest.java | 45 +++---
.../commons/vfs2/filter/SizeFileFilterTest.java | 5 -
.../commons/vfs2/filter/SuffixFileFilterTest.java | 71 +++++-----
.../vfs2/filter/SymbolicLinkFileFilterTest.java | 23 +--
.../vfs2/filter/WildcardFileFilterTest.java | 155 ++++++++++-----------
.../commons/vfs2/function/VfsConsumerTest.java | 1 +
.../commons/vfs2/impl/DefaultFileMonitorTest.java | 24 ++--
.../vfs2/impl/DefaultFileSystemManagerTest.java | 43 +++---
.../vfs2/impl/StandardFileSystemManagerTest.java | 8 +-
.../commons/vfs2/impl/VfsClassLoaderTests.java | 6 +-
.../vfs2/operations/BasicOperationsTest.java | 35 +++--
.../commons/vfs2/perf/FileNamePerformance.java | 2 +
.../vfs2/provider/AbstractFileNameTest.java | 8 +-
.../vfs2/provider/DefaultFileContentTest.java | 29 ++--
.../commons/vfs2/provider/UriParserTest.java | 23 ++-
.../commons/vfs2/provider/bzip2/Bzip2Test.java | 22 +--
.../vfs2/provider/ftp/FtpFileNameParserTest.java | 5 +-
.../ftp/FtpFileSystemConfigBuilderTest.java | 3 +-
.../ftp/FtpMdtmOnRefreshLastModifiedTests.java | 5 +-
.../provider/ftp/FtpProviderMdtmOffTestCase.java | 1 +
.../vfs2/provider/ftp/FtpProviderTestCase.java | 5 +-
.../provider/ftp/FtpProviderUserDirTestCase.java | 1 +
.../vfs2/provider/ftp/MultipleConnectionTest.java | 1 +
.../ftps/AbstractFtpsProviderTestCase.java | 14 +-
.../ftps/FtpsProviderExplicitTestCase.java | 1 +
.../ftps/FtpsProviderImplicitTestCase.java | 2 +
.../vfs2/provider/ftps/MultipleConnectionTest.java | 1 +
.../vfs2/provider/hdfs/HdfsFileProviderTest.java | 133 +++++++++---------
.../provider/hdfs/HdfsFileProviderTestCase.java | 1 +
.../vfs2/provider/http/HttpFilesCacheTest.java | 10 +-
....java => HttpGetContentInfoFunctionalTest.java} | 8 +-
.../vfs2/provider/http/HttpProviderTestCase.java | 6 +-
.../vfs2/provider/http4/Http4FilesCacheTest.java | 20 +--
.../provider/http4/Http4GetContentInfoTest.java | 8 +-
.../vfs2/provider/http4/Http4ProviderTestCase.java | 6 +-
.../provider/http4s/Http4sGetContentInfoTest.java | 6 +-
.../vfs2/provider/http5/Http5FilesCacheTest.java | 10 +-
.../provider/http5/Http5GetContentInfoTest.java | 8 +-
.../vfs2/provider/http5/Http5ProviderTestCase.java | 6 +-
.../provider/http5s/Http5sGetContentInfoTest.java | 36 +++--
...java => HttpsGetContentInfoFunctionalTest.java} | 8 +-
.../vfs2/provider/jar/JarAttributesTest.java | 9 +-
.../vfs2/provider/jar/JarProviderTestCase.java | 2 +
.../vfs2/provider/jar/NestedJarTestCase.java | 2 +
.../vfs2/provider/local/ConversionTest.java | 4 +-
.../commons/vfs2/provider/local/FileNameTests.java | 4 +-
.../local/LocalFileRandomAccessContentTest.java | 11 +-
.../vfs2/provider/local/LocalProviderTestCase.java | 2 +
.../commons/vfs2/provider/local/TempFileTests.java | 1 +
.../commons/vfs2/provider/local/UrlTests.java | 2 +-
.../vfs2/provider/local/WindowsFileNameTests.java | 17 +--
.../vfs2/provider/ram/CustomRamProviderTest.java | 6 +-
.../ram/RamFileRandomAccessContentTest.java | 11 +-
.../vfs2/provider/ram/RamProviderTestCase.java | 2 +
.../commons/vfs2/provider/res/ResSchemeTest.java | 28 ++--
.../provider/res/ResourceProviderTestCase.java | 2 +
.../commons/vfs2/provider/res/Vfs444TestCase.java | 21 +--
.../sftp/AbstractSftpProviderTestCase.java | 1 +
.../sftp/SftpFileSystemConfigBuilderTest.java | 3 +-
.../provider/sftp/SftpMultiThreadWriteTests.java | 1 +
.../sftp/SftpPermissionExceptionTestCase.java | 17 +--
.../SftpProviderClosedExecChannelTestCase.java | 2 +
.../sftp/SftpProviderStreamProxyModeTestCase.java | 3 +-
.../vfs2/provider/sftp/SftpProviderTestCase.java | 1 +
.../vfs2/provider/tar/CreateFileSystemTest.java | 10 +-
.../commons/vfs2/provider/tar/LargeTarTest.java | 44 +++---
.../vfs2/provider/tar/NestedTarTestCase.java | 2 +
.../vfs2/provider/tar/NestedTbz2TestCase.java | 2 +
.../vfs2/provider/tar/NestedTgzTestCase.java | 2 +
.../vfs2/provider/tar/TarFileObjectTest.java | 9 +-
.../vfs2/provider/tar/TarFileSystemTest.java | 6 +-
.../vfs2/provider/tar/TarProviderTestCase.java | 2 +
.../vfs2/provider/tar/Tbz2ProviderTestCase.java | 2 +
.../vfs2/provider/tar/TgzProviderTestCase.java | 2 +
.../provider/temp/TemporaryProviderTestCase.java | 2 +
.../vfs2/provider/test/FileObjectSortTest.java | 36 +++--
.../vfs2/provider/test/GenericFileNameTest.java | 1 +
.../vfs2/provider/test/JunctionProviderConfig.java | 2 +
.../provider/test/VirtualProviderTestCase.java | 2 +
.../vfs2/provider/url/UrlFileNameParserTest.java | 8 +-
.../vfs2/provider/url/UrlHttpProviderTestCase.java | 2 +
.../vfs2/provider/url/UrlProviderHttpTestCase.java | 3 +-
.../vfs2/provider/url/UrlProviderTestCase.java | 2 +
.../commons/vfs2/provider/zip/FileLockTest.java | 20 +--
.../commons/vfs2/provider/zip/Jira733Test.java | 17 ++-
.../vfs2/provider/zip/NestedZipTestCase.java | 2 +
.../vfs2/provider/zip/ParseXmlInZipTest.java | 12 +-
.../vfs2/provider/zip/TestErrorHandler.java | 1 -
.../vfs2/provider/zip/ZipFileObjectTest.java | 1 +
.../vfs2/provider/zip/ZipFileSystemTest.java | 6 +-
.../vfs2/provider/zip/ZipProviderTestCase.java | 2 +
.../zip/ZipProviderWithCharsetNullTestCase.java | 8 +-
.../zip/ZipProviderWithCharsetTestCase.java | 8 +-
.../DelegatingFileSystemOptionsBuilderTest.java | 2 +
.../commons/vfs2/util/EncryptDecryptTest.java | 5 +-
.../commons/vfs2/util/FileObjectUtilsTest.java | 39 +++---
.../commons/vfs2/util/FreeSocketPortUtil.java | 1 +
.../apache/commons/vfs2/util/NHttpFileServer.java | 8 +-
.../commons/vfs2/util/RandomAccessModeTest.java | 11 +-
167 files changed, 989 insertions(+), 903 deletions(-)
diff --git a/commons-vfs2-jackrabbit1/src/test/java/org/apache/commons/vfs2/provider/webdav/test/WebdavProviderTestCase.java b/commons-vfs2-jackrabbit1/src/test/java/org/apache/commons/vfs2/provider/webdav/test/WebdavProviderTestCase.java
index 94e30c9..e619fe2 100644
--- a/commons-vfs2-jackrabbit1/src/test/java/org/apache/commons/vfs2/provider/webdav/test/WebdavProviderTestCase.java
+++ b/commons-vfs2-jackrabbit1/src/test/java/org/apache/commons/vfs2/provider/webdav/test/WebdavProviderTestCase.java
@@ -51,9 +51,9 @@ import junit.framework.Test;
/**
* Test cases for the WebDAV provider.
- *
*/
public class WebdavProviderTestCase extends AbstractProviderTestConfig {
+
private static final char[] PASSWORD = {};
private static final String USER_ID = "admin";
diff --git a/commons-vfs2-jackrabbit1/src/test/java/org/apache/commons/vfs2/provider/webdav/test/WebdavProviderTestSuite.java b/commons-vfs2-jackrabbit1/src/test/java/org/apache/commons/vfs2/provider/webdav/test/WebdavProviderTestSuite.java
index da8cf73..13ccb7f 100644
--- a/commons-vfs2-jackrabbit1/src/test/java/org/apache/commons/vfs2/provider/webdav/test/WebdavProviderTestSuite.java
+++ b/commons-vfs2-jackrabbit1/src/test/java/org/apache/commons/vfs2/provider/webdav/test/WebdavProviderTestSuite.java
@@ -37,6 +37,7 @@ import org.apache.commons.vfs2.UrlTests;
* The suite of tests for a file system.
*/
public class WebdavProviderTestSuite extends ProviderTestSuite {
+
/**
* Adds the tests for a file system to this suite.
*/
@@ -79,4 +80,5 @@ public class WebdavProviderTestSuite extends ProviderTestSuite {
// The class loader test requires the classes be uploaded to the webdav repo.
// addTests(VfsClassLoaderTests.class);
}
+
}
diff --git a/commons-vfs2-jackrabbit2/src/test/java/org/apache/commons/vfs2/provider/webdav4/Webdav4FileObjectTest.java b/commons-vfs2-jackrabbit2/src/test/java/org/apache/commons/vfs2/provider/webdav4/Webdav4FileObjectTest.java
index 94fdbf2..b332ecc 100644
--- a/commons-vfs2-jackrabbit2/src/test/java/org/apache/commons/vfs2/provider/webdav4/Webdav4FileObjectTest.java
+++ b/commons-vfs2-jackrabbit2/src/test/java/org/apache/commons/vfs2/provider/webdav4/Webdav4FileObjectTest.java
@@ -16,8 +16,8 @@
*/
package org.apache.commons.vfs2.provider.webdav4;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import org.apache.commons.vfs2.FileObject;
import org.apache.commons.vfs2.FileSystemException;
diff --git a/commons-vfs2-jackrabbit2/src/test/java/org/apache/commons/vfs2/provider/webdav4/test/WebDav4FilesTest.java b/commons-vfs2-jackrabbit2/src/test/java/org/apache/commons/vfs2/provider/webdav4/test/WebDav4FilesTest.java
index ac43f6d..d999789 100644
--- a/commons-vfs2-jackrabbit2/src/test/java/org/apache/commons/vfs2/provider/webdav4/test/WebDav4FilesTest.java
+++ b/commons-vfs2-jackrabbit2/src/test/java/org/apache/commons/vfs2/provider/webdav4/test/WebDav4FilesTest.java
@@ -16,11 +16,12 @@
*/
package org.apache.commons.vfs2.provider.webdav4.test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
import org.apache.commons.vfs2.FileObject;
import org.apache.commons.vfs2.FileSystemException;
import org.apache.commons.vfs2.FileSystemManager;
import org.apache.commons.vfs2.VFS;
-import org.junit.Assert;
import org.junit.jupiter.api.Test;
/**
@@ -37,7 +38,7 @@ public class WebDav4FilesTest {
// We end up converting back to lowercase, but OK per RFC.
final String urlWithAuthority = "webdav4://alice%5C1234:secret@localhost:80";
try (final FileObject file = fileSystemManager.resolveFile(urlWithAuthority)) {
- Assert.assertEquals("webdav4://alice%5c1234:secret@localhost/", file.getURL().toExternalForm());
+ assertEquals("webdav4://alice%5c1234:secret@localhost/", file.getURL().toExternalForm());
}
}
}
diff --git a/commons-vfs2-sandbox/src/test/java/org/apache/commons/vfs2/provider/smb/test/SmbProviderTestCase.java b/commons-vfs2-sandbox/src/test/java/org/apache/commons/vfs2/provider/smb/test/SmbProviderTestCase.java
index c562b4c..c7c52e4 100644
--- a/commons-vfs2-sandbox/src/test/java/org/apache/commons/vfs2/provider/smb/test/SmbProviderTestCase.java
+++ b/commons-vfs2-sandbox/src/test/java/org/apache/commons/vfs2/provider/smb/test/SmbProviderTestCase.java
@@ -30,6 +30,7 @@ import junit.framework.Test;
* Tests for the SMB file system.
*/
public class SmbProviderTestCase extends AbstractProviderTestConfig implements ProviderTestConfig {
+
private static final String TEST_URI = "test.smb.uri";
public static Test suite() throws Exception {
@@ -55,4 +56,5 @@ public class SmbProviderTestCase extends AbstractProviderTestConfig implements P
final String uri = System.getProperty(TEST_URI);
return manager.resolveFile(uri);
}
+
}
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileName.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileName.java
index 5468b04..ccff027 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileName.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileName.java
@@ -110,7 +110,6 @@ public abstract class AbstractFileName implements FileName {
return baseLen <= 1 || path.length() <= baseLen || path.charAt(baseLen) == SEPARATOR_CHAR;
}
throw new IllegalArgumentException();
-
}
/**
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/temp/TemporaryFileProvider.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/temp/TemporaryFileProvider.java
index d1ad9a6..6a8f42a 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/temp/TemporaryFileProvider.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/temp/TemporaryFileProvider.java
@@ -65,7 +65,6 @@ public class TemporaryFileProvider extends AbstractFileProvider implements Compa
final int h1 = hashCode();
final int h2 = o.hashCode();
return Integer.compare(h1, h2);
-
}
/**
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 e706af7..2709c5b 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
@@ -359,4 +359,5 @@ public abstract class AbstractProviderTestCase extends TestCase {
+ writeFolder + ", manager=" + manager + ", providerConfig=" + providerConfig + ", method=" + method
+ ", addEmptyDir=" + addEmptyDir + "]";
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/AbstractProviderTestConfig.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/AbstractProviderTestConfig.java
index 2e4e193..38ae090 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/AbstractProviderTestConfig.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/AbstractProviderTestConfig.java
@@ -72,4 +72,5 @@ public abstract class AbstractProviderTestConfig extends AbstractProviderTestCas
Thread.sleep(20);
}
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/AbstractTestSuite.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/AbstractTestSuite.java
index 713d0cb..c068ba7 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/AbstractTestSuite.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/AbstractTestSuite.java
@@ -333,4 +333,5 @@ public abstract class AbstractTestSuite extends TestSetup {
}
// System.in.read();
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/CacheTestSuite.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/CacheTestSuite.java
index 889a21a..90a7487 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/CacheTestSuite.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/CacheTestSuite.java
@@ -20,6 +20,7 @@ package org.apache.commons.vfs2;
* The suite of tests for a file cache.
*/
public class CacheTestSuite extends AbstractTestSuite {
+
public CacheTestSuite(final ProviderTestConfig providerConfig) throws Exception {
this(providerConfig, "", false);
}
@@ -28,4 +29,5 @@ public class CacheTestSuite extends AbstractTestSuite {
throws Exception {
super(providerConfig, prefix, nested);
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/ContentTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/ContentTests.java
index aaab7c5..27ef065 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/ContentTests.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/ContentTests.java
@@ -393,4 +393,5 @@ public class ContentTests extends AbstractProviderTestCase {
assertSameMessage("vfs.provider/get-size-not-file.error", unknownFile, e);
}
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileChangeEventTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileChangeEventTest.java
index 92274a7..1fd2ba9 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileChangeEventTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileChangeEventTest.java
@@ -16,9 +16,11 @@
*/
package org.apache.commons.vfs2;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
import java.io.File;
-import org.junit.Assert;
import org.junit.jupiter.api.Test;
public class FileChangeEventTest {
@@ -26,9 +28,10 @@ public class FileChangeEventTest {
@Test
public void testFileObject() throws FileSystemException {
try (FileObject baseFile = VFS.getManager().toFileObject(new File("."))) {
- Assert.assertNotNull(baseFile);
+ assertNotNull(baseFile);
final FileChangeEvent fileChangeEvent = new FileChangeEvent(baseFile);
- Assert.assertEquals(fileChangeEvent.getFile(), fileChangeEvent.getFileObject());
+ assertEquals(fileChangeEvent.getFile(), fileChangeEvent.getFileObject());
}
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileExtensionSelectorTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileExtensionSelectorTest.java
index 7b5f9cb..bb4f301 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileExtensionSelectorTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileExtensionSelectorTest.java
@@ -16,12 +16,15 @@
*/
package org.apache.commons.vfs2;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
-import org.junit.Assert;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@@ -83,7 +86,7 @@ public class FileExtensionSelectorTest {
public void testEmpty() throws Exception {
final FileSelector selector = new FileExtensionSelector();
final FileObject[] foList = BaseFolder.findFiles(selector);
- Assert.assertEquals(0, foList.length);
+ assertEquals(0, foList.length);
}
/**
@@ -94,7 +97,7 @@ public class FileExtensionSelectorTest {
@Test
public void testManyExtensions() throws Exception {
final FileObject[] foArray = BaseFolder.findFiles(Selectors.SELECT_FILES);
- Assert.assertTrue(foArray.length > 0);
+ assertTrue(foArray.length > 0);
// gather file extensions.
final Set<String> extensionSet = new HashSet<>();
for (final FileObject fo : foArray) {
@@ -102,12 +105,12 @@ public class FileExtensionSelectorTest {
}
final String message = String.format("Extensions: %s; files: %s", extensionSet.toString(),
Arrays.asList(foArray).toString());
- Assert.assertFalse(message, extensionSet.isEmpty());
- Assert.assertEquals(message, ExtensionCount, extensionSet.size());
+ assertFalse(extensionSet.isEmpty(), message);
+ assertEquals(ExtensionCount, extensionSet.size(), message);
// check all unique extensions
final FileSelector selector = new FileExtensionSelector(extensionSet);
final FileObject[] list = BaseFolder.findFiles(selector);
- Assert.assertEquals(FileCount, list.length);
+ assertEquals(FileCount, list.length);
}
/**
@@ -119,7 +122,7 @@ public class FileExtensionSelectorTest {
public void testNullCollection() throws Exception {
final FileSelector selector0 = new FileExtensionSelector((Collection<String>) null);
final FileObject[] foList = BaseFolder.findFiles(selector0);
- Assert.assertEquals(0, foList.length);
+ assertEquals(0, foList.length);
}
/**
@@ -131,7 +134,7 @@ public class FileExtensionSelectorTest {
public void testNullString() throws Exception {
final FileSelector selector0 = new FileExtensionSelector((String) null);
final FileObject[] foList = BaseFolder.findFiles(selector0);
- Assert.assertEquals(0, foList.length);
+ assertEquals(0, foList.length);
}
/**
@@ -142,7 +145,7 @@ public class FileExtensionSelectorTest {
@Test
public void testOneExtension() throws Exception {
final FileObject[] foArray = BaseFolder.findFiles(Selectors.SELECT_FILES);
- Assert.assertTrue(foArray.length > 0);
+ assertTrue(foArray.length > 0);
// gather file extensions.
final Set<String> extensionSet = new HashSet<>();
for (final FileObject fo : foArray) {
@@ -150,18 +153,18 @@ public class FileExtensionSelectorTest {
}
final String message = String.format("Extensions: %s; files: %s", extensionSet.toString(),
Arrays.asList(foArray).toString());
- Assert.assertEquals(message, ExtensionCount, extensionSet.size());
+ assertEquals(ExtensionCount, extensionSet.size(), message);
// check each extension
for (final String extension : extensionSet) {
final FileSelector selector = new FileExtensionSelector(extension);
final FileObject[] list = BaseFolder.findFiles(selector);
- Assert.assertEquals(FilesPerExtensionCount, list.length);
+ assertEquals(FilesPerExtensionCount, list.length);
}
// check each file against itself
for (final FileObject fo : foArray) {
final FileSelector selector = new FileExtensionSelector(fo.getName().getExtension());
final FileObject[] list = BaseFolder.findFiles(selector);
- Assert.assertEquals(FilesPerExtensionCount, list.length);
+ assertEquals(FilesPerExtensionCount, list.length);
}
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileInfo.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileInfo.java
index 4f7c1af..0a8426a 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileInfo.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileInfo.java
@@ -106,4 +106,5 @@ public class FileInfo {
public FileType getType() {
return type;
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileIteratorTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileIteratorTest.java
index 76ac4a8..d9f20d0 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileIteratorTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileIteratorTest.java
@@ -16,9 +16,11 @@
*/
package org.apache.commons.vfs2;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.util.Iterator;
-import org.junit.Assert;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@@ -72,21 +74,22 @@ public class FileIteratorTest {
@Test
public void testIterator() throws FileSystemException {
final FileObject[] findFiles = BaseFolder.findFiles(Selectors.SELECT_ALL);
- Assert.assertEquals(FileCount, findFiles.length);
+ assertEquals(FileCount, findFiles.length);
final FileObject[] listFiles = BaseFolder.getChildren();
- Assert.assertTrue(FileCount > listFiles.length);
+ assertTrue(FileCount > listFiles.length);
int i = 0;
for (final FileObject actualFile : BaseFolder) {
final FileObject expectedFile = findFiles[i];
- Assert.assertEquals(expectedFile, actualFile);
+ assertEquals(expectedFile, actualFile);
i++;
}
final Iterator<FileObject> iter = BaseFolder.iterator();
i = 0;
while (iter.hasNext()) {
final FileObject expectedFile = findFiles[i];
- Assert.assertEquals(expectedFile, iter.next());
+ assertEquals(expectedFile, iter.next());
i++;
}
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileObjectEscapeCharacterInPathTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileObjectEscapeCharacterInPathTest.java
index c6855ed..cbfde69 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileObjectEscapeCharacterInPathTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileObjectEscapeCharacterInPathTest.java
@@ -16,8 +16,8 @@
*/
package org.apache.commons.vfs2;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
import java.io.File;
import java.io.IOException;
@@ -112,4 +112,5 @@ public class FileObjectEscapeCharacterInPathTest {
public void testToFile2() throws IOException {
testToFile(FileObjectEscapeCharacterInPathTest::toFile2);
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileSystemExceptionTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileSystemExceptionTest.java
index 6ed02e3..b2aeb85 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileSystemExceptionTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileSystemExceptionTest.java
@@ -16,7 +16,7 @@
*/
package org.apache.commons.vfs2;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test;
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 748b809..5b9fa56 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
@@ -16,10 +16,10 @@
*/
package org.apache.commons.vfs2;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
-import org.junit.Assert;
import org.junit.jupiter.api.Test;
/**
@@ -54,7 +54,7 @@ public class FileSystemOptionsTest {
}
@Test
- public void testClone() throws CloneNotSupportedException {
+ public void testClone() {
final FileSystemOptions fileSystemOptions = new FileSystemOptions();
assertEquals(fileSystemOptions.getClass(), fileSystemOptions.clone().getClass());
assertEquals(0, ((FileSystemOptions) fileSystemOptions.clone()).size());
@@ -75,21 +75,21 @@ public class FileSystemOptionsTest {
final FileSystemOptions actual = new FileSystemOptions();
builder.setId(actual, "Test");
- Assert.assertEquals(expected, actual);
- Assert.assertEquals(0, actual.compareTo(expected));
- Assert.assertEquals(expected.hashCode(), actual.hashCode());
+ assertEquals(expected, actual);
+ assertEquals(0, actual.compareTo(expected));
+ assertEquals(expected.hashCode(), actual.hashCode());
builder.setNames(expected, new String[] {"A", "B", "C"});
- Assert.assertNotEquals(expected, actual);
- Assert.assertEquals(-1, actual.compareTo(expected));
- Assert.assertNotEquals(expected.hashCode(), actual.hashCode());
+ assertNotEquals(expected, actual);
+ assertEquals(-1, actual.compareTo(expected));
+ assertNotEquals(expected.hashCode(), actual.hashCode());
builder.setNames(actual, new String[] {"A", "B", "C"});
- Assert.assertEquals(expected, actual);
- Assert.assertEquals(0, actual.compareTo(expected));
- Assert.assertEquals(expected.hashCode(), actual.hashCode());
+ assertEquals(expected, actual);
+ assertEquals(0, actual.compareTo(expected));
+ assertEquals(expected.hashCode(), actual.hashCode());
}
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileTypeSelectorTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileTypeSelectorTest.java
index fd5bc07..2db5fb4 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileTypeSelectorTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileTypeSelectorTest.java
@@ -16,7 +16,8 @@
*/
package org.apache.commons.vfs2;
-import org.junit.Assert;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@@ -65,20 +66,21 @@ public class FileTypeSelectorTest {
final FileSelector selector = new FileTypeSelector(FileType.FILE_OR_FOLDER);
final FileObject[] foList = BaseFolder.findFiles(selector);
// Why 0?
- Assert.assertEquals(0, foList.length);
+ assertEquals(0, foList.length);
}
@Test
public void testFiles() throws Exception {
final FileSelector selector = new FileTypeSelector(FileType.FILE);
final FileObject[] foList = BaseFolder.findFiles(selector);
- Assert.assertEquals(5, foList.length);
+ assertEquals(5, foList.length);
}
@Test
public void testFolders() throws Exception {
final FileSelector selector = new FileTypeSelector(FileType.FOLDER);
final FileObject[] foList = BaseFolder.findFiles(selector);
- Assert.assertEquals(8, foList.length);
+ assertEquals(8, foList.length);
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileTypeTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileTypeTest.java
index c3d6528..09b9c5f 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileTypeTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileTypeTest.java
@@ -16,10 +16,11 @@
*/
package org.apache.commons.vfs2;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
import java.io.Serializable;
import org.apache.commons.lang3.SerializationUtils;
-import org.junit.Assert;
import org.junit.jupiter.api.Test;
/**
@@ -39,25 +40,25 @@ public class FileTypeTest {
}
- private void assertEquals(final FileType expected, final FileType actualFileType) {
- Assert.assertEquals(expected.getName(), actualFileType.getName());
- Assert.assertEquals(expected.hasAttributes(), actualFileType.hasAttributes());
- Assert.assertEquals(expected.hasChildren(), actualFileType.hasChildren());
- Assert.assertEquals(expected.hasContent(), actualFileType.hasContent());
+ private void assertFileTypeEquals(final FileType expected, final FileType actualFileType) {
+ assertEquals(expected.getName(), actualFileType.getName());
+ assertEquals(expected.hasAttributes(), actualFileType.hasAttributes());
+ assertEquals(expected.hasChildren(), actualFileType.hasChildren());
+ assertEquals(expected.hasContent(), actualFileType.hasContent());
}
private void test(final FileType expected) {
final byte[] serialized = SerializationUtils.serialize(expected);
- final FileType actualFileType = (FileType) SerializationUtils.deserialize(serialized);
- assertEquals(expected, actualFileType);
+ final FileType actualFileType = SerializationUtils.deserialize(serialized);
+ assertFileTypeEquals(expected, actualFileType);
}
@Test
public void testSerializationContainer() {
final Fixture expectedFixture = new Fixture();
final byte[] serialized = SerializationUtils.serialize(expectedFixture);
- final Fixture actualFixture = (Fixture) SerializationUtils.deserialize(serialized);
- assertEquals(expectedFixture.getFileType(), actualFixture.getFileType());
+ final Fixture actualFixture = SerializationUtils.deserialize(serialized);
+ assertFileTypeEquals(expectedFixture.getFileType(), actualFixture.getFileType());
}
@Test
@@ -79,4 +80,5 @@ public class FileTypeTest {
public void testSerializationImaginary() {
test(FileType.IMAGINARY);
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/InvertIncludeFileSelectorTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/InvertIncludeFileSelectorTest.java
index daf5808..5adcf18 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/InvertIncludeFileSelectorTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/InvertIncludeFileSelectorTest.java
@@ -16,7 +16,8 @@
*/
package org.apache.commons.vfs2;
-import org.junit.Assert;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@@ -37,14 +38,14 @@ public class InvertIncludeFileSelectorTest {
public void testInvertMatchAll() throws Exception {
final FileObject[] list = PatternFileSelectorTest.getBaseFolder()
.findFiles(new InvertIncludeFileSelector(new PatternFileSelector(".*")));
- Assert.assertEquals(0, list.length);
+ assertEquals(0, list.length);
}
@Test
public void testInvertMatchSome() throws Exception {
final FileObject[] list = PatternFileSelectorTest.getBaseFolder()
.findFiles(new InvertIncludeFileSelector(new PatternFileSelector(".*\\.html")));
- Assert.assertEquals(7, list.length);
+ assertEquals(7, list.length);
}
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/LastModifiedTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/LastModifiedTests.java
index 7b5f72c..2d78e6a 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/LastModifiedTests.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/LastModifiedTests.java
@@ -16,13 +16,13 @@
*/
package org.apache.commons.vfs2;
-import static org.junit.Assert.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
import java.time.Duration;
import java.time.Instant;
import java.util.Date;
-import org.junit.Assert;
+import org.junit.jupiter.api.Assertions;
import org.junit.Test;
/**
@@ -39,7 +39,7 @@ public class LastModifiedTests extends AbstractProviderTestCase {
// getLastModTimeAccuracy() is not accurate
final long actualDelta = Math.abs(expected - actual);
if (actualDelta > Math.max(delta, 1000)) {
- Assert.fail(String.format("%s expected=%,d (%s), actual=%,d (%s), expected delta=%,d, actual delta=%,d",
+ Assertions.fail(String.format("%s expected=%,d (%s), actual=%,d (%s), expected delta=%,d, actual delta=%,d",
message, Long.valueOf(expected), new Date(expected).toString(), Long.valueOf(actual),
new Date(actual).toString(), Long.valueOf(delta), Long.valueOf(actualDelta)));
}
@@ -48,8 +48,7 @@ public class LastModifiedTests extends AbstractProviderTestCase {
protected void assertEqualMillis(final String message, final long expected, final long actual) {
if (expected != actual) {
final long delta = Math.abs(expected - actual);
- Assert
- .fail(String.format("%s expected=%,d (%s), actual=%,d (%s), delta=%,d", message, Long.valueOf(expected),
+ Assertions.fail(String.format("%s expected=%,d (%s), actual=%,d (%s), delta=%,d", message, Long.valueOf(expected),
new Date(expected).toString(), Long.valueOf(actual), new Date(actual).toString(), delta));
}
}
@@ -141,4 +140,5 @@ public class LastModifiedTests extends AbstractProviderTestCase {
lastModTimeAccuracyMillis);
}
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/NamingTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/NamingTests.java
index 820b3f2..42cc4c3 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/NamingTests.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/NamingTests.java
@@ -16,6 +16,8 @@
*/
package org.apache.commons.vfs2;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
import org.junit.Test;
/**
@@ -368,25 +370,13 @@ public class NamingTests extends AbstractProviderTestCase {
assertEquals(path + "/dir/child", file.getName().getPathDecoded());
// §6 Use "%" literal
- try {
- getManager().resolveFile("%");
- fail();
- } catch (final FileSystemException e) {
- }
+ assertThrows(FileSystemException.class, () -> getManager().resolveFile("%"));
// §7 Not enough digits in encoded char
- try {
- getManager().resolveFile("%5");
- fail();
- } catch (final FileSystemException e) {
- }
+ assertThrows(FileSystemException.class, () -> getManager().resolveFile("%5"));
// §8 Invalid digit in encoded char
- try {
- getManager().resolveFile("%q");
- fail();
- } catch (final FileSystemException e) {
- }
+ assertThrows(FileSystemException.class, () -> getManager().resolveFile("%q"));
// free basefile
getManager().setBaseFile((FileObject) null);
@@ -420,4 +410,5 @@ public class NamingTests extends AbstractProviderTestCase {
// Test that the root name has no parent
assertNull("root parent", rootName.getParent());
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/PathTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/PathTests.java
index 739149b..226e2ee 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/PathTests.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/PathTests.java
@@ -109,4 +109,5 @@ public class PathTests extends AbstractProviderTestCase {
}
}
}
+
}
\ No newline at end of file
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/PatternFileSelectorTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/PatternFileSelectorTest.java
index 545d12f..caef283 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/PatternFileSelectorTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/PatternFileSelectorTest.java
@@ -16,14 +16,14 @@
*/
package org.apache.commons.vfs2;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
-import org.junit.Assert;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@@ -91,7 +91,7 @@ public class PatternFileSelectorTest {
@Test
public void testFileExtensions() throws Exception {
final FileObject[] foArray = BaseFolder.findFiles(Selectors.SELECT_FILES);
- Assert.assertTrue(foArray.length > 0);
+ assertTrue(foArray.length > 0);
final String regExPrefix = ".*\\.";
// gather file extensions.
final Set<String> extensionSet = new HashSet<>();
@@ -100,7 +100,7 @@ public class PatternFileSelectorTest {
}
final String message = String.format("Extensions: %s; files: %s", extensionSet.toString(),
Arrays.asList(foArray).toString());
- assertEquals(message, ExtensionCount, extensionSet.size());
+ assertEquals(ExtensionCount, extensionSet.size(), message);
// check each extension
for (final String extension : extensionSet) {
final FileSelector selector = new PatternFileSelector(extension);
@@ -152,11 +152,9 @@ public class PatternFileSelectorTest {
/**
* Tests a null selector.
- *
- * @throws Exception
*/
@Test
- public void testNullString() throws Exception {
+ public void testNullString() {
// Yep, this will blow up.
assertThrows(NullPointerException.class, () -> new PatternFileSelector((String) null));
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/PermissionsTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/PermissionsTests.java
index 61555a0..652e20c 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/PermissionsTests.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/PermissionsTests.java
@@ -21,7 +21,7 @@ import java.nio.charset.StandardCharsets;
import org.apache.commons.lang3.SystemUtils;
import org.apache.commons.vfs2.provider.local.LocalFileSystem;
-import org.junit.Assert;
+import org.junit.jupiter.api.Assertions;
import org.junit.Test;
/**
@@ -32,6 +32,7 @@ import org.junit.Test;
* @since 2.1
*/
public class PermissionsTests extends AbstractProviderTestCase {
+
public static final String FILENAME = "permission.txt";
private FileObject createTestFile() throws Exception {
@@ -94,20 +95,20 @@ public class PermissionsTests extends AbstractProviderTestCase {
// On Windows, all files are executable
if (isWindows()) {
- Assert.assertTrue("File expected to be executable: " + file, file.isExecutable());
+ Assertions.assertTrue(file.isExecutable(), "File expected to be executable: " + file);
} else {
// Set the executable flag for owner
- Assert.assertTrue("Setting executable permission failed: " + file, file.setExecutable(true, true));
- Assert.assertTrue("File expected to be executable: " + file, file.isExecutable());
+ Assertions.assertTrue(file.setExecutable(true, true), "Setting executable permission failed: " + file);
+ Assertions.assertTrue(file.isExecutable(), "File expected to be executable: " + file);
// Set the executable flag for all
- Assert.assertTrue("Setting executable permission failed: " + file, file.setExecutable(true, false));
- Assert.assertTrue("File expected to be executable: " + file, file.isExecutable());
+ Assertions.assertTrue(file.setExecutable(true, false), "Setting executable permission failed: " + file);
+ Assertions.assertTrue(file.isExecutable(), "File expected to be executable: " + file);
// Clear the executable flag
- Assert.assertTrue("Setting executable permission failed: " + file, file.setExecutable(false, true));
- Assert.assertFalse("File expected to be not executable: " + file, file.isExecutable());
+ Assertions.assertTrue(file.setExecutable(false, true), "Setting executable permission failed: " + file);
+ Assertions.assertFalse(file.isExecutable(), "File expected to be not executable: " + file);
}
}
@@ -120,19 +121,19 @@ public class PermissionsTests extends AbstractProviderTestCase {
if (isWindows()) {
// On Windows, all owned files are readable
- Assert.assertTrue("File expected to be readable: " + file, file.isReadable());
+ Assertions.assertTrue(file.isReadable(), "File expected to be readable: " + file);
} else {
// Set the readable permission for owner
- Assert.assertTrue("Setting read permission failed: " + file, file.setReadable(true, true));
- Assert.assertTrue("File expected to be readable: " + file, file.isReadable());
+ Assertions.assertTrue(file.setReadable(true, true), "Setting read permission failed: " + file);
+ Assertions.assertTrue(file.isReadable(), "File expected to be readable: " + file);
// Set the readable permission for all
- Assert.assertTrue("Setting read permission failed: " + file, file.setReadable(true, false));
- Assert.assertTrue("File expected to be readable: " + file, file.isReadable());
+ Assertions.assertTrue(file.setReadable(true, false), "Setting read permission failed: " + file);
+ Assertions.assertTrue(file.isReadable(), "File expected to be readable: " + file);
// Clear the readable permission
- Assert.assertTrue("Setting read permission failed: " + file, file.setReadable(false, true));
- Assert.assertFalse("File expected to be not readable: " + file, file.isReadable());
+ Assertions.assertTrue(file.setReadable(false, true), "Setting read permission failed: " + file);
+ Assertions.assertFalse(file.isReadable(), "File expected to be not readable: " + file);
}
}
@@ -144,15 +145,16 @@ public class PermissionsTests extends AbstractProviderTestCase {
final FileObject file = createTestFile();
// Set the write permission for owner
- Assert.assertTrue("Setting write permission failed: " + file, file.setWritable(true, true));
- Assert.assertTrue("File expected to be writable: " + file, file.isWriteable());
+ Assertions.assertTrue(file.setWritable(true, true), "Setting write permission failed: " + file);
+ Assertions.assertTrue(file.isWriteable(), "File expected to be writable: " + file);
// Set the write permission for all
- Assert.assertTrue("Setting write permission failed: " + file, file.setWritable(true, false));
- Assert.assertTrue("File expected to be writable: " + file, file.isWriteable());
+ Assertions.assertTrue(file.setWritable(true, false), "Setting write permission failed: " + file);
+ Assertions.assertTrue(file.isWriteable(), "File expected to be writable: " + file);
// Clear the write permission
- Assert.assertTrue("Setting write permission failed: " + file, file.setWritable(false, true));
- Assert.assertFalse("File expected to be not writable: " + file, file.isWriteable());
+ Assertions.assertTrue(file.setWritable(false, true), "Setting write permission failed: " + file);
+ Assertions.assertFalse(file.isWriteable(), "File expected to be not writable: " + file);
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/ProviderCacheStrategyTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/ProviderCacheStrategyTests.java
index 53a23bf..af81da3 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/ProviderCacheStrategyTests.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/ProviderCacheStrategyTests.java
@@ -26,6 +26,7 @@ import org.junit.Test;
* Test the cache stragey
*/
public class ProviderCacheStrategyTests extends AbstractProviderTestCase {
+
public void assertContains(final FileObject[] fos, final String string) {
for (final FileObject fo : fos) {
if (string.equals(fo.getName().getBaseName())) {
@@ -149,4 +150,5 @@ public class ProviderCacheStrategyTests extends AbstractProviderTestCase {
fos = cachedFolder.getChildren();
assertContains(fos, "file1.txt");
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/ProviderDeleteTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/ProviderDeleteTests.java
index 8c54709..492ef5c 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/ProviderDeleteTests.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/ProviderDeleteTests.java
@@ -130,4 +130,5 @@ public class ProviderDeleteTests extends AbstractProviderTestCase {
assertEquals(1, scratchFolder.delete(new FileNameSelector("a.txt")));
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/ProviderRandomReadTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/ProviderRandomReadTests.java
index 4387481..52a1c60 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/ProviderRandomReadTests.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/ProviderRandomReadTests.java
@@ -21,7 +21,6 @@ import org.junit.Test;
/**
* Random read-only test case for file providers.
- *
*/
public class ProviderRandomReadTests extends AbstractProviderTestCase {
@@ -79,4 +78,5 @@ public class ProviderRandomReadTests extends AbstractProviderTestCase {
assertEquals("fp", 12, ra.getFilePointer());
}
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/ProviderRandomReadWriteTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/ProviderRandomReadWriteTests.java
index afdb826..824af85 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/ProviderRandomReadWriteTests.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/ProviderRandomReadWriteTests.java
@@ -21,9 +21,9 @@ import org.junit.Test;
/**
* Random read and write test case for file providers.
- *
*/
public class ProviderRandomReadWriteTests extends AbstractProviderTestCase {
+
private static final String TEST_DATA = "This is a test file.";
/**
@@ -88,4 +88,5 @@ public class ProviderRandomReadWriteTests extends AbstractProviderTestCase {
assertEquals(ra.readByte(), TEST_DATA.charAt(11));
}
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/ProviderRandomSetLengthTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/ProviderRandomSetLengthTests.java
index 84c1e86..6cfdb1a 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/ProviderRandomSetLengthTests.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/ProviderRandomSetLengthTests.java
@@ -19,14 +19,14 @@ package org.apache.commons.vfs2;
import java.io.IOException;
import org.apache.commons.vfs2.util.RandomAccessMode;
-import org.junit.Assert;
+import org.junit.jupiter.api.Assertions;
import org.junit.Test;
/**
* Random set length test cases for file providers.
- *
*/
public class ProviderRandomSetLengthTests extends AbstractProviderTestCase {
+
private static final String TEST_DATA = "This is a test file.";
/**
@@ -63,29 +63,30 @@ public class ProviderRandomSetLengthTests extends AbstractProviderTestCase {
// Write long string
ra.writeBytes(TEST_DATA);
- Assert.assertEquals(fileString, TEST_DATA.length(), ra.length());
+ Assertions.assertEquals( TEST_DATA.length(), ra.length(),fileString);
// Shrink to length 1
ra.setLength(1);
- Assert.assertEquals(fileString, 1, ra.length());
+ Assertions.assertEquals(1, ra.length(), fileString);
// now read 1
ra.seek(0);
- Assert.assertEquals(fileString, TEST_DATA.charAt(0), ra.readByte());
+ Assertions.assertEquals(TEST_DATA.charAt(0), ra.readByte(), fileString);
try {
ra.readByte();
- Assert.fail("Expected " + Exception.class.getName());
+ Assertions.fail("Expected " + Exception.class.getName());
} catch (final IOException e) {
// Expected
}
// Grow to length 2
ra.setLength(2);
- Assert.assertEquals(fileString, 2, ra.length());
+ Assertions.assertEquals(2, ra.length(), fileString);
// We have an undefined extra byte
ra.seek(1);
ra.readByte();
}
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/ProviderReadTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/ProviderReadTests.java
index 9bec41c..b9e742f 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/ProviderReadTests.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/ProviderReadTests.java
@@ -23,7 +23,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
-import org.junit.Assert;
+import org.junit.jupiter.api.Assertions;
import org.junit.Test;
/**
@@ -138,9 +138,9 @@ public class ProviderReadTests extends AbstractProviderTestCase {
@Test
public void testDotJarFolderName() throws Exception {
final FileObject folder = getReadFolderDir1().resolveFile("subdir4.jar");
- Assert.assertTrue(folder.exists());
+ Assertions.assertTrue(folder.exists());
final FileObject file = folder.resolveFile("file1.txt");
- Assert.assertTrue(file.exists());
+ Assertions.assertTrue(file.exists());
}
/**
@@ -149,8 +149,8 @@ public class ProviderReadTests extends AbstractProviderTestCase {
@Test
public void testDotJarFolderNameLayer() throws Exception {
final FileObject folder = getReadFolderDir1().resolveFile("subdir4.jar");
- Assert.assertTrue("subdir4.jar/ must exist as folder, check test setup.", folder.isFolder());
- Assert.assertFalse("subdir4.jar/ must not be layerable", getManager().canCreateFileSystem(folder));
+ Assertions.assertTrue(folder.isFolder(), "subdir4.jar/ must exist as folder, check test setup.");
+ Assertions.assertFalse(getManager().canCreateFileSystem(folder), "subdir4.jar/ must not be layerable");
try {
final FileObject ignored = getManager().createFileSystem(folder);
fail("Should not be able to create a layered filesystem on a directory. " + ignored);
@@ -208,7 +208,7 @@ public class ProviderReadTests extends AbstractProviderTestCase {
@Test
public void testFolderIsHidden() throws Exception {
final FileObject folder = getReadFolderDir1();
- Assert.assertFalse(folder.isHidden());
+ Assertions.assertFalse(folder.isHidden());
}
/**
@@ -217,7 +217,7 @@ public class ProviderReadTests extends AbstractProviderTestCase {
@Test
public void testFolderIsReadable() throws Exception {
final FileObject folder = getReadFolderDir1();
- Assert.assertTrue(folder.isReadable());
+ Assertions.assertTrue(folder.isReadable());
}
/**
@@ -226,7 +226,7 @@ public class ProviderReadTests extends AbstractProviderTestCase {
@Test
public void testFolderIsSymbolicLink() throws Exception {
final FileObject folder = getReadFolderDir1();
- Assert.assertFalse(folder.isSymbolicLink());
+ Assertions.assertFalse(folder.isSymbolicLink());
}
@Test
@@ -356,4 +356,5 @@ public class ProviderReadTests extends AbstractProviderTestCase {
file = getReadFolder().resolveFile("unknown-child");
assertSame(FileType.IMAGINARY, file.getType());
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/ProviderRenameTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/ProviderRenameTests.java
index 5ee9564..a6e7ad5 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/ProviderRenameTests.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/ProviderRenameTests.java
@@ -27,6 +27,7 @@ import org.junit.Test;
* File system test that check that a file system can be renamed.
*/
public class ProviderRenameTests extends AbstractProviderTestCase {
+
/**
* Sets up a scratch folder for the test to use.
*/
@@ -138,4 +139,5 @@ public class ProviderRenameTests extends AbstractProviderTestCase {
moveFile(destFolder, file, content);
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/ProviderTestConfig.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/ProviderTestConfig.java
index 03a944a..8a87dd7 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/ProviderTestConfig.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/ProviderTestConfig.java
@@ -20,9 +20,9 @@ import org.apache.commons.vfs2.impl.DefaultFileSystemManager;
/**
* Test configuration for a file system.
- *
*/
public interface ProviderTestConfig {
+
/**
* Returns the base folder for tests. This folder must exist, and contain the following structure:
* <ul>
@@ -55,4 +55,5 @@ public interface ProviderTestConfig {
* Prepares the file system manager.
*/
void prepare(DefaultFileSystemManager manager) throws Exception;
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/ProviderTestSuite.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/ProviderTestSuite.java
index 0a148b8..92e15f8 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/ProviderTestSuite.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/ProviderTestSuite.java
@@ -22,6 +22,7 @@ import org.apache.commons.vfs2.impl.VfsClassLoaderTests;
* The suite of tests for a file system.
*/
public class ProviderTestSuite extends AbstractTestSuite {
+
/**
* Adds the tests for a file system to this suite.
*/
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/ProviderWriteAppendTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/ProviderWriteAppendTests.java
index cd8723d..4107263 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/ProviderWriteAppendTests.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/ProviderWriteAppendTests.java
@@ -110,4 +110,5 @@ public class ProviderWriteAppendTests extends AbstractProviderTestCase {
assertSameContent(content1, file);
}
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/ProviderWriteTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/ProviderWriteTests.java
index b6a5817..3a98274 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/ProviderWriteTests.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/ProviderWriteTests.java
@@ -16,6 +16,8 @@
*/
package org.apache.commons.vfs2;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
import java.io.OutputStream;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
@@ -23,7 +25,7 @@ import java.util.HashSet;
import java.util.Objects;
import java.util.Set;
-import org.junit.Assert;
+import org.junit.jupiter.api.Assertions;
import org.junit.Test;
/**
@@ -442,26 +444,14 @@ public class ProviderWriteTests extends AbstractProviderTestCase {
assertTrue(folder.isFolder());
// Attempt to create a file that already exists as a folder
- try {
- folder.createFile();
- fail();
- } catch (final FileSystemException exc) {
- }
+ assertThrows(FileSystemException.class, () -> folder.createFile());
// Attempt to create a folder that already exists as a file
- try {
- file.createFolder();
- fail();
- } catch (final FileSystemException exc) {
- }
+ assertThrows(FileSystemException.class, () -> file.createFolder());
// Attempt to create a folder as a child of a file
final FileObject folder2 = file.resolveFile("some-child");
- try {
- folder2.createFolder();
- fail();
- } catch (final FileSystemException exc) {
- }
+ assertThrows(FileSystemException.class, () -> folder2.createFolder());
}
/**
@@ -504,7 +494,7 @@ public class ProviderWriteTests extends AbstractProviderTestCase {
@Test
public void testFolderIsHidden() throws Exception {
final FileObject folder = getReadFolderDir1();
- Assert.assertFalse(folder.isHidden());
+ Assertions.assertFalse(folder.isHidden());
}
/**
@@ -513,7 +503,7 @@ public class ProviderWriteTests extends AbstractProviderTestCase {
@Test
public void testFolderIsReadable() throws Exception {
final FileObject folder = getReadFolderDir1();
- Assert.assertTrue(folder.isReadable());
+ Assertions.assertTrue(folder.isReadable());
}
/**
@@ -522,7 +512,7 @@ public class ProviderWriteTests extends AbstractProviderTestCase {
@Test
public void testFolderIsWritable() throws Exception {
final FileObject folder = getWriteFolder().resolveFile("dir1");
- Assert.assertTrue(folder.isWriteable());
+ Assertions.assertTrue(folder.isWriteable());
}
/**
@@ -772,4 +762,5 @@ public class ProviderWriteTests extends AbstractProviderTestCase {
}
assertSameContent(expectedString, fileTarget);
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/RunTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/RunTest.java
index 64ca769..2fab516 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/RunTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/RunTest.java
@@ -23,6 +23,7 @@ import junit.framework.Test;
import junit.framework.TestResult;
public class RunTest {
+
public static void main(final String[] args) throws Exception {
final String ip = "192.168.0.128";
@@ -101,4 +102,5 @@ public class RunTest {
// break;
}
}
+
}
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 2a5af59..455a0b1 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
@@ -102,4 +102,5 @@ public class UriTests extends AbstractProviderTestCase {
assertSame("Resolving two times should not produce new filesystem on " + uriStr, f1.getFileSystem(),
f2.getFileSystem());
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/UrlStructureTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/UrlStructureTests.java
index d7da9f5..f904b7f 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/UrlStructureTests.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/UrlStructureTests.java
@@ -57,4 +57,5 @@ public class UrlStructureTests extends AbstractProviderTestCase {
assertSameMessage("vfs.provider/read-not-file.error", folder, e);
}
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/UserAuthenticationDataTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/UserAuthenticationDataTest.java
index 83e2a39..9c1d3fb 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/UserAuthenticationDataTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/UserAuthenticationDataTest.java
@@ -16,9 +16,9 @@
*/
package org.apache.commons.vfs2;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertSame;
import org.junit.jupiter.api.Test;
@@ -51,4 +51,5 @@ public class UserAuthenticationDataTest {
data.setData(type, array);
assertSame(array, data.getData(type));
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/VFSTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/VFSTest.java
index fecb66c..4aea92b 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/VFSTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/VFSTest.java
@@ -16,12 +16,14 @@
*/
package org.apache.commons.vfs2;
-import static org.junit.Assert.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
import java.nio.file.Paths;
import org.apache.commons.vfs2.impl.StandardFileSystemManager;
-import org.junit.Assert;
import org.junit.jupiter.api.Test;
public class VFSTest {
@@ -38,19 +40,19 @@ public class VFSTest {
VFS.setManager(fileSystemManager);
VFS.setManager(null);
}
- Assert.assertNotNull(VFS.getManager());
- Assert.assertFalse(VFS.getManager().resolveFile(Paths.get("DoesNotExist.not").toUri()).exists());
+ assertNotNull(VFS.getManager());
+ assertFalse(VFS.getManager().resolveFile(Paths.get("DoesNotExist.not").toUri()).exists());
}
@Test
public void test_setManager() throws FileSystemException {
final StandardFileSystemManager fileSystemManager = new StandardFileSystemManager();
VFS.setManager(fileSystemManager);
- Assert.assertEquals(fileSystemManager, VFS.getManager());
+ assertEquals(fileSystemManager, VFS.getManager());
// Reset global for other tests
VFS.setManager(null);
- Assert.assertNotNull(VFS.getManager());
- Assert.assertNotEquals(fileSystemManager, VFS.getManager());
+ assertNotNull(VFS.getManager());
+ assertNotEquals(fileSystemManager, VFS.getManager());
}
@Test
@@ -60,8 +62,9 @@ public class VFSTest {
assertNotEquals(manager, VFS.getManager());
}
@Test
- public void testStaticCloseRepeatable() throws FileSystemException {
+ public void testStaticCloseRepeatable() {
VFS.close();
VFS.close();
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/VfsTestUtils.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/VfsTestUtils.java
index b2736fa..af4546c 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/VfsTestUtils.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/VfsTestUtils.java
@@ -16,9 +16,9 @@
*/
package org.apache.commons.vfs2;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.File;
import java.io.IOException;
@@ -126,8 +126,8 @@ public abstract class VfsTestUtils {
public static File getTestDirectory(final String name) {
File file = new File(getTestDirectoryFile(), name);
file = getCanonicalFile(file);
- assertTrue("Test directory \"" + file + "\" does not exist or is not a directory.",
- file.isDirectory() || file.mkdirs());
+ assertTrue(file.isDirectory() || file.mkdirs(),
+ "Test directory \"" + file + "\" does not exist or is not a directory.");
return file;
}
@@ -169,9 +169,9 @@ public abstract class VfsTestUtils {
File file = new File(getTestDirectoryFile(), name);
file = getCanonicalFile(file);
if (mustExist) {
- assertTrue("Test file \"" + file + "\" does not exist.", file.exists());
+ assertTrue(file.exists(), "Test file \"" + file + "\" does not exist.");
} else {
- assertFalse("Test file \"" + file + "\" should not exist.", file.exists());
+ assertFalse(file.exists(), "Test file \"" + file + "\" should not exist.");
}
return file;
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/auth/StaticUserAuthenticatorTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/auth/StaticUserAuthenticatorTest.java
index 695ae68..3d24cef 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/auth/StaticUserAuthenticatorTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/auth/StaticUserAuthenticatorTest.java
@@ -52,4 +52,5 @@ public class StaticUserAuthenticatorTest {
assertNotEquals(new StaticUserAuthenticator(null, "USER", "PWD"), userAuthenticator);
assertEquals(new StaticUserAuthenticator("DOMAIN", "USER", "PWD").hashCode(), userAuthenticator.hashCode());
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/AbstractFilesCacheTestsBase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/AbstractFilesCacheTestsBase.java
index a9a32cf..e3a1f91 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/AbstractFilesCacheTestsBase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/AbstractFilesCacheTestsBase.java
@@ -87,4 +87,5 @@ public abstract class AbstractFilesCacheTestsBase extends AbstractProviderTestCa
assertNotSame("Objects after cache clear should be different", fo1, fo2);
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/DefaultFilesCacheTestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/DefaultFilesCacheTestCase.java
index 4614a0b..ebb6eba 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/DefaultFilesCacheTestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/DefaultFilesCacheTestCase.java
@@ -30,6 +30,7 @@ import junit.framework.Test;
* Tests the {@link DefaultFilesCache} using {@link DefaultFilesCacheTests}.
*/
public class DefaultFilesCacheTestCase extends AbstractProviderTestConfig {
+
public static Test suite() throws Exception {
final CacheTestSuite suite = new CacheTestSuite(new DefaultFilesCacheTestCase());
suite.addTests(DefaultFilesCacheTests.class);
@@ -45,4 +46,5 @@ public class DefaultFilesCacheTestCase extends AbstractProviderTestConfig {
public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception {
return manager.toFileObject(getTestDirectoryFile());
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/DefaultFilesCacheTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/DefaultFilesCacheTests.java
index a8b10f4..731fc98 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/DefaultFilesCacheTests.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/DefaultFilesCacheTests.java
@@ -38,4 +38,5 @@ public class DefaultFilesCacheTests extends AbstractFilesCacheTestsBase {
final int hc2 = getFileHashCode();
assertEquals("Hashcode of file changed, so most likely new instance", hc1, hc2);
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/LRUFilesCacheTestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/LRUFilesCacheTestCase.java
index c57f767..4b3dee5 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/LRUFilesCacheTestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/LRUFilesCacheTestCase.java
@@ -46,4 +46,5 @@ public class LRUFilesCacheTestCase extends AbstractProviderTestConfig {
public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception {
return manager.toFileObject(getTestDirectoryFile());
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/LRUFilesCacheTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/LRUFilesCacheTests.java
index af285d1..8dc452a 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/LRUFilesCacheTests.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/LRUFilesCacheTests.java
@@ -21,7 +21,7 @@ import java.util.Objects;
import org.apache.commons.vfs2.FileObject;
import org.apache.commons.vfs2.FilesCache;
import org.apache.commons.vfs2.impl.DefaultFileSystemManager;
-import org.junit.Assert;
+import org.junit.jupiter.api.Assertions;
import org.junit.Test;
/**
@@ -33,7 +33,7 @@ public class LRUFilesCacheTests extends AbstractFilesCacheTestsBase {
public void testClass() {
@SuppressWarnings("resource")
final DefaultFileSystemManager manager = getManager();
- Assert.assertNotNull("manager", manager);
+ Assertions.assertNotNull(manager, "manager");
final FilesCache filesCache = manager.getFilesCache();
assertTrue(Objects.toString(filesCache), filesCache instanceof LRUFilesCache);
}
@@ -41,7 +41,7 @@ public class LRUFilesCacheTests extends AbstractFilesCacheTestsBase {
@Test
public void testFilesCache() throws Exception {
final FileObject scratchFolder = getWriteFolder();
- Assert.assertNotNull("scratchFolder", scratchFolder);
+ Assertions.assertNotNull(scratchFolder, "scratchFolder");
// releaseable
final FileObject dir1 = scratchFolder.resolveFile("dir1");
@@ -82,4 +82,5 @@ public class LRUFilesCacheTests extends AbstractFilesCacheTestsBase {
final FileObject dir1_2 = scratchFolder.resolveFile("dir1");
assertNotSame(dir1, dir1_2);
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/NullFilesCacheTestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/NullFilesCacheTestCase.java
index 943c730..4cadd4e 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/NullFilesCacheTestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/NullFilesCacheTestCase.java
@@ -30,6 +30,7 @@ import junit.framework.Test;
* Tests the {@link NullFilesCache} using {@link NullFilesCacheTests}.
*/
public class NullFilesCacheTestCase extends AbstractProviderTestConfig {
+
public static Test suite() throws Exception {
final CacheTestSuite suite = new CacheTestSuite(new NullFilesCacheTestCase());
suite.addTests(NullFilesCacheTests.class);
@@ -45,4 +46,5 @@ public class NullFilesCacheTestCase extends AbstractProviderTestConfig {
public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception {
return manager.toFileObject(getTestDirectoryFile());
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/NullFilesCacheTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/NullFilesCacheTests.java
index 91f0b64..a19bf5e 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/NullFilesCacheTests.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/NullFilesCacheTests.java
@@ -21,10 +21,9 @@ import org.apache.commons.vfs2.FileObject;
import org.apache.commons.vfs2.FileSystem;
import org.apache.commons.vfs2.FilesCache;
import org.apache.commons.vfs2.impl.DefaultFileSystemManager;
-import org.junit.Assert;
+import org.junit.jupiter.api.Assertions;
import org.junit.Test;
-
/**
* Tests for {@link NullFilesCache} used by {@link NullFilesCacheTestCase}.
*/
@@ -34,7 +33,7 @@ public class NullFilesCacheTests extends AbstractFilesCacheTestsBase {
@Test
public void testBasicCacheOps() throws Exception {
final DefaultFileSystemManager manager = getManager();
- Assert.assertNotNull("This test should not have a null DefaultFileSystemManager", manager);
+ Assertions.assertNotNull(manager, "This test should not have a null DefaultFileSystemManager");
// the basic test looks different for a null cache:
final FilesCache cache = manager.getFilesCache();
final FileObject fo = getWriteFolder().resolveFile("dir1");
@@ -57,18 +56,19 @@ public class NullFilesCacheTests extends AbstractFilesCacheTestsBase {
@Test
public void testClass() {
final DefaultFileSystemManager manager = getManager();
- Assert.assertNotNull("This test should not have a null DefaultFileSystemManager", manager);
+ Assertions.assertNotNull(manager, "This test should not have a null DefaultFileSystemManager");
assertTrue(manager.getFilesCache() instanceof NullFilesCache);
}
@Test
public void testFilesCache() throws Exception {
final FileObject scratchFolder = getWriteFolder();
- Assert.assertNotNull("This test should not have a null FileObject scratch folder", scratchFolder);
+ Assertions.assertNotNull(scratchFolder, "This test should not have a null FileObject scratch folder");
final FileObject dir1 = scratchFolder.resolveFile("dir1");
final FileObject dir1_2 = scratchFolder.resolveFile("dir1");
assertNotSame("Should always be new instance with NullCache", dir1, dir1_2);
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/SoftRefFilesCacheTestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/SoftRefFilesCacheTestCase.java
index 5705254..585c3a3 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/SoftRefFilesCacheTestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/SoftRefFilesCacheTestCase.java
@@ -30,6 +30,7 @@ import junit.framework.Test;
* Tests the {@link SoftRefFilesCache} using {@link SoftRefFilesCacheTests}.
*/
public class SoftRefFilesCacheTestCase extends AbstractProviderTestConfig {
+
public static Test suite() throws Exception {
final CacheTestSuite suite = new CacheTestSuite(new SoftRefFilesCacheTestCase());
suite.addTests(SoftRefFilesCacheTests.class);
@@ -45,4 +46,5 @@ public class SoftRefFilesCacheTestCase extends AbstractProviderTestConfig {
public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception {
return manager.toFileObject(getTestDirectoryFile());
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/WeakRefFilesCacheTestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/WeakRefFilesCacheTestCase.java
index 3736c4f..5a54b5c 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/WeakRefFilesCacheTestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/WeakRefFilesCacheTestCase.java
@@ -30,6 +30,7 @@ import junit.framework.Test;
* Tests the {@link WeakRefFilesCache} using {@link WeakRefFilesCacheTests}.
*/
public class WeakRefFilesCacheTestCase extends AbstractProviderTestConfig {
+
public static Test suite() throws Exception {
final CacheTestSuite suite = new CacheTestSuite(new WeakRefFilesCacheTestCase());
suite.addTests(WeakRefFilesCacheTests.class);
@@ -45,4 +46,5 @@ public class WeakRefFilesCacheTestCase extends AbstractProviderTestConfig {
public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception {
return manager.toFileObject(getTestDirectoryFile());
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/WeakRefFilesCacheTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/WeakRefFilesCacheTests.java
index 2134767..93e2016 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/WeakRefFilesCacheTests.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/WeakRefFilesCacheTests.java
@@ -39,4 +39,5 @@ public class WeakRefFilesCacheTests extends AbstractFilesCacheTestsBase {
// since both are still referenced they are not purged
assertSame(dir1, dir1_2);
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/AgeFileFilterTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/AgeFileFilterTest.java
index 3b9dd62..3dd1f7e 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/AgeFileFilterTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/AgeFileFilterTest.java
@@ -107,7 +107,6 @@ public class AgeFileFilterTest extends BaseFilterTest {
zipFile = new File(getTempDir(), AgeFileFilterTest.class.getName() + ".zip");
zipDir(testDir, "", zipFile);
zipFileObj = getZipFileObject(zipFile);
-
}
@Test
@@ -117,7 +116,6 @@ public class AgeFileFilterTest extends BaseFilterTest {
Assert.assertTrue(testee.accept(oldFileInfo));
Assert.assertTrue(testee.accept(currentFileInfo));
Assert.assertFalse(testee.accept(newFileInfo));
-
}
@Test
@@ -134,7 +132,6 @@ public class AgeFileFilterTest extends BaseFilterTest {
Assert.assertFalse(testee.accept(oldFileInfo));
Assert.assertFalse(testee.accept(currentFileInfo));
Assert.assertTrue(testee.accept(newFileInfo));
-
}
@Test
@@ -144,7 +141,6 @@ public class AgeFileFilterTest extends BaseFilterTest {
Assert.assertTrue(testee.accept(oldFileInfo));
Assert.assertTrue(testee.accept(currentFileInfo));
Assert.assertFalse(testee.accept(newFileInfo));
-
}
@Test
@@ -161,7 +157,6 @@ public class AgeFileFilterTest extends BaseFilterTest {
Assert.assertFalse(testee.accept(oldFileInfo));
Assert.assertFalse(testee.accept(currentFileInfo));
Assert.assertTrue(testee.accept(newFileInfo));
-
}
@Test
@@ -171,7 +166,6 @@ public class AgeFileFilterTest extends BaseFilterTest {
Assert.assertTrue(testee.accept(oldFileInfo));
Assert.assertTrue(testee.accept(currentFileInfo));
Assert.assertFalse(testee.accept(newFileInfo));
-
}
@Test
@@ -199,7 +193,6 @@ public class AgeFileFilterTest extends BaseFilterTest {
files = zipFileObj.findFiles(new FileFilterSelector(new AgeFileFilter(NOW_MILLIS, false)));
assertContains(files, newFile.getName());
Assert.assertEquals(1, files.length);
-
}
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/AndFileFilterTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/AndFileFilterTest.java
index cd059d9..203c4a1 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/AndFileFilterTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/AndFileFilterTest.java
@@ -16,6 +16,9 @@
*/
package org.apache.commons.vfs2.filter;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.io.File;
import java.util.ArrayList;
import java.util.List;
@@ -23,7 +26,6 @@ import java.util.List;
import org.apache.commons.vfs2.FileFilter;
import org.apache.commons.vfs2.FileSelectInfo;
import org.apache.commons.vfs2.FileSystemException;
-import org.junit.Assert;
import org.junit.jupiter.api.Test;
// CHECKSTYLE:OFF Test code
@@ -48,18 +50,17 @@ public class AndFileFilterTest extends BaseFilterTest {
final FileSelectInfo any = createFileSelectInfo(new File("anyfile"));
// Empty
- Assert.assertFalse(new AndFileFilter().accept(any));
+ assertFalse(new AndFileFilter().accept(any));
// True
- Assert.assertTrue(new AndFileFilter(new AlwaysTrueFileFilter()).accept(any));
- Assert.assertTrue(new AndFileFilter(new AlwaysTrueFileFilter(), new AlwaysTrueFileFilter()).accept(any));
+ assertTrue(new AndFileFilter(new AlwaysTrueFileFilter()).accept(any));
+ assertTrue(new AndFileFilter(new AlwaysTrueFileFilter(), new AlwaysTrueFileFilter()).accept(any));
// False
- Assert.assertFalse(new AndFileFilter(new AlwaysFalseFileFilter()).accept(any));
- Assert.assertFalse(new AndFileFilter(new AlwaysFalseFileFilter(), new AlwaysFalseFileFilter()).accept(any));
- Assert.assertFalse(new AndFileFilter(new AlwaysFalseFileFilter(), new AlwaysTrueFileFilter()).accept(any));
- Assert.assertFalse(new AndFileFilter(new AlwaysTrueFileFilter(), new AlwaysFalseFileFilter()).accept(any));
-
+ assertFalse(new AndFileFilter(new AlwaysFalseFileFilter()).accept(any));
+ assertFalse(new AndFileFilter(new AlwaysFalseFileFilter(), new AlwaysFalseFileFilter()).accept(any));
+ assertFalse(new AndFileFilter(new AlwaysFalseFileFilter(), new AlwaysTrueFileFilter()).accept(any));
+ assertFalse(new AndFileFilter(new AlwaysTrueFileFilter(), new AlwaysFalseFileFilter()).accept(any));
}
@Test
@@ -68,18 +69,17 @@ public class AndFileFilterTest extends BaseFilterTest {
final FileSelectInfo any = createFileSelectInfo(new File("anyfile"));
// Empty
- Assert.assertFalse(new AndFileFilter().accept(any));
+ assertFalse(new AndFileFilter().accept(any));
// True
- Assert.assertTrue(new AndFileFilter(new AlwaysTrueFileFilter()).accept(any));
- Assert.assertTrue(new AndFileFilter(new AlwaysTrueFileFilter(), new AlwaysTrueFileFilter()).accept(any));
+ assertTrue(new AndFileFilter(new AlwaysTrueFileFilter()).accept(any));
+ assertTrue(new AndFileFilter(new AlwaysTrueFileFilter(), new AlwaysTrueFileFilter()).accept(any));
// False
- Assert.assertFalse(new AndFileFilter(new AlwaysFalseFileFilter()).accept(any));
- Assert.assertFalse(new AndFileFilter(new AlwaysFalseFileFilter(), new AlwaysFalseFileFilter()).accept(any));
- Assert.assertFalse(new AndFileFilter(new AlwaysFalseFileFilter(), new AlwaysTrueFileFilter()).accept(any));
- Assert.assertFalse(new AndFileFilter(new AlwaysTrueFileFilter(), new AlwaysFalseFileFilter()).accept(any));
-
+ assertFalse(new AndFileFilter(new AlwaysFalseFileFilter()).accept(any));
+ assertFalse(new AndFileFilter(new AlwaysFalseFileFilter(), new AlwaysFalseFileFilter()).accept(any));
+ assertFalse(new AndFileFilter(new AlwaysFalseFileFilter(), new AlwaysTrueFileFilter()).accept(any));
+ assertFalse(new AndFileFilter(new AlwaysTrueFileFilter(), new AlwaysFalseFileFilter()).accept(any));
}
@Test
@@ -98,7 +98,6 @@ public class AndFileFilterTest extends BaseFilterTest {
// VERIFY
assertContainsOnly(testee.getFileFilters(), filter1, filter2, filter3);
-
}
@Test
@@ -114,7 +113,6 @@ public class AndFileFilterTest extends BaseFilterTest {
// VERIFY
assertContainsOnly(testee.getFileFilters(), filter1, filter2, filter3);
-
}
@Test
@@ -134,7 +132,6 @@ public class AndFileFilterTest extends BaseFilterTest {
// VERIFY
assertContainsOnly(testee.getFileFilters(), filter1, filter2, filter3);
-
}
@Test
@@ -151,7 +148,6 @@ public class AndFileFilterTest extends BaseFilterTest {
// VERIFY
assertContainsOnly(testee.getFileFilters(), filter1, filter3);
-
}
@Test
@@ -172,7 +168,6 @@ public class AndFileFilterTest extends BaseFilterTest {
// VERIFY
assertContainsOnly(testee.getFileFilters(), filter1, filter2, filter3);
-
}
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/BaseFilterTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/BaseFilterTest.java
index ff4112d..5925015 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/BaseFilterTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/BaseFilterTest.java
@@ -106,7 +106,6 @@ public abstract class BaseFilterTest {
return trimmedPath + trimmedFilename;
}
return trimmedPath + separator + trimmedFilename;
-
}
/**
@@ -201,7 +200,6 @@ public abstract class BaseFilterTest {
files = srcDir.listFiles(filter);
}
return files;
-
}
/**
@@ -281,7 +279,6 @@ public abstract class BaseFilterTest {
public static void zipDir(final File srcDir, final String destPath, final File destFile) throws IOException {
zipDir(srcDir, null, destPath, destFile);
-
}
/**
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/CanExecuteFileFilterTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/CanExecuteFileFilterTest.java
index 391330b..7465369 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/CanExecuteFileFilterTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/CanExecuteFileFilterTest.java
@@ -16,6 +16,9 @@
*/
package org.apache.commons.vfs2.filter;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.io.File;
import java.io.IOException;
@@ -23,7 +26,6 @@ import org.apache.commons.io.FileUtils;
import org.apache.commons.vfs2.FileObject;
import org.apache.commons.vfs2.FileSelectInfo;
import org.apache.commons.vfs2.FileSystemException;
-import org.junit.Assert;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Disabled;
@@ -78,7 +80,6 @@ public class CanExecuteFileFilterTest extends BaseFilterTest {
FileUtils.deleteDirectory(testDir);
testDir = null;
-
}
@BeforeAll
@@ -102,21 +103,20 @@ public class CanExecuteFileFilterTest extends BaseFilterTest {
zipFile = new File(getTempDir(), CanExecuteFileFilterTest.class.getName() + ".zip");
zipDir(testDir, "", zipFile);
zipFileObj = getZipFileObject(zipFile);
-
}
@Test
public void testAcceptCanExecute() throws FileSystemException {
- Assert.assertTrue(CanExecuteFileFilter.CAN_EXECUTE.accept(executableFileInfo));
- Assert.assertTrue(CanExecuteFileFilter.CAN_EXECUTE.accept(notExecutableFileInfo));
- Assert.assertFalse(CanExecuteFileFilter.CAN_EXECUTE.accept(notExistingFileInfo));
+ assertTrue(CanExecuteFileFilter.CAN_EXECUTE.accept(executableFileInfo));
+ assertTrue(CanExecuteFileFilter.CAN_EXECUTE.accept(notExecutableFileInfo));
+ assertFalse(CanExecuteFileFilter.CAN_EXECUTE.accept(notExistingFileInfo));
}
@Test
public void testAcceptCannotExecute() throws FileSystemException {
- Assert.assertFalse(CanExecuteFileFilter.CANNOT_EXECUTE.accept(executableFileInfo));
- Assert.assertFalse(CanExecuteFileFilter.CANNOT_EXECUTE.accept(notExecutableFileInfo));
- Assert.assertTrue(CanExecuteFileFilter.CANNOT_EXECUTE.accept(notExistingFileInfo));
+ assertFalse(CanExecuteFileFilter.CANNOT_EXECUTE.accept(executableFileInfo));
+ assertFalse(CanExecuteFileFilter.CANNOT_EXECUTE.accept(notExecutableFileInfo));
+ assertTrue(CanExecuteFileFilter.CANNOT_EXECUTE.accept(notExistingFileInfo));
}
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/CanReadFileFilterTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/CanReadFileFilterTest.java
index 4757341..7f90d44 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/CanReadFileFilterTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/CanReadFileFilterTest.java
@@ -77,7 +77,6 @@ public class CanReadFileFilterTest extends BaseFilterTest {
FileUtils.deleteDirectory(testDir);
testDir = null;
-
}
@BeforeAll
@@ -101,7 +100,6 @@ public class CanReadFileFilterTest extends BaseFilterTest {
zipFile = new File(getTempDir(), CanReadFileFilterTest.class.getName() + ".zip");
zipDir(testDir, "", zipFile);
zipFileObj = getZipFileObject(zipFile);
-
}
@Test
@@ -110,7 +108,6 @@ public class CanReadFileFilterTest extends BaseFilterTest {
Assert.assertFalse(CanReadFileFilter.CANNOT_READ.accept(writableFileInfo));
Assert.assertFalse(CanReadFileFilter.CANNOT_READ.accept(readOnlyFileInfo));
Assert.assertTrue(CanReadFileFilter.CANNOT_READ.accept(notExistingFileInfo));
-
}
@Test
@@ -119,7 +116,6 @@ public class CanReadFileFilterTest extends BaseFilterTest {
Assert.assertTrue(CanReadFileFilter.CAN_READ.accept(writableFileInfo));
Assert.assertTrue(CanReadFileFilter.CAN_READ.accept(readOnlyFileInfo));
Assert.assertFalse(CanReadFileFilter.CAN_READ.accept(notExistingFileInfo));
-
}
@Test
@@ -128,7 +124,6 @@ public class CanReadFileFilterTest extends BaseFilterTest {
Assert.assertFalse(CanReadFileFilter.READ_ONLY.accept(writableFileInfo));
Assert.assertTrue(CanReadFileFilter.READ_ONLY.accept(readOnlyFileInfo));
Assert.assertFalse(CanReadFileFilter.READ_ONLY.accept(notExistingFileInfo));
-
}
@Test
@@ -149,7 +144,6 @@ public class CanReadFileFilterTest extends BaseFilterTest {
files = zipFileObj.findFiles(new FileFilterSelector(CanReadFileFilter.READ_ONLY));
assertContains(files, READONLY, WRITABLE);
Assert.assertEquals(2, files.length);
-
}
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/CanWriteFileFilterTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/CanWriteFileFilterTest.java
index d2b1603..46bda39 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/CanWriteFileFilterTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/CanWriteFileFilterTest.java
@@ -77,7 +77,6 @@ public class CanWriteFileFilterTest extends BaseFilterTest {
FileUtils.deleteDirectory(testDir);
testDir = null;
-
}
@BeforeAll
@@ -101,7 +100,6 @@ public class CanWriteFileFilterTest extends BaseFilterTest {
zipFile = new File(getTempDir(), CanWriteFileFilterTest.class.getName() + ".zip");
zipDir(testDir, "", zipFile);
zipFileObj = getZipFileObject(zipFile);
-
}
@Test
@@ -110,7 +108,6 @@ public class CanWriteFileFilterTest extends BaseFilterTest {
Assert.assertFalse(CanWriteFileFilter.CANNOT_WRITE.accept(writableFileInfo));
Assert.assertTrue(CanWriteFileFilter.CANNOT_WRITE.accept(readOnlyFileInfo));
Assert.assertFalse(CanWriteFileFilter.CANNOT_WRITE.accept(notExistingFileInfo));
-
}
@Test
@@ -119,7 +116,6 @@ public class CanWriteFileFilterTest extends BaseFilterTest {
Assert.assertTrue(CanWriteFileFilter.CAN_WRITE.accept(writableFileInfo));
Assert.assertFalse(CanWriteFileFilter.CAN_WRITE.accept(readOnlyFileInfo));
Assert.assertTrue(CanWriteFileFilter.CAN_WRITE.accept(notExistingFileInfo));
-
}
@Test
@@ -135,7 +131,6 @@ public class CanWriteFileFilterTest extends BaseFilterTest {
files = zipFileObj.findFiles(new FileFilterSelector(CanWriteFileFilter.CANNOT_WRITE));
assertContains(files, READONLY, WRITABLE);
Assert.assertEquals(2, files.length);
-
}
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/DirectoryAndFileFilterTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/DirectoryAndFileFilterTest.java
index 473ff49..8c6a80f 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/DirectoryAndFileFilterTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/DirectoryAndFileFilterTest.java
@@ -78,7 +78,6 @@ public class DirectoryAndFileFilterTest extends BaseFilterTest {
FileUtils.deleteDirectory(testDir);
testDir = null;
-
}
@BeforeAll
@@ -101,7 +100,6 @@ public class DirectoryAndFileFilterTest extends BaseFilterTest {
zipFile = new File(getTempDir(), DirectoryAndFileFilterTest.class.getName() + ".zip");
zipDir(testDir, "", zipFile);
zipFileObj = getZipFileObject(zipFile);
-
}
@Test
@@ -128,7 +126,6 @@ public class DirectoryAndFileFilterTest extends BaseFilterTest {
files = zipFileObj.findFiles(new FileFilterSelector(DirectoryFileFilter.DIRECTORY));
assertContains(files, DIR);
Assert.assertEquals(1, files.length);
-
}
@Test
@@ -139,7 +136,6 @@ public class DirectoryAndFileFilterTest extends BaseFilterTest {
Assert.assertTrue(testee.accept(dirInfo));
Assert.assertFalse(testee.accept(fileInfo));
Assert.assertFalse(testee.accept(notExistingFileInfo));
-
}
@Test
@@ -150,7 +146,6 @@ public class DirectoryAndFileFilterTest extends BaseFilterTest {
Assert.assertTrue(testee.accept(fileInfo));
Assert.assertFalse(testee.accept(dirInfo));
Assert.assertFalse(testee.accept(notExistingFileInfo));
-
}
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/EmptyFileFilterTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/EmptyFileFilterTest.java
index c1646f0..6a6a677 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/EmptyFileFilterTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/EmptyFileFilterTest.java
@@ -113,7 +113,6 @@ public class EmptyFileFilterTest extends BaseFilterTest {
zipFile = new File(getTempDir(), EmptyFileFilterTest.class.getName() + ".zip");
zipDir(testDir, "", zipFile);
zipFileObj = getZipFileObject(zipFile);
-
}
@Test
@@ -126,7 +125,6 @@ public class EmptyFileFilterTest extends BaseFilterTest {
Assert.assertFalse(testee.accept(notEmptyDirInfo));
Assert.assertTrue(testee.accept(emptyDirInfo));
Assert.assertTrue(testee.accept(notExistingFileInfo));
-
}
@Test
@@ -139,7 +137,6 @@ public class EmptyFileFilterTest extends BaseFilterTest {
Assert.assertTrue(testee.accept(notEmptyDirInfo));
Assert.assertFalse(testee.accept(emptyDirInfo));
Assert.assertFalse(testee.accept(notExistingFileInfo));
-
}
@Test
@@ -155,7 +152,6 @@ public class EmptyFileFilterTest extends BaseFilterTest {
files = zipFileObj.findFiles(new FileFilterSelector(EmptyFileFilter.NOT_EMPTY));
assertContains(files, notEmptyFile.getName(), notEmptyDir.getName());
Assert.assertEquals(2, files.length);
-
}
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/HiddenFileFilterTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/HiddenFileFilterTest.java
index f3662c3..63ec076 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/HiddenFileFilterTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/HiddenFileFilterTest.java
@@ -93,7 +93,6 @@ public class HiddenFileFilterTest extends BaseFilterTest {
zipFile = new File(getTempDir(), HiddenFileFilterTest.class.getName() + ".zip");
zipDir(testDir, "", zipFile);
zipFileObj = getZipFileObject(zipFile);
-
}
@Test
@@ -105,7 +104,6 @@ public class HiddenFileFilterTest extends BaseFilterTest {
// TODO xxx In Java 6 there is no way to hide a file
// assertThat(testee.accept(hiddenFileInfo));
Assert.assertFalse(testee.accept(notExistingFileInfo));
-
}
@Test
@@ -117,7 +115,6 @@ public class HiddenFileFilterTest extends BaseFilterTest {
// TODO xxx In Java 6 there is no way to hide a file
// assertThat(testee.accept(hiddenFileInfo));
Assert.assertTrue(testee.accept(notExistingFileInfo));
-
}
@Test
@@ -135,7 +132,6 @@ public class HiddenFileFilterTest extends BaseFilterTest {
files = zipFileObj.findFiles(new FileFilterSelector(HiddenFileFilter.VISIBLE));
assertContains(files, visibleFile.getName());
Assert.assertEquals(1, files.length);
-
}
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/NameFileFilterTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/NameFileFilterTest.java
index 48ff73c..c487488 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/NameFileFilterTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/NameFileFilterTest.java
@@ -16,12 +16,13 @@
*/
package org.apache.commons.vfs2.filter;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.io.File;
import java.util.ArrayList;
import java.util.List;
-import org.apache.commons.vfs2.FileSystemException;
-import org.junit.Assert;
import org.junit.jupiter.api.Test;
/**
@@ -31,7 +32,7 @@ import org.junit.jupiter.api.Test;
public class NameFileFilterTest extends BaseFilterTest {
@Test
- public void testAcceptList() throws FileSystemException {
+ public void testAcceptList() {
// PREPARE
final List<String> list = new ArrayList<>();
@@ -40,15 +41,14 @@ public class NameFileFilterTest extends BaseFilterTest {
final NameFileFilter filter = new NameFileFilter(list);
// TEST
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test1.txt"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test2.txt"))));
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("Test2.txt"))));
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("test.xxx"))));
-
+ assertTrue(filter.accept(createFileSelectInfo(new File("test1.txt"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("test2.txt"))));
+ assertFalse(filter.accept(createFileSelectInfo(new File("Test2.txt"))));
+ assertFalse(filter.accept(createFileSelectInfo(new File("test.xxx"))));
}
@Test
- public void testAcceptListIOCaseInsensitive() throws FileSystemException {
+ public void testAcceptListIOCaseInsensitive() {
// PREPARE
final List<String> list = new ArrayList<>();
@@ -57,15 +57,14 @@ public class NameFileFilterTest extends BaseFilterTest {
final NameFileFilter filter = new NameFileFilter(IOCase.INSENSITIVE, list);
// TEST
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("TEST1.txt"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test2.txt"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("Test2.txt"))));
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("test.xxx"))));
-
+ assertTrue(filter.accept(createFileSelectInfo(new File("TEST1.txt"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("test2.txt"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("Test2.txt"))));
+ assertFalse(filter.accept(createFileSelectInfo(new File("test.xxx"))));
}
@Test
- public void testAcceptListIOCaseSensitive() throws FileSystemException {
+ public void testAcceptListIOCaseSensitive() {
// PREPARE
final List<String> list = new ArrayList<>();
@@ -74,53 +73,49 @@ public class NameFileFilterTest extends BaseFilterTest {
final NameFileFilter filter = new NameFileFilter(IOCase.SENSITIVE, list);
// TEST
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("TEST1.txt"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test2.txt"))));
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("Test2.txt"))));
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("test.xxx"))));
-
+ assertFalse(filter.accept(createFileSelectInfo(new File("TEST1.txt"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("test2.txt"))));
+ assertFalse(filter.accept(createFileSelectInfo(new File("Test2.txt"))));
+ assertFalse(filter.accept(createFileSelectInfo(new File("test.xxx"))));
}
@Test
- public void testAcceptString() throws FileSystemException {
+ public void testAcceptString() {
// PREPARE
final NameFileFilter filter = new NameFileFilter("test1.txt");
// TEST
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test1.txt"))));
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("test2.txt"))));
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("Test2.txt"))));
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("test.xxx"))));
-
+ assertTrue(filter.accept(createFileSelectInfo(new File("test1.txt"))));
+ assertFalse(filter.accept(createFileSelectInfo(new File("test2.txt"))));
+ assertFalse(filter.accept(createFileSelectInfo(new File("Test2.txt"))));
+ assertFalse(filter.accept(createFileSelectInfo(new File("test.xxx"))));
}
@Test
- public void testAcceptStringIOCaseInsensitive() throws FileSystemException {
+ public void testAcceptStringIOCaseInsensitive() {
// PREPARE
final NameFileFilter filter = new NameFileFilter(IOCase.INSENSITIVE, "test2.txt");
// TEST
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("test1.txt"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test2.txt"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("Test2.txt"))));
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("test.xxx"))));
-
+ assertFalse(filter.accept(createFileSelectInfo(new File("test1.txt"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("test2.txt"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("Test2.txt"))));
+ assertFalse(filter.accept(createFileSelectInfo(new File("test.xxx"))));
}
@Test
- public void testAcceptStringIOCaseSensitive() throws FileSystemException {
+ public void testAcceptStringIOCaseSensitive() {
// PREPARE
final NameFileFilter filter = new NameFileFilter(IOCase.SENSITIVE, "test2.txt");
// TEST
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("test1.txt"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test2.txt"))));
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("Test2.txt"))));
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("test.xxx"))));
-
+ assertFalse(filter.accept(createFileSelectInfo(new File("test1.txt"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("test2.txt"))));
+ assertFalse(filter.accept(createFileSelectInfo(new File("Test2.txt"))));
+ assertFalse(filter.accept(createFileSelectInfo(new File("test.xxx"))));
}
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/NotFileFilterTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/NotFileFilterTest.java
index 825a724..5ac219e 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/NotFileFilterTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/NotFileFilterTest.java
@@ -16,11 +16,13 @@
*/
package org.apache.commons.vfs2.filter;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.io.File;
import org.apache.commons.vfs2.FileSelectInfo;
import org.apache.commons.vfs2.FileSystemException;
-import org.junit.Assert;
import org.junit.jupiter.api.Test;
/**
@@ -35,12 +37,11 @@ public class NotFileFilterTest extends BaseFilterTest {
final FileSelectInfo any = createFileSelectInfo(new File("test1.txt"));
- Assert.assertFalse(new NotFileFilter(TrueFileFilter.INSTANCE).accept(any));
- Assert.assertFalse(new NotFileFilter(TrueFileFilter.TRUE).accept(any));
-
- Assert.assertTrue(new NotFileFilter(FalseFileFilter.INSTANCE).accept(any));
- Assert.assertTrue(new NotFileFilter(FalseFileFilter.FALSE).accept(any));
+ assertFalse(new NotFileFilter(TrueFileFilter.INSTANCE).accept(any));
+ assertFalse(new NotFileFilter(TrueFileFilter.TRUE).accept(any));
+ assertTrue(new NotFileFilter(FalseFileFilter.INSTANCE).accept(any));
+ assertTrue(new NotFileFilter(FalseFileFilter.FALSE).accept(any));
}
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/OrFileFilterTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/OrFileFilterTest.java
index eba90f9..573c10d 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/OrFileFilterTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/OrFileFilterTest.java
@@ -16,6 +16,9 @@
*/
package org.apache.commons.vfs2.filter;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.io.File;
import java.util.ArrayList;
import java.util.List;
@@ -23,7 +26,6 @@ import java.util.List;
import org.apache.commons.vfs2.FileFilter;
import org.apache.commons.vfs2.FileSelectInfo;
import org.apache.commons.vfs2.FileSystemException;
-import org.junit.Assert;
import org.junit.jupiter.api.Test;
// CHECKSTYLE:OFF Test code
@@ -47,18 +49,17 @@ public class OrFileFilterTest extends BaseFilterTest {
final FileSelectInfo any = createFileSelectInfo(new File("anyfile"));
// Empty
- Assert.assertFalse(new OrFileFilter().accept(any));
+ assertFalse(new OrFileFilter().accept(any));
// True
- Assert.assertTrue(new OrFileFilter(new AlwaysTrueFileFilter()).accept(any));
- Assert.assertTrue(new OrFileFilter(new AlwaysTrueFileFilter(), new AlwaysTrueFileFilter()).accept(any));
- Assert.assertTrue(new OrFileFilter(new AlwaysFalseFileFilter(), new AlwaysTrueFileFilter()).accept(any));
- Assert.assertTrue(new OrFileFilter(new AlwaysTrueFileFilter(), new AlwaysFalseFileFilter()).accept(any));
+ assertTrue(new OrFileFilter(new AlwaysTrueFileFilter()).accept(any));
+ assertTrue(new OrFileFilter(new AlwaysTrueFileFilter(), new AlwaysTrueFileFilter()).accept(any));
+ assertTrue(new OrFileFilter(new AlwaysFalseFileFilter(), new AlwaysTrueFileFilter()).accept(any));
+ assertTrue(new OrFileFilter(new AlwaysTrueFileFilter(), new AlwaysFalseFileFilter()).accept(any));
// False
- Assert.assertFalse(new OrFileFilter(new AlwaysFalseFileFilter()).accept(any));
- Assert.assertFalse(new OrFileFilter(new AlwaysFalseFileFilter(), new AlwaysFalseFileFilter()).accept(any));
-
+ assertFalse(new OrFileFilter(new AlwaysFalseFileFilter()).accept(any));
+ assertFalse(new OrFileFilter(new AlwaysFalseFileFilter(), new AlwaysFalseFileFilter()).accept(any));
}
@Test
@@ -77,7 +78,6 @@ public class OrFileFilterTest extends BaseFilterTest {
// VERIFY
assertContainsOnly(testee.getFileFilters(), filter1, filter2, filter3);
-
}
@Test
@@ -93,7 +93,6 @@ public class OrFileFilterTest extends BaseFilterTest {
// VERIFY
assertContainsOnly(testee.getFileFilters(), filter1, filter2, filter3);
-
}
@Test
@@ -113,7 +112,6 @@ public class OrFileFilterTest extends BaseFilterTest {
// VERIFY
assertContainsOnly(testee.getFileFilters(), filter1, filter2, filter3);
-
}
@Test
@@ -130,7 +128,6 @@ public class OrFileFilterTest extends BaseFilterTest {
// VERIFY
assertContainsOnly(testee.getFileFilters(), filter1, filter3);
-
}
@Test
@@ -151,7 +148,6 @@ public class OrFileFilterTest extends BaseFilterTest {
// VERIFY
assertContainsOnly(testee.getFileFilters(), filter1, filter2, filter3);
-
}
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/PrefixFileFilterTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/PrefixFileFilterTest.java
index c170314..e254890 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/PrefixFileFilterTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/PrefixFileFilterTest.java
@@ -16,12 +16,13 @@
*/
package org.apache.commons.vfs2.filter;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.io.File;
import java.util.ArrayList;
import java.util.List;
-import org.apache.commons.vfs2.FileSystemException;
-import org.junit.Assert;
import org.junit.jupiter.api.Test;
/**
@@ -31,7 +32,7 @@ import org.junit.jupiter.api.Test;
public class PrefixFileFilterTest extends BaseFilterTest {
@Test
- public void testAcceptList() throws FileSystemException {
+ public void testAcceptList() {
// PREPARE
final List<String> list = new ArrayList<>();
@@ -40,15 +41,14 @@ public class PrefixFileFilterTest extends BaseFilterTest {
final PrefixFileFilter filter = new PrefixFileFilter(list);
// TEST
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test1.txt"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test2.txt"))));
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("Test2.txt"))));
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("test.xxx"))));
-
+ assertTrue(filter.accept(createFileSelectInfo(new File("test1.txt"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("test2.txt"))));
+ assertFalse(filter.accept(createFileSelectInfo(new File("Test2.txt"))));
+ assertFalse(filter.accept(createFileSelectInfo(new File("test.xxx"))));
}
@Test
- public void testAcceptListIOCaseInsensitive() throws FileSystemException {
+ public void testAcceptListIOCaseInsensitive() {
// PREPARE
final List<String> list = new ArrayList<>();
@@ -57,15 +57,14 @@ public class PrefixFileFilterTest extends BaseFilterTest {
final PrefixFileFilter filter = new PrefixFileFilter(IOCase.INSENSITIVE, list);
// TEST
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("TEST1.txt"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test2.txt"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("Test2.txt"))));
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("test.xxx"))));
-
+ assertTrue(filter.accept(createFileSelectInfo(new File("TEST1.txt"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("test2.txt"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("Test2.txt"))));
+ assertFalse(filter.accept(createFileSelectInfo(new File("test.xxx"))));
}
@Test
- public void testAcceptListIOCaseSensitive() throws FileSystemException {
+ public void testAcceptListIOCaseSensitive() {
// PREPARE
final List<String> list = new ArrayList<>();
@@ -74,53 +73,49 @@ public class PrefixFileFilterTest extends BaseFilterTest {
final PrefixFileFilter filter = new PrefixFileFilter(IOCase.SENSITIVE, list);
// TEST
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("TEST1.txt"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test2.txt"))));
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("Test2.txt"))));
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("test.xxx"))));
-
+ assertFalse(filter.accept(createFileSelectInfo(new File("TEST1.txt"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("test2.txt"))));
+ assertFalse(filter.accept(createFileSelectInfo(new File("Test2.txt"))));
+ assertFalse(filter.accept(createFileSelectInfo(new File("test.xxx"))));
}
@Test
- public void testAcceptString() throws FileSystemException {
+ public void testAcceptString() {
// PREPARE
final PrefixFileFilter filter = new PrefixFileFilter("test");
// TEST
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test1.txt"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test2.txt"))));
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("Test2.txt"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test.xxx"))));
-
+ assertTrue(filter.accept(createFileSelectInfo(new File("test1.txt"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("test2.txt"))));
+ assertFalse(filter.accept(createFileSelectInfo(new File("Test2.txt"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("test.xxx"))));
}
@Test
- public void testAcceptStringIOCaseInsensitive() throws FileSystemException {
+ public void testAcceptStringIOCaseInsensitive() {
// PREPARE
final PrefixFileFilter filter = new PrefixFileFilter(IOCase.INSENSITIVE, "test");
// TEST
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test1.txt"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test2.txt"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("Test2.txt"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test.xxx"))));
-
+ assertTrue(filter.accept(createFileSelectInfo(new File("test1.txt"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("test2.txt"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("Test2.txt"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("test.xxx"))));
}
@Test
- public void testAcceptStringIOCaseSensitive() throws FileSystemException {
+ public void testAcceptStringIOCaseSensitive() {
// PREPARE
final PrefixFileFilter filter = new PrefixFileFilter(IOCase.SENSITIVE, "test");
// TEST
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test1.txt"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test2.txt"))));
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("Test2.txt"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test.xxx"))));
-
+ assertTrue(filter.accept(createFileSelectInfo(new File("test1.txt"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("test2.txt"))));
+ assertFalse(filter.accept(createFileSelectInfo(new File("Test2.txt"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("test.xxx"))));
}
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/RegexFileFilterTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/RegexFileFilterTest.java
index f20a375..0882e54 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/RegexFileFilterTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/RegexFileFilterTest.java
@@ -16,13 +16,15 @@
*/
package org.apache.commons.vfs2.filter;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.File;
import java.util.regex.Pattern;
import org.apache.commons.vfs2.FileFilter;
-import org.junit.Assert;
import org.junit.jupiter.api.Test;
/**
@@ -37,7 +39,7 @@ public class RegexFileFilterTest extends BaseFilterTest {
new RegexFileFilter((Pattern) null);
fail();
} catch (final IllegalArgumentException ex) {
- Assert.assertEquals(RegexFileFilter.PATTERN_IS_MISSING, ex.getMessage());
+ assertEquals(RegexFileFilter.PATTERN_IS_MISSING, ex.getMessage());
}
}
@@ -47,30 +49,29 @@ public class RegexFileFilterTest extends BaseFilterTest {
FileFilter filter;
filter = new RegexFileFilter("^.*[tT]est(-\\d+)?\\.java$");
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("Test.java"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test-10.java"))));
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("test-.java"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("Test.java"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("test-10.java"))));
+ assertFalse(filter.accept(createFileSelectInfo(new File("test-.java"))));
filter = new RegexFileFilter("^[Tt]est.java$");
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("Test.java"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test.java"))));
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("tEST.java"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("Test.java"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("test.java"))));
+ assertFalse(filter.accept(createFileSelectInfo(new File("tEST.java"))));
filter = new RegexFileFilter(Pattern.compile("^test.java$", Pattern.CASE_INSENSITIVE));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("Test.java"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test.java"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("tEST.java"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("Test.java"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("test.java"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("tEST.java"))));
filter = new RegexFileFilter("^test.java$", Pattern.CASE_INSENSITIVE);
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("Test.java"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test.java"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("tEST.java"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("Test.java"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("test.java"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("tEST.java"))));
filter = new RegexFileFilter("^test.java$", IOCase.INSENSITIVE);
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("Test.java"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test.java"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("tEST.java"))));
-
+ assertTrue(filter.accept(createFileSelectInfo(new File("Test.java"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("test.java"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("tEST.java"))));
}
@Test
@@ -79,7 +80,7 @@ public class RegexFileFilterTest extends BaseFilterTest {
new RegexFileFilter((String) null, IOCase.INSENSITIVE);
fail();
} catch (final IllegalArgumentException ex) {
- Assert.assertEquals(RegexFileFilter.PATTERN_IS_MISSING, ex.getMessage());
+ assertEquals(RegexFileFilter.PATTERN_IS_MISSING, ex.getMessage());
}
}
@@ -89,7 +90,7 @@ public class RegexFileFilterTest extends BaseFilterTest {
new RegexFileFilter((String) null);
fail();
} catch (final IllegalArgumentException ex) {
- Assert.assertEquals(RegexFileFilter.PATTERN_IS_MISSING, ex.getMessage());
+ assertEquals(RegexFileFilter.PATTERN_IS_MISSING, ex.getMessage());
}
}
@@ -99,7 +100,7 @@ public class RegexFileFilterTest extends BaseFilterTest {
new RegexFileFilter((String) null, Pattern.CASE_INSENSITIVE);
fail();
} catch (final IllegalArgumentException ex) {
- Assert.assertEquals(RegexFileFilter.PATTERN_IS_MISSING, ex.getMessage());
+ assertEquals(RegexFileFilter.PATTERN_IS_MISSING, ex.getMessage());
}
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/SizeFileFilterTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/SizeFileFilterTest.java
index 5b05a51..5803054 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/SizeFileFilterTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/SizeFileFilterTest.java
@@ -96,7 +96,6 @@ public class SizeFileFilterTest extends BaseFilterTest {
zipFile = new File(getTempDir(), SizeFileFilterTest.class.getName() + ".zip");
zipDir(testDir, "", zipFile);
zipFileObj = getZipFileObject(zipFile);
-
}
@Test
@@ -106,7 +105,6 @@ public class SizeFileFilterTest extends BaseFilterTest {
Assert.assertFalse(testee.accept(minFileInfo));
Assert.assertTrue(testee.accept(optFileInfo));
Assert.assertTrue(testee.accept(maxFileInfo));
-
}
@Test
@@ -123,7 +121,6 @@ public class SizeFileFilterTest extends BaseFilterTest {
Assert.assertTrue(testee.accept(minFileInfo));
Assert.assertFalse(testee.accept(optFileInfo));
Assert.assertFalse(testee.accept(maxFileInfo));
-
}
@Test
@@ -159,7 +156,6 @@ public class SizeFileFilterTest extends BaseFilterTest {
files = zipFileObj.findFiles(new FileFilterSelector(new SizeRangeFileFilter(4, 4)));
assertContains(files, optFile.getName());
Assert.assertEquals(1, files.length);
-
}
@Test
@@ -191,7 +187,6 @@ public class SizeFileFilterTest extends BaseFilterTest {
Assert.assertFalse(testee.accept(minFileInfo));
Assert.assertTrue(testee.accept(optFileInfo));
Assert.assertFalse(testee.accept(maxFileInfo));
-
}
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/SuffixFileFilterTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/SuffixFileFilterTest.java
index 2cf2d80..b13091f 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/SuffixFileFilterTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/SuffixFileFilterTest.java
@@ -16,12 +16,13 @@
*/
package org.apache.commons.vfs2.filter;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.io.File;
import java.util.ArrayList;
import java.util.List;
-import org.apache.commons.vfs2.FileSystemException;
-import org.junit.Assert;
import org.junit.jupiter.api.Test;
/**
@@ -31,7 +32,7 @@ import org.junit.jupiter.api.Test;
public class SuffixFileFilterTest extends BaseFilterTest {
@Test
- public void testAcceptList() throws FileSystemException {
+ public void testAcceptList() {
// PREPARE
final List<String> list = new ArrayList<>();
@@ -40,15 +41,14 @@ public class SuffixFileFilterTest extends BaseFilterTest {
final SuffixFileFilter filter = new SuffixFileFilter(list);
// TEST
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test1.txt"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test2.bin"))));
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("test2.BIN"))));
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("test.xxx"))));
-
+ assertTrue(filter.accept(createFileSelectInfo(new File("test1.txt"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("test2.bin"))));
+ assertFalse(filter.accept(createFileSelectInfo(new File("test2.BIN"))));
+ assertFalse(filter.accept(createFileSelectInfo(new File("test.xxx"))));
}
@Test
- public void testAcceptListIOCaseInsensitive() throws FileSystemException {
+ public void testAcceptListIOCaseInsensitive() {
// PREPARE
final List<String> list = new ArrayList<>();
@@ -57,15 +57,14 @@ public class SuffixFileFilterTest extends BaseFilterTest {
final SuffixFileFilter filter = new SuffixFileFilter(IOCase.INSENSITIVE, list);
// TEST
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("TEST1.txt"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test2.bin"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test2.TXT"))));
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("test.xxx"))));
-
+ assertTrue(filter.accept(createFileSelectInfo(new File("TEST1.txt"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("test2.bin"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("test2.TXT"))));
+ assertFalse(filter.accept(createFileSelectInfo(new File("test.xxx"))));
}
@Test
- public void testAcceptListIOCaseSensitive() throws FileSystemException {
+ public void testAcceptListIOCaseSensitive() {
// PREPARE
final List<String> list = new ArrayList<>();
@@ -74,53 +73,49 @@ public class SuffixFileFilterTest extends BaseFilterTest {
final SuffixFileFilter filter = new SuffixFileFilter(IOCase.SENSITIVE, list);
// TEST
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("test1.Txt"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test2.txt"))));
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("test2.BIN"))));
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("test.xxx"))));
-
+ assertFalse(filter.accept(createFileSelectInfo(new File("test1.Txt"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("test2.txt"))));
+ assertFalse(filter.accept(createFileSelectInfo(new File("test2.BIN"))));
+ assertFalse(filter.accept(createFileSelectInfo(new File("test.xxx"))));
}
@Test
- public void testAcceptString() throws FileSystemException {
+ public void testAcceptString() {
// PREPARE
final SuffixFileFilter filter = new SuffixFileFilter(".txt", ".xxx");
// TEST
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test1.txt"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test2.txt"))));
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("test2.TXT"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test.xxx"))));
-
+ assertTrue(filter.accept(createFileSelectInfo(new File("test1.txt"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("test2.txt"))));
+ assertFalse(filter.accept(createFileSelectInfo(new File("test2.TXT"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("test.xxx"))));
}
@Test
- public void testAcceptStringIOCaseInsensitive() throws FileSystemException {
+ public void testAcceptStringIOCaseInsensitive() {
// PREPARE
final SuffixFileFilter filter = new SuffixFileFilter(IOCase.INSENSITIVE, ".txt", ".xxx");
// TEST
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test1.txt"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test2.txt"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test2.TXT"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test.xxx"))));
-
+ assertTrue(filter.accept(createFileSelectInfo(new File("test1.txt"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("test2.txt"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("test2.TXT"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("test.xxx"))));
}
@Test
- public void testAcceptStringIOCaseSensitive() throws FileSystemException {
+ public void testAcceptStringIOCaseSensitive() {
// PREPARE
final SuffixFileFilter filter = new SuffixFileFilter(IOCase.SENSITIVE, ".txt", ".xxx");
// TEST
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test1.txt"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test2.txt"))));
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("test2.TXT"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test.xxx"))));
-
+ assertTrue(filter.accept(createFileSelectInfo(new File("test1.txt"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("test2.txt"))));
+ assertFalse(filter.accept(createFileSelectInfo(new File("test2.TXT"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("test.xxx"))));
}
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/SymbolicLinkFileFilterTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/SymbolicLinkFileFilterTest.java
index 80dfdfc..00b0a0a 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/SymbolicLinkFileFilterTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/SymbolicLinkFileFilterTest.java
@@ -16,6 +16,11 @@
*/
package org.apache.commons.vfs2.filter;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assumptions.assumeTrue;
+
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
@@ -26,8 +31,6 @@ import org.apache.commons.vfs2.FileFilterSelector;
import org.apache.commons.vfs2.FileObject;
import org.apache.commons.vfs2.FileSelectInfo;
import org.apache.commons.vfs2.FileSystemException;
-import org.junit.Assert;
-import org.junit.Assume;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@@ -92,7 +95,7 @@ public class SymbolicLinkFileFilterTest extends BaseFilterTest {
@BeforeAll
public static void beforeClass() throws IOException {
- Assume.assumeTrue(Boolean.getBoolean(SymbolicLinkFileFilterTest.class.getSimpleName() + ".Enable"));
+ assumeTrue(Boolean.getBoolean(SymbolicLinkFileFilterTest.class.getSimpleName() + ".Enable"));
testDir = getTestDir(SymbolicLinkFileFilterTest.class.getName());
testDir.mkdir();
@@ -118,23 +121,23 @@ public class SymbolicLinkFileFilterTest extends BaseFilterTest {
@Test
public void testAcceptActual() throws FileSystemException {
final FileFilter testee = SymbolicLinkFileFilter.ACTUAL;
- Assert.assertTrue(targetFileInfo.getBaseFolder().exists());
- Assert.assertTrue(targetFileInfo.getFile().exists());
- Assert.assertTrue(targetFileInfo.toString(), testee.accept(targetFileInfo));
- Assert.assertTrue(notExistingFileInfo.toString(), testee.accept(notExistingFileInfo));
+ assertTrue(targetFileInfo.getBaseFolder().exists());
+ assertTrue(targetFileInfo.getFile().exists());
+ assertTrue(testee.accept(targetFileInfo), targetFileInfo.toString());
+ assertTrue(testee.accept(notExistingFileInfo), notExistingFileInfo.toString());
}
@Test
public void testAcceptSymbolic() throws FileSystemException {
final FileFilter testee = SymbolicLinkFileFilter.SYMBOLIC;
- Assert.assertTrue(linkFileInfo.toString(), testee.accept(linkFileInfo));
- Assert.assertFalse(notExistingFileInfo.toString(), testee.accept(notExistingFileInfo));
+ assertTrue(testee.accept(linkFileInfo), linkFileInfo.toString());
+ assertFalse(testee.accept(notExistingFileInfo), notExistingFileInfo.toString());
}
@Test
public void testZipFile() throws FileSystemException {
final FileObject[] files = zipFileObject.findFiles(new FileFilterSelector(SymbolicLinkFileFilter.SYMBOLIC));
- Assert.assertEquals(0, files.length);
+ assertEquals(0, files.length);
}
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/WildcardFileFilterTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/WildcardFileFilterTest.java
index fdad241..a61b990 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/WildcardFileFilterTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/WildcardFileFilterTest.java
@@ -16,12 +16,13 @@
*/
package org.apache.commons.vfs2.filter;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.io.File;
import java.util.ArrayList;
import java.util.List;
-import org.apache.commons.vfs2.FileSystemException;
-import org.junit.Assert;
import org.junit.jupiter.api.Test;
/**
@@ -31,7 +32,7 @@ import org.junit.jupiter.api.Test;
public class WildcardFileFilterTest extends BaseFilterTest {
@Test
- public void testAcceptList() throws FileSystemException {
+ public void testAcceptList() {
// PREPARE
final List<String> list = new ArrayList<>();
@@ -40,22 +41,21 @@ public class WildcardFileFilterTest extends BaseFilterTest {
final WildcardFileFilter filter = new WildcardFileFilter(list);
// TEST
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test1.txt"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test2.txt"))));
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("test.a"))));
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("test.ab"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test.abc"))));
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("test.ABC"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test.aaa"))));
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("test.Aaa"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test.aAA"))));
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("test.abcd"))));
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("test.xxx"))));
-
+ assertTrue(filter.accept(createFileSelectInfo(new File("test1.txt"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("test2.txt"))));
+ assertFalse(filter.accept(createFileSelectInfo(new File("test.a"))));
+ assertFalse(filter.accept(createFileSelectInfo(new File("test.ab"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("test.abc"))));
+ assertFalse(filter.accept(createFileSelectInfo(new File("test.ABC"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("test.aaa"))));
+ assertFalse(filter.accept(createFileSelectInfo(new File("test.Aaa"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("test.aAA"))));
+ assertFalse(filter.accept(createFileSelectInfo(new File("test.abcd"))));
+ assertFalse(filter.accept(createFileSelectInfo(new File("test.xxx"))));
}
@Test
- public void testAcceptListIOCaseInsensitive() throws FileSystemException {
+ public void testAcceptListIOCaseInsensitive() {
// PREPARE
final List<String> list = new ArrayList<>();
@@ -64,22 +64,21 @@ public class WildcardFileFilterTest extends BaseFilterTest {
final WildcardFileFilter filter = new WildcardFileFilter(IOCase.INSENSITIVE, list);
// TEST
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test1.txt"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test2.txt"))));
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("test.a"))));
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("test.ab"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test.abc"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test.ABC"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test.aaa"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test.Aaa"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test.aAA"))));
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("test.abcd"))));
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("test.xxx"))));
-
+ assertTrue(filter.accept(createFileSelectInfo(new File("test1.txt"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("test2.txt"))));
+ assertFalse(filter.accept(createFileSelectInfo(new File("test.a"))));
+ assertFalse(filter.accept(createFileSelectInfo(new File("test.ab"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("test.abc"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("test.ABC"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("test.aaa"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("test.Aaa"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("test.aAA"))));
+ assertFalse(filter.accept(createFileSelectInfo(new File("test.abcd"))));
+ assertFalse(filter.accept(createFileSelectInfo(new File("test.xxx"))));
}
@Test
- public void testAcceptListIOCaseSensitive() throws FileSystemException {
+ public void testAcceptListIOCaseSensitive() {
// PREPARE
final List<String> list = new ArrayList<>();
@@ -88,81 +87,77 @@ public class WildcardFileFilterTest extends BaseFilterTest {
final WildcardFileFilter filter = new WildcardFileFilter(IOCase.SENSITIVE, list);
// TEST
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test1.txt"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test2.txt"))));
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("test.a"))));
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("test.ab"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test.abc"))));
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("test.ABC"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test.aaa"))));
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("test.Aaa"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test.aAA"))));
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("test.abcd"))));
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("test.xxx"))));
-
+ assertTrue(filter.accept(createFileSelectInfo(new File("test1.txt"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("test2.txt"))));
+ assertFalse(filter.accept(createFileSelectInfo(new File("test.a"))));
+ assertFalse(filter.accept(createFileSelectInfo(new File("test.ab"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("test.abc"))));
+ assertFalse(filter.accept(createFileSelectInfo(new File("test.ABC"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("test.aaa"))));
+ assertFalse(filter.accept(createFileSelectInfo(new File("test.Aaa"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("test.aAA"))));
+ assertFalse(filter.accept(createFileSelectInfo(new File("test.abcd"))));
+ assertFalse(filter.accept(createFileSelectInfo(new File("test.xxx"))));
}
@Test
- public void testAcceptString() throws FileSystemException {
+ public void testAcceptString() {
// PREPARE
final WildcardFileFilter filter = new WildcardFileFilter("*.txt", "*.a??");
// TEST
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test1.txt"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test2.txt"))));
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("test.a"))));
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("test.ab"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test.abc"))));
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("test.ABC"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test.aaa"))));
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("test.Aaa"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test.aAA"))));
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("test.abcd"))));
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("test.xxx"))));
-
+ assertTrue(filter.accept(createFileSelectInfo(new File("test1.txt"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("test2.txt"))));
+ assertFalse(filter.accept(createFileSelectInfo(new File("test.a"))));
+ assertFalse(filter.accept(createFileSelectInfo(new File("test.ab"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("test.abc"))));
+ assertFalse(filter.accept(createFileSelectInfo(new File("test.ABC"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("test.aaa"))));
+ assertFalse(filter.accept(createFileSelectInfo(new File("test.Aaa"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("test.aAA"))));
+ assertFalse(filter.accept(createFileSelectInfo(new File("test.abcd"))));
+ assertFalse(filter.accept(createFileSelectInfo(new File("test.xxx"))));
}
@Test
- public void testAcceptStringIOCaseInsensitive() throws FileSystemException {
+ public void testAcceptStringIOCaseInsensitive() {
// PREPARE
final WildcardFileFilter filter = new WildcardFileFilter(IOCase.INSENSITIVE, "*.txt", "*.a??");
// TEST
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test1.txt"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test2.txt"))));
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("test.a"))));
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("test.ab"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test.abc"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test.ABC"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test.aaa"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test.Aaa"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test.aAA"))));
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("test.abcd"))));
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("test.xxx"))));
-
+ assertTrue(filter.accept(createFileSelectInfo(new File("test1.txt"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("test2.txt"))));
+ assertFalse(filter.accept(createFileSelectInfo(new File("test.a"))));
+ assertFalse(filter.accept(createFileSelectInfo(new File("test.ab"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("test.abc"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("test.ABC"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("test.aaa"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("test.Aaa"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("test.aAA"))));
+ assertFalse(filter.accept(createFileSelectInfo(new File("test.abcd"))));
+ assertFalse(filter.accept(createFileSelectInfo(new File("test.xxx"))));
}
@Test
- public void testAcceptStringIOCaseSensitive() throws FileSystemException {
+ public void testAcceptStringIOCaseSensitive() {
// PREPARE
final WildcardFileFilter filter = new WildcardFileFilter(IOCase.SENSITIVE, "*.txt", "*.a??");
// TEST
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test1.txt"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test2.txt"))));
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("test.a"))));
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("test.ab"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test.abc"))));
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("test.ABC"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test.aaa"))));
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("test.Aaa"))));
- Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test.aAA"))));
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("test.abcd"))));
- Assert.assertFalse(filter.accept(createFileSelectInfo(new File("test.xxx"))));
-
+ assertTrue(filter.accept(createFileSelectInfo(new File("test1.txt"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("test2.txt"))));
+ assertFalse(filter.accept(createFileSelectInfo(new File("test.a"))));
+ assertFalse(filter.accept(createFileSelectInfo(new File("test.ab"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("test.abc"))));
+ assertFalse(filter.accept(createFileSelectInfo(new File("test.ABC"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("test.aaa"))));
+ assertFalse(filter.accept(createFileSelectInfo(new File("test.Aaa"))));
+ assertTrue(filter.accept(createFileSelectInfo(new File("test.aAA"))));
+ assertFalse(filter.accept(createFileSelectInfo(new File("test.abcd"))));
+ assertFalse(filter.accept(createFileSelectInfo(new File("test.xxx"))));
}
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/function/VfsConsumerTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/function/VfsConsumerTest.java
index 4f4aece..59f0017 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/function/VfsConsumerTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/function/VfsConsumerTest.java
@@ -43,4 +43,5 @@ public class VfsConsumerTest {
consumer.accept(fileObject);
}
}
+
}
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 643dce1..448824c 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
@@ -17,10 +17,10 @@
package org.apache.commons.vfs2.impl;
import static org.apache.commons.vfs2.VfsTestUtils.getTestDirectoryFile;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.File;
import java.io.IOException;
@@ -106,7 +106,7 @@ public class DefaultFileMonitorTest {
private void deleteTestFileIfPresent() {
if (testFile != null && testFile.exists()) {
final boolean deleted = testFile.delete();
- assertTrue(testFile.toString(), deleted);
+ assertTrue(deleted, testFile.toString());
}
}
@@ -138,7 +138,7 @@ public class DefaultFileMonitorTest {
monitor.start();
writeToFile(testFile);
Thread.sleep(DELAY_MILLIS * 3);
- assertEquals("Created event is only fired once", 1, listener.created.get());
+ assertEquals(1, listener.created.get(), "Created event is only fired once");
}
}
}
@@ -180,8 +180,8 @@ public class DefaultFileMonitorTest {
writeToFile(testFile);
Thread.sleep(DELAY_MILLIS * 10);
- assertEquals("The listener of the active monitor received one created event", 1, activeListener.created.get());
- assertEquals("The listener of the stopped monitor received no events", 0, stoppedListener.created.get());
+ 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");
}
}
}
@@ -217,7 +217,7 @@ public class DefaultFileMonitorTest {
Thread.sleep(DELAY_MILLIS * 5);
testFile.delete();
Thread.sleep(DELAY_MILLIS * 30);
- assertNull("Event should not have occurred", getStatus(PeekLocation.LAST));
+ assertNull(getStatus(PeekLocation.LAST), "Event should not have occurred");
}
}
}
@@ -287,7 +287,7 @@ public class DefaultFileMonitorTest {
Thread.sleep(DELAY_MILLIS * 10);
final long valueMillis = System.currentTimeMillis();
final boolean rcMillis = testFile.setLastModified(valueMillis);
- assertTrue("setLastModified succeeded", rcMillis);
+ assertTrue(rcMillis, "setLastModified succeeded");
waitFor(Status.CHANGED, DELAY_MILLIS * 5, PeekLocation.LAST);
}
}
@@ -354,8 +354,8 @@ public class DefaultFileMonitorTest {
return;
}
}
- assertNotNull("No event occurred", getStatus(peekLocation));
- assertEquals("Incorrect event " + getStatus(peekLocation), expected, getStatus(peekLocation));
+ assertNotNull(getStatus(peekLocation), "No event occurred");
+ assertEquals(expected, getStatus(peekLocation), "Incorrect event " + getStatus(peekLocation));
}
private void writeToFile(final File file) throws IOException {
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 0dd9289..e64ac00 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
@@ -16,6 +16,13 @@
*/
package org.apache.commons.vfs2.impl;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.io.File;
import java.nio.file.Paths;
@@ -32,13 +39,10 @@ import org.apache.commons.vfs2.provider.gzip.GzipFileObject;
import org.apache.commons.vfs2.provider.jar.JarFileObject;
import org.apache.commons.vfs2.provider.ram.RamFileProvider;
import org.apache.commons.vfs2.provider.zip.ZipFileObject;
-import org.junit.Assert;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
-import static org.junit.jupiter.api.Assertions.assertThrows;
-
/**
* Tests {@link DefaultFileSystemManager}.
*
@@ -57,8 +61,8 @@ public class DefaultFileSystemManagerTest {
VFS.setManager(fileSystemManager);
VFS.setManager(null);
}
- Assert.assertNotNull(VFS.getManager());
- Assert.assertFalse(VFS.getManager().resolveFile(Paths.get("DoesNotExist.not").toUri()).exists());
+ assertNotNull(VFS.getManager());
+ assertFalse(VFS.getManager().resolveFile(Paths.get("DoesNotExist.not").toUri()).exists());
}
@Test
@@ -70,17 +74,17 @@ public class DefaultFileSystemManagerTest {
final RamFileProvider provider = Mockito.spy(new RamFileProvider());
fileSystemManager.addProvider("ram1", provider);
fileSystemManager.addProvider("ram2", provider);
- Assert.assertNotNull(fileSystemManager.resolveFile("ram1:///"));
- Assert.assertNotNull(fileSystemManager.resolveFile("ram2:///"));
+ assertNotNull(fileSystemManager.resolveFile("ram1:///"));
+ assertNotNull(fileSystemManager.resolveFile("ram2:///"));
fileSystemManager.removeProvider("ram1");
Mockito.verify(provider, Mockito.never()).close();
- Assert.assertThrows(FileSystemException.class, () -> fileSystemManager.resolveFile("ram1:///"));
- Assert.assertNotNull(fileSystemManager.resolveFile("ram2:///"));
+ assertThrows(FileSystemException.class, () -> fileSystemManager.resolveFile("ram1:///"));
+ assertNotNull(fileSystemManager.resolveFile("ram2:///"));
fileSystemManager.removeProvider("ram2");
Mockito.verify(provider).close();
- Assert.assertThrows(FileSystemException.class, () -> fileSystemManager.resolveFile("ram2:///"));
+ assertThrows(FileSystemException.class, () -> fileSystemManager.resolveFile("ram2:///"));
}
}
@@ -93,7 +97,7 @@ public class DefaultFileSystemManagerTest {
final FileSystemManager manager = VFS.getManager();
try (FileObject localFileObject = manager.resolveFile(new File(path).getAbsolutePath());
FileObject fileObject = manager.createFileSystem(localFileObject)) {
- Assert.assertEquals(clazz, fileObject.getClass());
+ assertEquals(clazz, fileObject.getClass());
}
}
@@ -116,17 +120,17 @@ public class DefaultFileSystemManagerTest {
@Test
public void testFileCacheEmptyAfterManagerClose() throws FileSystemException {
final FileSystemManager manager = VFS.getManager();
- Assert.assertNotNull(manager);
+ assertNotNull(manager);
try (FileObject fileObject = manager
.resolveFile(Paths.get("src/test/resources/test-data/read-tests/file1.txt").toUri())) {
- Assert.assertTrue(fileObject.exists());
+ assertTrue(fileObject.exists());
final FilesCache filesCache = manager.getFilesCache();
final FileName name = fileObject.getName();
// Make sure we have file object in the cache.
- Assert.assertNotNull(filesCache.getFile(fileObject.getFileSystem(), name));
+ assertNotNull(filesCache.getFile(fileObject.getFileSystem(), name));
manager.close();
// Cache MUST now be empty.
- Assert.assertNull(filesCache.getFile(fileObject.getFileSystem(), name));
+ assertNull(filesCache.getFile(fileObject.getFileSystem(), name));
} finally {
// Makes sure we reset the singleton or other tests will fail.
VFS.close();
@@ -136,17 +140,17 @@ public class DefaultFileSystemManagerTest {
@Test
public void testFileCacheEmptyAfterVFSClose() throws FileSystemException {
final FileSystemManager manager = VFS.getManager();
- Assert.assertNotNull(manager);
+ assertNotNull(manager);
try (FileObject fileObject = manager
.resolveFile(Paths.get("src/test/resources/test-data/read-tests/file1.txt").toUri())) {
- Assert.assertTrue(fileObject.exists());
+ assertTrue(fileObject.exists());
final FilesCache filesCache = manager.getFilesCache();
final FileName name = fileObject.getName();
// Make sure we have file object in the cache.
- Assert.assertNotNull(filesCache.getFile(fileObject.getFileSystem(), name));
+ assertNotNull(filesCache.getFile(fileObject.getFileSystem(), name));
VFS.close();
// Cache MUST now be empty.
- Assert.assertNull(filesCache.getFile(fileObject.getFileSystem(), name));
+ assertNull(filesCache.getFile(fileObject.getFileSystem(), name));
}
}
@@ -187,4 +191,5 @@ public class DefaultFileSystemManagerTest {
public void testResolveFileRelativeThrows() {
assertThrows(NullPointerException.class, () -> VFS.getManager().resolveFile((File) null, "relativePath"));
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/StandardFileSystemManagerTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/StandardFileSystemManagerTest.java
index cee1e5e..6f2a1e7 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/StandardFileSystemManagerTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/StandardFileSystemManagerTest.java
@@ -16,12 +16,14 @@
*/
package org.apache.commons.vfs2.impl;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
import java.nio.file.Paths;
import org.apache.commons.vfs2.FileSystemException;
import org.apache.commons.vfs2.FileSystemManager;
import org.apache.commons.vfs2.VFS;
-import org.junit.Assert;
import org.junit.jupiter.api.Test;
/**
@@ -42,8 +44,8 @@ public class StandardFileSystemManagerTest {
VFS.setManager(fileSystemManager);
VFS.setManager(null);
}
- Assert.assertNotNull(VFS.getManager());
- Assert.assertFalse(VFS.getManager().resolveFile(Paths.get("DoesNotExist.not").toUri()).exists());
+ assertNotNull(VFS.getManager());
+ assertFalse(VFS.getManager().resolveFile(Paths.get("DoesNotExist.not").toUri()).exists());
}
}
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 aa231a3..5f9bc53 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
@@ -19,7 +19,6 @@ package org.apache.commons.vfs2.impl;
import static org.apache.commons.vfs2.VfsTestUtils.getTestDirectoryFile;
import java.io.File;
-import java.io.IOException;
import java.net.URL;
import java.net.URLConnection;
import java.util.Collections;
@@ -56,8 +55,8 @@ public class VfsClassLoaderTests extends AbstractProviderTestCase {
* This method will not return any hit to VFSClassLoader#testGetResourcesJARs.
*/
@Override
- public Enumeration<URL> getResources(final String name) throws IOException {
- return Collections.enumeration(Collections.<URL>emptyList());
+ public Enumeration<URL> getResources(final String name) {
+ return Collections.enumeration(Collections.emptyList());
}
}
@@ -226,4 +225,5 @@ public class VfsClassLoaderTests extends AbstractProviderTestCase {
assertFalse(pack.isSealed());
}
}
+
}
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 182a2e2..8ed3216 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
@@ -16,10 +16,10 @@
*/
package org.apache.commons.vfs2.operations;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import java.io.File;
import java.util.Collection;
@@ -56,13 +56,13 @@ public class BasicOperationsTest {
@Override
public void setContext(final VfsComponentContext context) {
- assertNotNull("setContext", context);
+ assertNotNull(context, "setContext");
ops |= 2;
}
@Override
public void setLogger(final Log logger) {
- assertNotNull("setLogger", logger);
+ assertNotNull(logger, "setLogger");
ops |= 1;
}
}
@@ -80,16 +80,16 @@ public class BasicOperationsTest {
@Override
public void collectOperations(final Collection<Class<? extends FileOperation>> operationsList,
final FileObject file) throws FileSystemException {
- assertNotNull("collect operationsList", operationsList);
- assertNotNull("collect file", file);
+ 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 object", file);
- assertNotNull("operationclass", operationClass);
+ assertNotNull(file, "file object");
+ assertNotNull(operationClass, "operationclass");
ops |= 32;
return null;
}
@@ -136,7 +136,7 @@ public class BasicOperationsTest {
manager.addOperationProvider("file", myop);
assertEquals(7, myop.ops);
manager.close();
- assertEquals("close() not called", 15, myop.ops); // VFS-577
+ assertEquals(15, myop.ops, "close() not called"); // VFS-577
// fixture will close again
}
@@ -151,7 +151,7 @@ public class BasicOperationsTest {
final MyFileOprationProviderBase myop = new MyFileOperationProviderNoncomp();
manager.addOperationProvider("file", myop);
final FileOperationProvider[] ops = manager.getOperationProviders("file");
- assertSame("exactly one provider registered", 1, ops.length);
+ assertSame(1, ops.length, "exactly one provider registered");
assertSame(myop, ops[0]);
assertEquals(0, myop.ops); // collect not invoked
}
@@ -171,7 +171,7 @@ public class BasicOperationsTest {
assertNotNull(ops);
final Class<? extends FileOperation>[] oparray = ops.getOperations();
- assertSame("no ops should be found", 0, oparray.length);
+ assertSame(0, oparray.length, "no ops should be found");
assertSame(16, myop.ops); // collect
}
@@ -189,12 +189,9 @@ public class BasicOperationsTest {
final FileOperations ops = fo.getFileOperations();
assertNotNull(ops);
- try {
- final FileOperation logop = ops.getOperation(VcsLog.class);
- fail("Must throw but returned " + logop);
- } catch (final FileSystemException e) {
- assertEquals("vfs.operation/operation-not-supported.error", e.getCode());
- }
+ FileSystemException thrown = assertThrows(FileSystemException.class, () -> ops.getOperation(VcsLog.class));
+ assertEquals("vfs.operation/operation-not-supported.error", thrown.getCode());
assertSame(32, myop.ops); // getOperation was called
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/perf/FileNamePerformance.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/perf/FileNamePerformance.java
index 4093fa9..428e9bb 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/perf/FileNamePerformance.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/perf/FileNamePerformance.java
@@ -23,6 +23,7 @@ import org.apache.commons.vfs2.FileSystemManager;
import org.apache.commons.vfs2.VFS;
public class FileNamePerformance {
+
private final static int NUOF_RESOLVES = 100000;
public static void main(final String[] args) throws FileSystemException {
@@ -84,4 +85,5 @@ public class FileNamePerformance {
System.err.println("time to resolve " + NUOF_RESOLVES + " names: " + (endMillis - startMillis) + " milliseconds");
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/AbstractFileNameTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/AbstractFileNameTest.java
index 3d91fd0..ebb82ad 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/AbstractFileNameTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/AbstractFileNameTest.java
@@ -16,9 +16,10 @@
*/
package org.apache.commons.vfs2.provider;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
import org.apache.commons.vfs2.FileName;
import org.apache.commons.vfs2.FileType;
-import org.junit.Assert;
import org.junit.jupiter.api.Test;
public class AbstractFileNameTest {
@@ -39,7 +40,8 @@ public class AbstractFileNameTest {
}
};
- Assert.assertEquals("pass/foo/bar/file%23name.txt", fileName.getURI());
- Assert.assertEquals("/foo/bar/file%23name.txt", fileName.getFriendlyURI());
+ assertEquals("pass/foo/bar/file%23name.txt", fileName.getURI());
+ assertEquals("/foo/bar/file%23name.txt", fileName.getFriendlyURI());
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/DefaultFileContentTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/DefaultFileContentTest.java
index 7922123..d76e0bb 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/DefaultFileContentTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/DefaultFileContentTest.java
@@ -16,6 +16,11 @@
*/
package org.apache.commons.vfs2.provider;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.io.Closeable;
import java.io.File;
import java.io.IOException;
@@ -31,11 +36,8 @@ import org.apache.commons.vfs2.FileContent;
import org.apache.commons.vfs2.FileObject;
import org.apache.commons.vfs2.FileSystemManager;
import org.apache.commons.vfs2.VFS;
-import org.junit.Assert;
import org.junit.jupiter.api.Test;
-import static org.junit.jupiter.api.Assertions.assertThrows;
-
/**
* {@code DefaultFileContentTest} tests for bug-VFS-614. This bug involves the stream implementation closing the stream
* after reading to the end of the buffer, which broke marking.
@@ -53,11 +55,11 @@ public class DefaultFileContentTest {
final FileSystemManager fsManager = VFS.getManager();
try (FileObject fo = fsManager.resolveFile(new File("."), "src/test/resources/test-data/size-0-file.bin");
final FileContent content = fo.getContent()) {
- Assert.assertEquals(0, content.getSize());
- Assert.assertTrue(content.isEmpty());
- Assert.assertEquals(StringUtils.EMPTY, content.getString(StandardCharsets.UTF_8));
- Assert.assertEquals(StringUtils.EMPTY, content.getString(StandardCharsets.UTF_8.name()));
- Assert.assertArrayEquals(ArrayUtils.EMPTY_BYTE_ARRAY, content.getByteArray());
+ assertEquals(0, content.getSize());
+ assertTrue(content.isEmpty());
+ assertEquals(StringUtils.EMPTY, content.getString(StandardCharsets.UTF_8));
+ assertEquals(StringUtils.EMPTY, content.getString(StandardCharsets.UTF_8.name()));
+ assertArrayEquals(ArrayUtils.EMPTY_BYTE_ARRAY, content.getByteArray());
}
}
@@ -108,10 +110,10 @@ public class DefaultFileContentTest {
final byte[] data = new byte[100];
readCount = stream.read(data, 0, 7);
stream.read();
- Assert.assertEquals(7, readCount);
- Assert.assertEquals(expected, new String(data).trim());
+ assertEquals(7, readCount);
+ assertEquals(expected, new String(data).trim());
readCount = stream.read(data, 8, 10);
- Assert.assertEquals(-1, readCount);
+ assertEquals(-1, readCount);
stream.reset();
}
}
@@ -136,7 +138,7 @@ public class DefaultFileContentTest {
final byte[] data = new byte[100];
stream.read(data, 0, 7);
stream.read();
- Assert.assertEquals(expected, new String(data).trim());
+ assertEquals(expected, new String(data).trim());
stream.reset();
}
}
@@ -200,7 +202,8 @@ public class DefaultFileContentTest {
});
thread.start();
thread.join();
- Assert.assertTrue(check.get());
+ assertTrue(check.get());
}
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/UriParserTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/UriParserTest.java
index 0d9b417..d24fd7c 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/UriParserTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/UriParserTest.java
@@ -16,58 +16,57 @@
*/
package org.apache.commons.vfs2.provider;
-import org.junit.Assert;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+
import org.junit.jupiter.api.Test;
-/**
- *
- */
public class UriParserTest {
private static final String[] schemes = {"ftp", "file"};
@Test
public void testColonInFileName() {
- Assert.assertNull(UriParser.extractScheme("some/path/some:file"));
+ assertNull(UriParser.extractScheme("some/path/some:file"));
}
@Test
public void testColonInFileNameAndNotSupportedScheme() {
- Assert.assertNull(UriParser.extractScheme(schemes, "some:file"));
+ assertNull(UriParser.extractScheme(schemes, "some:file"));
}
@Test
public void testColonInFileNameWithPath() {
- Assert.assertNull(UriParser.extractScheme(schemes, "some/path/some:file"));
+ assertNull(UriParser.extractScheme(schemes, "some/path/some:file"));
}
@Test
public void testColonNotFollowedBySlash() {
- Assert.assertEquals("file", UriParser.extractScheme(schemes, "file:user/subdir/some/path/some:file"));
+ assertEquals("file", UriParser.extractScheme(schemes, "file:user/subdir/some/path/some:file"));
}
@Test
public void testNormalScheme() {
- Assert.assertEquals("ftp", UriParser.extractScheme(schemes, "ftp://user:pass@host/some/path/some:file"));
+ assertEquals("ftp", UriParser.extractScheme(schemes, "ftp://user:pass@host/some/path/some:file"));
}
@Test
public void testNormalSchemeWithBuffer() {
final StringBuilder buffer = new StringBuilder();
UriParser.extractScheme(schemes, "ftp://user:pass@host/some/path/some:file", buffer);
- Assert.assertEquals("//user:pass@host/some/path/some:file", buffer.toString());
+ assertEquals("//user:pass@host/some/path/some:file", buffer.toString());
}
@Test
public void testOneSlashScheme() {
- Assert.assertEquals("file", UriParser.extractScheme(schemes, "file:/user:pass@host/some/path/some:file"));
+ assertEquals("file", UriParser.extractScheme(schemes, "file:/user:pass@host/some/path/some:file"));
}
@Test
public void testOneSlashSchemeWithBuffer() {
final StringBuilder buffer = new StringBuilder();
UriParser.extractScheme(schemes, "file:/user:pass@host/some/path/some:file", buffer);
- Assert.assertEquals("/user:pass@host/some/path/some:file", buffer.toString());
+ assertEquals("/user:pass@host/some/path/some:file", buffer.toString());
}
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/bzip2/Bzip2Test.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/bzip2/Bzip2Test.java
index 421e74f..fd84008 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/bzip2/Bzip2Test.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/bzip2/Bzip2Test.java
@@ -26,7 +26,7 @@ import org.apache.commons.vfs2.FileContent;
import org.apache.commons.vfs2.FileObject;
import org.apache.commons.vfs2.VFS;
import org.apache.commons.vfs2.provider.compressed.CompressedFileFileObject;
-import org.junit.Assert;
+import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
public class Bzip2Test {
@@ -35,21 +35,21 @@ public class Bzip2Test {
public void testBZip2() throws IOException {
final File testResource = getTestResource("bla.txt.bz2");
try (FileObject bz2FileObject = VFS.getManager().resolveFile("bz2://" + testResource)) {
- Assert.assertTrue(bz2FileObject.exists());
- Assert.assertTrue(bz2FileObject.isFolder());
+ Assertions.assertTrue(bz2FileObject.exists());
+ Assertions.assertTrue(bz2FileObject.isFolder());
try (FileObject fileObjectDir = bz2FileObject.resolveFile("bla.txt")) {
- Assert.assertTrue(fileObjectDir.exists());
- Assert.assertTrue(bz2FileObject.isFolder());
+ Assertions.assertTrue(fileObjectDir.exists());
+ Assertions.assertTrue(bz2FileObject.isFolder());
try (FileObject fileObject = fileObjectDir.resolveFile("bla.txt")) {
- Assert.assertTrue(fileObject.exists());
- Assert.assertFalse(fileObject.isFolder());
- Assert.assertTrue(fileObject.isFile());
+ Assertions.assertTrue(fileObject.exists());
+ Assertions.assertFalse(fileObject.isFolder());
+ Assertions.assertTrue(fileObject.isFile());
try (FileContent content = fileObject.getContent()) {
- Assert.assertEquals(CompressedFileFileObject.SIZE_UNDEFINED, content.getSize());
+ Assertions.assertEquals(CompressedFileFileObject.SIZE_UNDEFINED, content.getSize());
// blows up, Commons Compress?
final String string = content.getString(StandardCharsets.UTF_8);
- Assert.assertEquals(26, string.length());
- Assert.assertEquals("Hallo, dies ist ein Test.\n", string);
+ Assertions.assertEquals(26, string.length());
+ Assertions.assertEquals("Hallo, dies ist ein Test.\n", string);
}
}
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftp/FtpFileNameParserTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftp/FtpFileNameParserTest.java
index 4bec5af..8f87b7b 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftp/FtpFileNameParserTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftp/FtpFileNameParserTest.java
@@ -16,8 +16,8 @@
*/
package org.apache.commons.vfs2.provider.ftp;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import org.apache.commons.vfs2.FileName;
import org.apache.commons.vfs2.provider.GenericFileName;
@@ -47,4 +47,5 @@ public class FtpFileNameParserTest {
final String genericUri = n.getURI();
assertEquals(genericUri, uri.toString());
}
+
}
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 ec5f0fc..ea017a0 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
@@ -16,7 +16,7 @@
*/
package org.apache.commons.vfs2.provider.ftp;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.time.Duration;
@@ -43,4 +43,5 @@ public class FtpFileSystemConfigBuilderTest {
instance.setControlKeepAliveTimeout(options, Duration.ofSeconds(10));
assertEquals(Duration.ofSeconds(10), instance.getControlKeepAliveTimeout(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 b1b63eb..7d8909d 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
@@ -24,7 +24,7 @@ import org.apache.commons.vfs2.FileContent;
import org.apache.commons.vfs2.FileObject;
import org.apache.commons.vfs2.FileSystemException;
import org.apache.commons.vfs2.LastModifiedTests;
-import org.junit.Assert;
+import org.junit.jupiter.api.Assertions;
import org.junit.Test;
import static org.mockito.Mockito.spy;
@@ -56,7 +56,7 @@ public class FtpMdtmOnRefreshLastModifiedTests extends LastModifiedTests {
final long lastModTIme = fileObject.getContent().getLastModifiedTime();
if (expected != lastModTIme) {
- Assert.fail(String.format("%s returned epoch %s not expected: %s.",
+ Assertions.fail(String.format("%s returned epoch %s not expected: %s.",
FtpFileObject.class.getSimpleName(), lastModTIme, expected));
}
}
@@ -67,4 +67,5 @@ public class FtpMdtmOnRefreshLastModifiedTests extends LastModifiedTests {
fileSystem.putClient(ftpClientSpy);
return ftpClientSpy;
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftp/FtpProviderMdtmOffTestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftp/FtpProviderMdtmOffTestCase.java
index fcdb900..31d6b67 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftp/FtpProviderMdtmOffTestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftp/FtpProviderMdtmOffTestCase.java
@@ -50,4 +50,5 @@ public class FtpProviderMdtmOffTestCase extends FtpProviderTestCase {
});
return factory.createCommandFactory();
}
+
}
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 11c5fd8..c3be9ae 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
@@ -38,7 +38,7 @@ import org.apache.ftpserver.ftplet.UserManager;
import org.apache.ftpserver.listener.ListenerFactory;
import org.apache.ftpserver.usermanager.PropertiesUserManagerFactory;
import org.apache.ftpserver.usermanager.impl.BaseUser;
-import org.junit.Assert;
+import org.junit.jupiter.api.Assertions;
import junit.framework.Test;
@@ -98,7 +98,7 @@ public class FtpProviderTestCase extends AbstractProviderTestConfig {
final FtpServerFactory serverFactory = new FtpServerFactory();
final PropertiesUserManagerFactory propertiesUserManagerFactory = new PropertiesUserManagerFactory();
final URL userPropsResource = ClassLoader.getSystemClassLoader().getResource(USER_PROPS_RES);
- Assert.assertNotNull(USER_PROPS_RES, userPropsResource);
+ Assertions.assertNotNull(userPropsResource, USER_PROPS_RES);
propertiesUserManagerFactory.setUrl(userPropsResource);
final UserManager userManager = propertiesUserManagerFactory.createUserManager();
final BaseUser user = (BaseUser) userManager.getUserByName("test");
@@ -251,4 +251,5 @@ public class FtpProviderTestCase extends AbstractProviderTestConfig {
public void prepare(final DefaultFileSystemManager manager) throws Exception {
manager.addProvider("ftp", new FtpFileProvider());
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftp/FtpProviderUserDirTestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftp/FtpProviderUserDirTestCase.java
index 51517c9..a8c712f 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftp/FtpProviderUserDirTestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftp/FtpProviderUserDirTestCase.java
@@ -34,6 +34,7 @@ import junit.framework.Test;
* Tests for FTP file systems (with homeDirIsRoot=true).
*/
public class FtpProviderUserDirTestCase extends FtpProviderTestCase {
+
/**
* Creates the test suite for the ftp file system.
*/
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftp/MultipleConnectionTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftp/MultipleConnectionTest.java
index 90c70e3..2ba27d6 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftp/MultipleConnectionTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftp/MultipleConnectionTest.java
@@ -65,4 +65,5 @@ public class MultipleConnectionTest {
client2.disconnect();
}
}
+
}
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 2faf4aa..1f882ed 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
@@ -19,7 +19,6 @@ package org.apache.commons.vfs2.provider.ftps;
import static org.apache.commons.vfs2.VfsTestUtils.getTestDirectory;
import java.io.File;
-import java.io.IOException;
import java.net.URL;
import java.time.Duration;
@@ -39,12 +38,13 @@ import org.apache.ftpserver.ssl.SslConfiguration;
import org.apache.ftpserver.ssl.SslConfigurationFactory;
import org.apache.ftpserver.usermanager.PropertiesUserManagerFactory;
import org.apache.ftpserver.usermanager.impl.BaseUser;
-import org.junit.Assert;
+import org.junit.jupiter.api.Assertions;
/**
* Abstract tests for FTP file systems.
*/
abstract class AbstractFtpsProviderTestCase extends AbstractProviderTestConfig {
+
static final class FtpProviderTestSuite extends ProviderTestSuite {
private final boolean implicit;
@@ -109,16 +109,15 @@ abstract class AbstractFtpsProviderTestCase extends AbstractProviderTestConfig {
*
* @param implicit FTPS connection mode
* @throws FtpException
- * @throws IOException
*/
- static void setUpClass(final boolean implicit) throws FtpException, IOException {
+ static void setUpClass(final boolean implicit) throws FtpException {
if (Server != null) {
return;
}
final FtpServerFactory serverFactory = new FtpServerFactory();
final PropertiesUserManagerFactory propertiesUserManagerFactory = new PropertiesUserManagerFactory();
final URL userPropsResource = ClassLoader.getSystemClassLoader().getResource(USER_PROPS_RES);
- Assert.assertNotNull(USER_PROPS_RES, userPropsResource);
+ Assertions.assertNotNull(userPropsResource, USER_PROPS_RES);
propertiesUserManagerFactory.setUrl(userPropsResource);
final UserManager userManager = propertiesUserManagerFactory.createUserManager();
final BaseUser user = (BaseUser) userManager.getUserByName("test");
@@ -132,10 +131,10 @@ abstract class AbstractFtpsProviderTestCase extends AbstractProviderTestConfig {
// define SSL configuration
final URL serverJksResource = ClassLoader.getSystemClassLoader().getResource(SERVER_JKS_RES);
- Assert.assertNotNull(SERVER_JKS_RES, serverJksResource);
+ Assertions.assertNotNull(serverJksResource, SERVER_JKS_RES);
final SslConfigurationFactory ssl = new SslConfigurationFactory();
final File keyStoreFile = FileUtils.toFile(serverJksResource);
- Assert.assertTrue(keyStoreFile.toString(), keyStoreFile.exists());
+ Assertions.assertTrue(keyStoreFile.exists(), keyStoreFile.toString());
ssl.setKeystoreFile(keyStoreFile);
ssl.setKeystorePassword("password");
@@ -200,4 +199,5 @@ abstract class AbstractFtpsProviderTestCase extends AbstractProviderTestConfig {
builder.setConnectTimeout(fileSystemOptions, Duration.ofSeconds(10));
builder.setDataTimeout(fileSystemOptions, Duration.ofSeconds(10));
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftps/FtpsProviderExplicitTestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftps/FtpsProviderExplicitTestCase.java
index d9a58ff..a441a44 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftps/FtpsProviderExplicitTestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftps/FtpsProviderExplicitTestCase.java
@@ -41,4 +41,5 @@ public class FtpsProviderExplicitTestCase extends AbstractFtpsProviderTestCase {
builder.setDataChannelProtectionLevel(fileSystemOptions, FtpsDataChannelProtectionLevel.P);
builder.setFtpsMode(fileSystemOptions, FtpsMode.EXPLICIT);
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftps/FtpsProviderImplicitTestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftps/FtpsProviderImplicitTestCase.java
index 83605d5..67b70b0 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftps/FtpsProviderImplicitTestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftps/FtpsProviderImplicitTestCase.java
@@ -27,6 +27,7 @@ import junit.framework.Test;
* @see <a href="http://en.wikipedia.org/wiki/FTPS#Implicit">Wikipedia: FTPS/Implicit</a>
*/
public class FtpsProviderImplicitTestCase extends AbstractFtpsProviderTestCase {
+
/**
* Creates the test suite for the ftps file system.
*/
@@ -44,4 +45,5 @@ public class FtpsProviderImplicitTestCase extends AbstractFtpsProviderTestCase {
super.setupOptions(builder);
builder.setFtpsMode(fileSystemOptions, FtpsMode.IMPLICIT);
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftps/MultipleConnectionTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftps/MultipleConnectionTest.java
index 2a01f56..7271feb 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftps/MultipleConnectionTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftps/MultipleConnectionTest.java
@@ -73,4 +73,5 @@ public class MultipleConnectionTest {
}
}
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/hdfs/HdfsFileProviderTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/hdfs/HdfsFileProviderTest.java
index 1b6b42f..27c0cc6 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/hdfs/HdfsFileProviderTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/hdfs/HdfsFileProviderTest.java
@@ -16,6 +16,13 @@
*/
package org.apache.commons.vfs2.provider.hdfs;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
@@ -36,14 +43,11 @@ import org.apache.hadoop.hdfs.DFSConfigKeys;
import org.apache.hadoop.hdfs.MiniDFSCluster;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
-import org.junit.Assert;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
-import static org.junit.jupiter.api.Assertions.assertThrows;
-
/**
* This test class uses the Hadoop MiniDFSCluster class to create an embedded Hadoop cluster.
* <P>
@@ -146,182 +150,181 @@ public class HdfsFileProviderTest {
// Create the directory
hdfs.mkdirs(DIR1_PATH);
final FileObject dir = manager.resolveFile(TEST_DIR1);
- Assert.assertNotNull(dir);
- Assert.assertTrue(dir.exists());
- Assert.assertEquals(dir.getType(), FileType.FOLDER);
+ assertNotNull(dir);
+ assertTrue(dir.exists());
+ assertEquals(dir.getType(), FileType.FOLDER);
// Create the file in the directory
hdfs.create(FILE1_PATH).close();
final FileObject f = manager.resolveFile(TEST_FILE1);
- Assert.assertNotNull(f);
- Assert.assertTrue(f.exists());
- Assert.assertEquals(f.getType(), FileType.FILE);
+ assertNotNull(f);
+ assertTrue(f.exists());
+ assertEquals(f.getType(), FileType.FILE);
return f;
}
@Test
public void testCanRenameTo() throws Exception {
final FileObject fo = createTestFile(hdfs);
- Assert.assertNotNull(fo);
+ assertNotNull(fo);
fo.canRenameTo(fo);
}
@Test
public void testDoListChildren() throws Exception {
final FileObject fo = manager.resolveFile(TEST_DIR1);
- Assert.assertNotNull(fo);
- Assert.assertFalse(fo.exists());
+ assertNotNull(fo);
+ assertFalse(fo.exists());
// Create the test file
final FileObject file = createTestFile(hdfs);
- Assert.assertTrue(fo.exists());
+ assertTrue(fo.exists());
final FileObject dir = file.getParent();
final FileObject[] children = dir.getChildren();
- Assert.assertEquals(1, children.length);
- Assert.assertEquals(children[0].getName(), file.getName());
-
+ assertEquals(1, children.length);
+ assertEquals(children[0].getName(), file.getName());
}
@Test
public void testEquals() throws Exception {
// Create test file (and check parent was created)
final FileObject dir = manager.resolveFile(TEST_DIR1);
- Assert.assertNotNull(dir);
- Assert.assertFalse(dir.exists());
+ assertNotNull(dir);
+ assertFalse(dir.exists());
final FileObject file1 = createTestFile(hdfs);
- Assert.assertTrue(file1.exists());
- Assert.assertTrue(dir.exists());
+ assertTrue(file1.exists());
+ assertTrue(dir.exists());
// Get a handle to the same file and ensure it is equal
final FileObject file2 = manager.resolveFile(TEST_FILE1);
- Assert.assertEquals(file1, file2);
+ assertEquals(file1, file2);
// Ensure different files on same filesystem are not equal
- Assert.assertNotEquals(dir, file1);
- Assert.assertNotEquals(dir, file2);
+ assertNotEquals(dir, file1);
+ assertNotEquals(dir, file2);
}
@Test
public void testGetAttributes() throws Exception {
final FileObject fo = manager.resolveFile(TEST_DIR1);
- Assert.assertNotNull(fo);
- Assert.assertFalse(fo.exists());
+ assertNotNull(fo);
+ assertFalse(fo.exists());
// Create the test file
final FileObject file = createTestFile(hdfs);
- Assert.assertTrue(fo.exists());
+ assertTrue(fo.exists());
final Map<String, Object> attributes = file.getContent().getAttributes();
- Assert.assertTrue(attributes.containsKey(HdfsFileAttributes.BLOCK_SIZE.toString()));
- Assert.assertTrue(attributes.containsKey(HdfsFileAttributes.GROUP.toString()));
- Assert.assertTrue(attributes.containsKey(HdfsFileAttributes.LAST_ACCESS_TIME.toString()));
- Assert.assertTrue(attributes.containsKey(HdfsFileAttributes.LENGTH.toString()));
- Assert.assertTrue(attributes.containsKey(HdfsFileAttributes.MODIFICATION_TIME.toString()));
- Assert.assertTrue(attributes.containsKey(HdfsFileAttributes.OWNER.toString()));
- Assert.assertTrue(attributes.containsKey(HdfsFileAttributes.PERMISSIONS.toString()));
+ assertTrue(attributes.containsKey(HdfsFileAttributes.BLOCK_SIZE.toString()));
+ assertTrue(attributes.containsKey(HdfsFileAttributes.GROUP.toString()));
+ assertTrue(attributes.containsKey(HdfsFileAttributes.LAST_ACCESS_TIME.toString()));
+ assertTrue(attributes.containsKey(HdfsFileAttributes.LENGTH.toString()));
+ assertTrue(attributes.containsKey(HdfsFileAttributes.MODIFICATION_TIME.toString()));
+ assertTrue(attributes.containsKey(HdfsFileAttributes.OWNER.toString()));
+ assertTrue(attributes.containsKey(HdfsFileAttributes.PERMISSIONS.toString()));
}
@Test
public void testGetContentSize() throws Exception {
final FileObject fo = manager.resolveFile(TEST_DIR1);
- Assert.assertNotNull(fo);
- Assert.assertFalse(fo.exists());
+ assertNotNull(fo);
+ assertFalse(fo.exists());
// Create the test file
final FileObject file = createTestFile(hdfs);
- Assert.assertTrue(fo.exists());
- Assert.assertEquals(0, file.getContent().getSize());
- Assert.assertTrue(file.getContent().isEmpty());
+ assertTrue(fo.exists());
+ assertEquals(0, file.getContent().getSize());
+ assertTrue(file.getContent().isEmpty());
}
@Test
public void testGetInputStream() throws Exception {
final FileObject fo = manager.resolveFile(TEST_DIR1);
- Assert.assertNotNull(fo);
- Assert.assertFalse(fo.exists());
+ assertNotNull(fo);
+ assertFalse(fo.exists());
// Create the test file
final FileObject file = createTestFile(hdfs);
- Assert.assertTrue(fo.exists());
+ assertTrue(fo.exists());
file.getContent().getInputStream().close();
}
@Test
public void testInit() throws Exception {
final FileObject fo = manager.resolveFile(TEST_FILE1);
- Assert.assertNotNull(fo);
- Assert.assertFalse(fo.exists());
+ assertNotNull(fo);
+ assertFalse(fo.exists());
}
@Test
public void testIsHidden() throws Exception {
final FileObject fo = manager.resolveFile(TEST_DIR1);
- Assert.assertNotNull(fo);
- Assert.assertFalse(fo.exists());
+ assertNotNull(fo);
+ assertFalse(fo.exists());
// Create the test file
final FileObject file = createTestFile(hdfs);
- Assert.assertTrue(fo.exists());
- Assert.assertFalse(file.isHidden());
+ assertTrue(fo.exists());
+ assertFalse(file.isHidden());
}
@Test
public void testIsReadable() throws Exception {
final FileObject fo = manager.resolveFile(TEST_DIR1);
- Assert.assertNotNull(fo);
- Assert.assertFalse(fo.exists());
+ assertNotNull(fo);
+ assertFalse(fo.exists());
// Create the test file
final FileObject file = createTestFile(hdfs);
- Assert.assertTrue(fo.exists());
- Assert.assertTrue(file.isReadable());
+ assertTrue(fo.exists());
+ assertTrue(file.isReadable());
}
@Test
public void testIsWritable() throws Exception {
final FileObject fo = manager.resolveFile(TEST_DIR1);
- Assert.assertNotNull(fo);
- Assert.assertFalse(fo.exists());
+ assertNotNull(fo);
+ assertFalse(fo.exists());
// Create the test file
final FileObject file = createTestFile(hdfs);
- Assert.assertTrue(fo.exists());
- Assert.assertTrue(file.isWriteable());
+ assertTrue(fo.exists());
+ assertTrue(file.isWriteable());
}
@Test
public void testLastModificationTime() throws Exception {
final FileObject fo = manager.resolveFile(TEST_DIR1);
- Assert.assertNotNull(fo);
- Assert.assertFalse(fo.exists());
+ assertNotNull(fo);
+ assertFalse(fo.exists());
// Create the test file
final FileObject file = createTestFile(hdfs);
- Assert.assertTrue(fo.exists());
- Assert.assertNotEquals(-1, file.getContent().getLastModifiedTime());
+ assertTrue(fo.exists());
+ assertNotEquals(-1, file.getContent().getLastModifiedTime());
}
@Test
public void testRandomAccessContent() throws Exception {
final FileObject fo = manager.resolveFile(TEST_DIR1);
- Assert.assertNotNull(fo);
- Assert.assertFalse(fo.exists());
+ assertNotNull(fo);
+ assertFalse(fo.exists());
// Create the test file
final FileObject file = createTestFile(hdfs);
- Assert.assertTrue(fo.exists());
+ assertTrue(fo.exists());
assertThrows(FileSystemException.class, () -> file.getContent().getRandomAccessContent(RandomAccessMode.READWRITE).close());
}
@Test
public void testRandomAccessContent2() throws Exception {
final FileObject fo = manager.resolveFile(TEST_DIR1);
- Assert.assertNotNull(fo);
- Assert.assertFalse(fo.exists());
+ assertNotNull(fo);
+ assertFalse(fo.exists());
// Create the test file
final FileObject file = createTestFile(hdfs);
- Assert.assertTrue(fo.exists());
+ assertTrue(fo.exists());
file.getContent().getRandomAccessContent(RandomAccessMode.READ).close();
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/hdfs/HdfsFileProviderTestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/hdfs/HdfsFileProviderTestCase.java
index e088307..d1316ee 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/hdfs/HdfsFileProviderTestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/hdfs/HdfsFileProviderTestCase.java
@@ -44,6 +44,7 @@ import junit.framework.Test;
* This will only work on systems that Hadoop supports.
*/
public class HdfsFileProviderTestCase extends AbstractProviderTestConfig {
+
public static class HdfsProviderTestSuite extends ProviderTestSuite {
// Turn off the MiniDFSCluster logging
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http/HttpFilesCacheTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http/HttpFilesCacheTest.java
index 47f0241..7d0aaf9 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http/HttpFilesCacheTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http/HttpFilesCacheTest.java
@@ -16,11 +16,12 @@
*/
package org.apache.commons.vfs2.provider.http;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
import org.apache.commons.vfs2.FileObject;
import org.apache.commons.vfs2.FileSystemException;
import org.apache.commons.vfs2.FileSystemManager;
import org.apache.commons.vfs2.VFS;
-import org.junit.Assert;
import org.junit.jupiter.api.Test;
/**
@@ -43,15 +44,16 @@ public class HttpFilesCacheTest {
final FileSystemManager fileSystemManager = VFS.getManager();
try (FileObject noQueryFile = fileSystemManager.resolveFile(noQueryStringUrl)) {
- Assert.assertEquals(noQueryStringUrl, noQueryFile.getURL().toExternalForm());
+ assertEquals(noQueryStringUrl, noQueryFile.getURL().toExternalForm());
}
try (FileObject queryFile = fileSystemManager.resolveFile(queryStringUrl)) {
- Assert.assertEquals(queryStringUrl, queryFile.getURL().toExternalForm()); // failed for VFS-426
+ assertEquals(queryStringUrl, queryFile.getURL().toExternalForm()); // failed for VFS-426
}
try (FileObject queryFile2 = fileSystemManager.resolveFile(queryStringUrl2)) {
- Assert.assertEquals(queryStringUrl2, queryFile2.getURL().toExternalForm()); // failed for VFS-426
+ assertEquals(queryStringUrl2, queryFile2.getURL().toExternalForm()); // failed for VFS-426
}
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http/GetContentInfoFunctionalTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http/HttpGetContentInfoFunctionalTest.java
similarity index 95%
rename from commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http/GetContentInfoFunctionalTest.java
rename to commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http/HttpGetContentInfoFunctionalTest.java
index e0f88ab..8f43317 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http/GetContentInfoFunctionalTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http/HttpGetContentInfoFunctionalTest.java
@@ -16,6 +16,8 @@
*/
package org.apache.commons.vfs2.provider.http;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
import java.net.MalformedURLException;
import java.net.URL;
@@ -25,7 +27,6 @@ import org.apache.commons.vfs2.FileSystemException;
import org.apache.commons.vfs2.FileSystemManager;
import org.apache.commons.vfs2.FileSystemOptions;
import org.apache.commons.vfs2.VFS;
-import org.junit.Assert;
import org.junit.jupiter.api.Test;
/**
@@ -33,7 +34,7 @@ import org.junit.jupiter.api.Test;
*
* @since 2.1
*/
-public class GetContentInfoFunctionalTest {
+public class HttpGetContentInfoFunctionalTest {
FileSystemOptions getOptionsWithProxy() throws MalformedURLException {
// get proxy host and port from env var "https_proxy"
@@ -70,9 +71,10 @@ public class GetContentInfoFunctionalTest {
final String uri = "http://www.apache.org/licenses/LICENSE-2.0.txt";
try (FileObject fo = fsManager.resolveFile(uri, getOptionsWithProxy());
final FileContent content = fo.getContent()) {
- Assert.assertNotNull(content);
+ assertNotNull(content);
// Used to NPE before fix:
content.getContentInfo();
}
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http/HttpProviderTestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http/HttpProviderTestCase.java
index cf6a652..5970f37 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http/HttpProviderTestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http/HttpProviderTestCase.java
@@ -31,8 +31,8 @@ import org.apache.commons.vfs2.ProviderTestSuite;
import org.apache.commons.vfs2.VFS;
import org.apache.commons.vfs2.impl.DefaultFileSystemManager;
import org.apache.commons.vfs2.util.NHttpFileServer;
-import org.junit.Assert;
import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
/**
* Test cases for the HTTP provider.
@@ -110,8 +110,8 @@ public class HttpProviderTestCase extends AbstractProviderTestConfig {
}
private void checkReadTestsFolder(final FileObject file) throws FileSystemException {
- Assert.assertNotNull(file.getChildren());
- Assert.assertTrue(file.getChildren().length > 0);
+ Assertions.assertNotNull(file.getChildren());
+ Assertions.assertTrue(file.getChildren().length > 0);
}
/**
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http4/Http4FilesCacheTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http4/Http4FilesCacheTest.java
index 5faf293..c2e0701 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http4/Http4FilesCacheTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http4/Http4FilesCacheTest.java
@@ -16,13 +16,14 @@
*/
package org.apache.commons.vfs2.provider.http4;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
import java.util.Locale;
import org.apache.commons.vfs2.FileObject;
import org.apache.commons.vfs2.FileSystemException;
import org.apache.commons.vfs2.FileSystemManager;
import org.apache.commons.vfs2.VFS;
-import org.junit.Assert;
import org.junit.jupiter.api.Test;
/**
@@ -37,7 +38,7 @@ public class Http4FilesCacheTest {
final String noQueryStringUrl = "http4://commons.apache.org/";
try (FileObject noQueryFile = fileSystemManager.resolveFile(noQueryStringUrl)) {
- Assert.assertEquals(noQueryStringUrl, noQueryFile.getURL().toExternalForm());
+ assertEquals(noQueryStringUrl, noQueryFile.getURL().toExternalForm());
}
}
@@ -48,7 +49,7 @@ public class Http4FilesCacheTest {
final String noQueryStringUrl = "http4://commons.apache.org/vfs";
try (FileObject noQueryFile = fileSystemManager.resolveFile(noQueryStringUrl)) {
- Assert.assertEquals(noQueryStringUrl, noQueryFile.getURL().toExternalForm());
+ assertEquals(noQueryStringUrl, noQueryFile.getURL().toExternalForm());
}
}
@@ -59,7 +60,7 @@ public class Http4FilesCacheTest {
final String queryStringUrl = "http4://commons.apache.org/vfs?query=string";
try (FileObject queryFile = fileSystemManager.resolveFile(queryStringUrl)) {
- Assert.assertEquals(queryStringUrl, queryFile.getURL().toExternalForm()); // failed for VFS-426
+ assertEquals(queryStringUrl, queryFile.getURL().toExternalForm()); // failed for VFS-426
}
}
@@ -70,7 +71,7 @@ public class Http4FilesCacheTest {
final String queryStringUrl2 = "http4://commons.apache.org/vfs?query=string&more=stuff";
try (FileObject queryFile2 = fileSystemManager.resolveFile(queryStringUrl2)) {
- Assert.assertEquals(queryStringUrl2, queryFile2.getURL().toExternalForm()); // failed for VFS-426
+ assertEquals(queryStringUrl2, queryFile2.getURL().toExternalForm()); // failed for VFS-426
}
}
@@ -83,7 +84,7 @@ public class Http4FilesCacheTest {
// We end up converting back to lowercase, but OK per RFC.
final String queryStringUrl3 = "http4://alice%5C1234:secret@localhost:8080/";
try (FileObject queryFile3 = fileSystemManager.resolveFile(queryStringUrl3)) {
- Assert.assertEquals(queryStringUrl3.toLowerCase(Locale.ROOT), queryFile3.getURL().toExternalForm());
+ assertEquals(queryStringUrl3.toLowerCase(Locale.ROOT), queryFile3.getURL().toExternalForm());
}
}
@@ -95,7 +96,7 @@ public class Http4FilesCacheTest {
// Like testQueryStringUrl4() but with all LC input.
final String queryStringUrl4 = "http4://alice%5c1234:secret@localhost:8080/";
try (FileObject queryFile4 = fileSystemManager.resolveFile(queryStringUrl4)) {
- Assert.assertEquals(queryStringUrl4, queryFile4.getURL().toExternalForm());
+ assertEquals(queryStringUrl4, queryFile4.getURL().toExternalForm());
}
}
@@ -107,7 +108,7 @@ public class Http4FilesCacheTest {
// Like testQueryStringUrl4() but with all LC input and NO percent encoding.
final String queryStringUrl4 = "http4://alice:secret@localhost:8080/";
try (FileObject queryFile4 = fileSystemManager.resolveFile(queryStringUrl4)) {
- Assert.assertEquals(queryStringUrl4, queryFile4.getURL().toExternalForm());
+ assertEquals(queryStringUrl4, queryFile4.getURL().toExternalForm());
}
}
@@ -119,7 +120,8 @@ public class Http4FilesCacheTest {
// Like testQueryStringUrl4() but with all LC input and NO percent encoding.
final String queryStringUrl4 = "http4://localhost:8080/";
try (FileObject queryFile4 = fileSystemManager.resolveFile(queryStringUrl4)) {
- Assert.assertEquals(queryStringUrl4, queryFile4.getURL().toExternalForm());
+ assertEquals(queryStringUrl4, queryFile4.getURL().toExternalForm());
}
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http4/Http4GetContentInfoTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http4/Http4GetContentInfoTest.java
index d63d53b..f351fea 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http4/Http4GetContentInfoTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http4/Http4GetContentInfoTest.java
@@ -16,6 +16,8 @@
*/
package org.apache.commons.vfs2.provider.http4;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
import java.net.MalformedURLException;
import java.net.URL;
@@ -26,7 +28,6 @@ import org.apache.commons.vfs2.FileSystemManager;
import org.apache.commons.vfs2.FileSystemOptions;
import org.apache.commons.vfs2.VFS;
import org.apache.commons.vfs2.auth.StaticUserAuthenticator;
-import org.junit.Assert;
import org.junit.jupiter.api.Test;
/**
@@ -104,7 +105,7 @@ public class Http4GetContentInfoTest {
final String uri = "http4://www.apache.org/licenses/LICENSE-2.0.txt";
try (FileObject fo = fsManager.resolveFile(uri, getOptionsWithProxy());
final FileContent content = fo.getContent()) {
- Assert.assertNotNull(content);
+ assertNotNull(content);
// Used to NPE before fix:
content.getContentInfo();
}
@@ -122,8 +123,9 @@ public class Http4GetContentInfoTest {
final String uri = "http4://www.apache.org/licenses/LICENSE-2.0.txt";
try (FileObject fo = fsManager.resolveFile(uri, getOptionsWithProxyAuthentication());
final FileContent content = fo.getContent()) {
- Assert.assertNotNull(content);
+ assertNotNull(content);
content.getContentInfo();
}
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http4/Http4ProviderTestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http4/Http4ProviderTestCase.java
index 0ba78be..0cbd68f 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http4/Http4ProviderTestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http4/Http4ProviderTestCase.java
@@ -32,7 +32,7 @@ import org.apache.commons.vfs2.ProviderTestSuite;
import org.apache.commons.vfs2.VFS;
import org.apache.commons.vfs2.impl.DefaultFileSystemManager;
import org.apache.commons.vfs2.util.NHttpFileServer;
-import org.junit.Assert;
+import org.junit.jupiter.api.Assertions;
import org.junit.Test;
/**
@@ -110,8 +110,8 @@ public class Http4ProviderTestCase extends AbstractProviderTestConfig {
}
private void checkReadTestsFolder(final FileObject file) throws FileSystemException {
- Assert.assertNotNull(file.getChildren());
- Assert.assertTrue(file.getChildren().length > 0);
+ Assertions.assertNotNull(file.getChildren());
+ Assertions.assertTrue(file.getChildren().length > 0);
}
/**
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http4s/Http4sGetContentInfoTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http4s/Http4sGetContentInfoTest.java
index 9afe704..6f75be7 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http4s/Http4sGetContentInfoTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http4s/Http4sGetContentInfoTest.java
@@ -16,6 +16,8 @@
*/
package org.apache.commons.vfs2.provider.http4s;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
import java.net.MalformedURLException;
import java.net.URL;
@@ -26,7 +28,6 @@ import org.apache.commons.vfs2.FileSystemManager;
import org.apache.commons.vfs2.FileSystemOptions;
import org.apache.commons.vfs2.VFS;
import org.apache.commons.vfs2.provider.http4.Http4FileSystemConfigBuilder;
-import org.junit.Assert;
import org.junit.jupiter.api.Test;
/**
@@ -70,9 +71,10 @@ public class Http4sGetContentInfoTest {
final String uri = "http4://www.apache.org/licenses/LICENSE-2.0.txt";
try (FileObject fo = fsManager.resolveFile(uri, getOptionsWithProxy())) {
final FileContent content = fo.getContent();
- Assert.assertNotNull(content);
+ assertNotNull(content);
// Used to NPE before fix:
content.getContentInfo();
}
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http5/Http5FilesCacheTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http5/Http5FilesCacheTest.java
index 37b9b15..c3ad29b 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http5/Http5FilesCacheTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http5/Http5FilesCacheTest.java
@@ -16,11 +16,12 @@
*/
package org.apache.commons.vfs2.provider.http5;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
import org.apache.commons.vfs2.FileObject;
import org.apache.commons.vfs2.FileSystemException;
import org.apache.commons.vfs2.FileSystemManager;
import org.apache.commons.vfs2.VFS;
-import org.junit.Assert;
import org.junit.jupiter.api.Test;
/**
@@ -40,12 +41,13 @@ public class Http5FilesCacheTest {
final FileSystemManager fileSystemManager = VFS.getManager();
final FileObject noQueryFile = fileSystemManager.resolveFile(noQueryStringUrl);
- Assert.assertEquals(noQueryStringUrl, noQueryFile.getURL().toExternalForm());
+ assertEquals(noQueryStringUrl, noQueryFile.getURL().toExternalForm());
final FileObject queryFile = fileSystemManager.resolveFile(queryStringUrl);
- Assert.assertEquals(queryStringUrl, queryFile.getURL().toExternalForm()); // failed for VFS-426
+ assertEquals(queryStringUrl, queryFile.getURL().toExternalForm()); // failed for VFS-426
final FileObject queryFile2 = fileSystemManager.resolveFile(queryStringUrl2);
- Assert.assertEquals(queryStringUrl2, queryFile2.getURL().toExternalForm()); // failed for VFS-426
+ assertEquals(queryStringUrl2, queryFile2.getURL().toExternalForm()); // failed for VFS-426
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http5/Http5GetContentInfoTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http5/Http5GetContentInfoTest.java
index 6596da7..1261512 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http5/Http5GetContentInfoTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http5/Http5GetContentInfoTest.java
@@ -16,6 +16,8 @@
*/
package org.apache.commons.vfs2.provider.http5;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
import java.net.MalformedURLException;
import java.net.URL;
@@ -26,7 +28,6 @@ import org.apache.commons.vfs2.FileSystemManager;
import org.apache.commons.vfs2.FileSystemOptions;
import org.apache.commons.vfs2.VFS;
import org.apache.commons.vfs2.auth.StaticUserAuthenticator;
-import org.junit.Assert;
import org.junit.jupiter.api.Test;
/**
@@ -103,7 +104,7 @@ public class Http5GetContentInfoTest {
final String uri = "http5://www.apache.org/licenses/LICENSE-2.0.txt";
final FileObject fo = fsManager.resolveFile(uri, getOptionsWithProxy());
try (FileContent content = fo.getContent()) {
- Assert.assertNotNull(content);
+ assertNotNull(content);
// Used to NPE before fix:
content.getContentInfo();
}
@@ -120,8 +121,9 @@ public class Http5GetContentInfoTest {
final String uri = "http4://www.apache.org/licenses/LICENSE-2.0.txt";
try (FileObject fo = fsManager.resolveFile(uri, getOptionsWithProxyAuthentication())) {
final FileContent content = fo.getContent();
- Assert.assertNotNull(content);
+ assertNotNull(content);
content.getContentInfo();
}
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http5/Http5ProviderTestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http5/Http5ProviderTestCase.java
index 5085211..30d0563 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http5/Http5ProviderTestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http5/Http5ProviderTestCase.java
@@ -32,8 +32,8 @@ import org.apache.commons.vfs2.ProviderTestSuite;
import org.apache.commons.vfs2.VFS;
import org.apache.commons.vfs2.impl.DefaultFileSystemManager;
import org.apache.commons.vfs2.util.NHttpFileServer;
-import org.junit.Assert;
import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
/**
* Test cases for the HTTP5 provider.
@@ -110,8 +110,8 @@ public class Http5ProviderTestCase extends AbstractProviderTestConfig {
}
private void checkReadTestsFolder(final FileObject file) throws FileSystemException {
- Assert.assertNotNull(file.getChildren());
- Assert.assertTrue(file.getChildren().length > 0);
+ Assertions.assertNotNull(file.getChildren());
+ Assertions.assertTrue(file.getChildren().length > 0);
}
/**
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http5s/Http5sGetContentInfoTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http5s/Http5sGetContentInfoTest.java
index bd9f16a..7d01a06 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http5s/Http5sGetContentInfoTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http5s/Http5sGetContentInfoTest.java
@@ -34,7 +34,6 @@ import org.apache.commons.vfs2.FileSystemManager;
import org.apache.commons.vfs2.FileSystemOptions;
import org.apache.commons.vfs2.VFS;
import org.apache.commons.vfs2.provider.http5.Http5FileSystemConfigBuilder;
-import org.junit.Assert;
import org.junit.jupiter.api.Test;
/**
@@ -60,7 +59,6 @@ public class Http5sGetContentInfoTest {
return null;
}
-
// return options with proxy
final Http5FileSystemConfigBuilder builder = Http5FileSystemConfigBuilder.getInstance();
final FileSystemOptions opts = new FileSystemOptions();
@@ -93,27 +91,27 @@ public class Http5sGetContentInfoTest {
final String uri = "http5://www.apache.org/licenses/LICENSE-2.0.txt";
final FileObject fo = fsManager.resolveFile(uri, getOptionsWithProxy());
final FileContent content = fo.getContent();
- Assert.assertNotNull(content);
+ assertNotNull(content);
// Used to NPE before fix:
content.getContentInfo();
}
- /**
- * Tests VFS-786 set keystore type.
- *
- * @throws FileSystemException thrown when the getContentInfo API fails.
- * @throws MalformedURLException thrown when the System environment contains an invalid URL for an HTTPS proxy.
- */
-@Test
-public void testSSLGetContentInfo() throws IOException {
- final FileSystemManager fsManager = VFS.getManager();
- final String uri = "http5s://www.apache.org/licenses/LICENSE-2.0.txt";
- final FileObject fo = fsManager.resolveFile(uri, getOptionsWithSSL());
- final FileContent content = fo.getContent();
- try(InputStream is = content.getInputStream()){
- final String text = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8)).lines().collect(Collectors.joining("\n"));
- assertNotNull(text);
+ /**
+ * Tests VFS-786 set keystore type.
+ *
+ * @throws FileSystemException thrown when the getContentInfo API fails.
+ * @throws MalformedURLException thrown when the System environment contains an invalid URL for an HTTPS proxy.
+ */
+ @Test
+ public void testSSLGetContentInfo() throws IOException {
+ final FileSystemManager fsManager = VFS.getManager();
+ final String uri = "http5s://www.apache.org/licenses/LICENSE-2.0.txt";
+ final FileObject fo = fsManager.resolveFile(uri, getOptionsWithSSL());
+ final FileContent content = fo.getContent();
+ try (InputStream is = content.getInputStream()) {
+ final String text = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8)).lines().collect(Collectors.joining("\n"));
+ assertNotNull(text);
+ }
}
-}
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/https/GetContentInfoFunctionalTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/https/HttpsGetContentInfoFunctionalTest.java
similarity index 95%
rename from commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/https/GetContentInfoFunctionalTest.java
rename to commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/https/HttpsGetContentInfoFunctionalTest.java
index 59f20c2..9b1d72a 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/https/GetContentInfoFunctionalTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/https/HttpsGetContentInfoFunctionalTest.java
@@ -16,6 +16,8 @@
*/
package org.apache.commons.vfs2.provider.https;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
import java.net.MalformedURLException;
import java.net.URL;
@@ -26,7 +28,6 @@ import org.apache.commons.vfs2.FileSystemManager;
import org.apache.commons.vfs2.FileSystemOptions;
import org.apache.commons.vfs2.VFS;
import org.apache.commons.vfs2.provider.http.HttpFileSystemConfigBuilder;
-import org.junit.Assert;
import org.junit.jupiter.api.Test;
/**
@@ -34,7 +35,7 @@ import org.junit.jupiter.api.Test;
*
* @since 2.1
*/
-public class GetContentInfoFunctionalTest {
+public class HttpsGetContentInfoFunctionalTest {
FileSystemOptions getOptionsWithProxy() throws MalformedURLException {
// get proxy host and port from env var "https_proxy"
@@ -74,9 +75,10 @@ public class GetContentInfoFunctionalTest {
final String uri = "http://www.apache.org/licenses/LICENSE-2.0.txt";
try (FileObject fo = fsManager.resolveFile(uri, getOptionsWithProxy());
final FileContent content = fo.getContent()) {
- Assert.assertNotNull(content);
+ assertNotNull(content);
// Used to NPE before fix:
content.getContentInfo();
}
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/jar/JarAttributesTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/jar/JarAttributesTest.java
index ca7cdb7..579d628 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/jar/JarAttributesTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/jar/JarAttributesTest.java
@@ -16,16 +16,16 @@
*/
package org.apache.commons.vfs2.provider.jar;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
import java.util.Map;
import org.apache.commons.vfs2.FileObject;
import org.apache.commons.vfs2.VFS;
-import org.junit.Assert;
import org.junit.jupiter.api.Test;
/**
* Tests JAR attributes.
- *
*/
public class JarAttributesTest {
@@ -40,7 +40,7 @@ public class JarAttributesTest {
final FileObject file = JarProviderTestCase.getTestJar(VFS.getManager(), "test.jar");
final Map<String, Object> attributes = file.getContent().getAttributes();
- Assert.assertEquals("1.0", attributes.get("Manifest-Version"));
+ assertEquals("1.0", attributes.get("Manifest-Version"));
// Debugging:
// this.printAttributes(attributes);
}
@@ -51,8 +51,9 @@ public class JarAttributesTest {
final FileObject file = nested.resolveFile("test.jar");
final Map<String, Object> attributes = file.getContent().getAttributes();
- Assert.assertEquals("1.0", attributes.get("Manifest-Version"));
+ assertEquals("1.0", attributes.get("Manifest-Version"));
// Debugging:
// this.printAttributes(attributes);
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/jar/JarProviderTestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/jar/JarProviderTestCase.java
index 4c4ef61..64defb9 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/jar/JarProviderTestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/jar/JarProviderTestCase.java
@@ -32,6 +32,7 @@ import junit.framework.Test;
* Tests for the Jar file system.
*/
public class JarProviderTestCase extends AbstractProviderTestConfig {
+
static FileObject getTestJar(final FileSystemManager manager, final String name) throws Exception {
final File jarFile = getTestResource(name);
final String uri = "jar:file:" + jarFile.getAbsolutePath() + "!/";
@@ -60,4 +61,5 @@ public class JarProviderTestCase extends AbstractProviderTestConfig {
public void prepare(final DefaultFileSystemManager manager) throws Exception {
manager.addProvider("jar", new JarFileProvider());
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/jar/NestedJarTestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/jar/NestedJarTestCase.java
index 9bce564..d91e29d 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/jar/NestedJarTestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/jar/NestedJarTestCase.java
@@ -32,6 +32,7 @@ import junit.framework.Test;
* Tests for the Zip file system.
*/
public class NestedJarTestCase extends AbstractProviderTestConfig {
+
/**
* Creates the test suite for nested jar files.
*/
@@ -62,4 +63,5 @@ public class NestedJarTestCase extends AbstractProviderTestConfig {
manager.addProvider("jar", new JarFileProvider());
manager.addExtensionMap("jar", "jar");
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/ConversionTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/ConversionTest.java
index cd55086..7079694 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/ConversionTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/ConversionTest.java
@@ -16,8 +16,8 @@
*/
package org.apache.commons.vfs2.provider.local;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.File;
import java.io.IOException;
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/FileNameTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/FileNameTests.java
index 81cce09..4bd6e3f 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/FileNameTests.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/FileNameTests.java
@@ -21,7 +21,7 @@ import java.io.File;
import org.apache.commons.vfs2.AbstractProviderTestCase;
import org.apache.commons.vfs2.FileObject;
import org.apache.commons.vfs2.impl.DefaultFileSystemManager;
-import org.junit.Assert;
+import org.junit.jupiter.api.Assertions;
import org.junit.Test;
/**
@@ -37,7 +37,7 @@ public class FileNameTests extends AbstractProviderTestCase {
// Locate file by absolute file name
final String fileName = new File("testdir").getAbsolutePath();
final DefaultFileSystemManager manager = getManager();
- Assert.assertNotNull("Unexpected null manager for test " + this, manager);
+ Assertions.assertNotNull(manager, "Unexpected null manager for test " + this);
try (FileObject absFile = manager.resolveFile(fileName)) {
// Locate file by URI
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/LocalFileRandomAccessContentTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/LocalFileRandomAccessContentTest.java
index 33f9370..7770884 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/LocalFileRandomAccessContentTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/LocalFileRandomAccessContentTest.java
@@ -16,12 +16,14 @@
*/
package org.apache.commons.vfs2.provider.local;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import org.apache.commons.vfs2.util.RandomAccessMode;
-import org.junit.Assert;
import org.junit.jupiter.api.Test;
/**
@@ -43,11 +45,12 @@ public class LocalFileRandomAccessContentTest {
try (InputStream in = new LocalFileRandomAccessContent(file, RandomAccessMode.READ).getInputStream()) {
// read first data
final int read = in.read();
- Assert.assertNotEquals(EOF, read);
- Assert.assertEquals(0xFF, read);
+ assertNotEquals(EOF, read);
+ assertEquals(0xFF, read);
// read EOF
- Assert.assertEquals(EOF, in.read());
+ assertEquals(EOF, in.read());
}
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/LocalProviderTestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/LocalProviderTestCase.java
index aab32f9..538a16e 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/LocalProviderTestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/LocalProviderTestCase.java
@@ -31,6 +31,7 @@ import junit.framework.Test;
* Tests for the local file system.
*/
public class LocalProviderTestCase extends AbstractProviderTestConfig {
+
/**
* Creates the test suite for the local file system.
*/
@@ -57,4 +58,5 @@ public class LocalProviderTestCase extends AbstractProviderTestConfig {
public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception {
return manager.toFileObject(getTestDirectoryFile());
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/TempFileTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/TempFileTests.java
index d6ebf6c..72d9898 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/TempFileTests.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/TempFileTests.java
@@ -47,4 +47,5 @@ public class TempFileTests extends AbstractProviderTestCase {
}
}
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/UrlTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/UrlTests.java
index ec1afed..4047e04 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/UrlTests.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/UrlTests.java
@@ -26,7 +26,6 @@ import org.junit.Test;
/**
* Additional URL tests for local file system.
- *
*/
public class UrlTests extends AbstractProviderTestCase {
@@ -62,4 +61,5 @@ public class UrlTests extends AbstractProviderTestCase {
assertEquals(file.toString(), UriParser.decode(file.getURL().toString()));
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/WindowsFileNameTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/WindowsFileNameTests.java
index 3a35ea4..1d8e7f2 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/WindowsFileNameTests.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/WindowsFileNameTests.java
@@ -21,7 +21,7 @@ import org.apache.commons.vfs2.FileName;
import org.apache.commons.vfs2.FileObject;
import org.apache.commons.vfs2.FileSystemException;
import org.apache.commons.vfs2.impl.DefaultFileSystemManager;
-import org.junit.Assert;
+import org.junit.jupiter.api.Assertions;
import org.junit.Test;
/**
@@ -32,12 +32,12 @@ import org.junit.Test;
public class WindowsFileNameTests extends AbstractProviderTestCase {
@Test
- public void testWindowsFilenameParserError() throws Exception {
+ public void testWindowsFilenameParserError() {
// check VFS-338 with 2+4 slashes we want a dedicated error
try {
final String FILE = "file://////";
final DefaultFileSystemManager manager = getManager();
- Assert.assertNotNull("Unexpected null manager for test " + this, manager);
+ Assertions.assertNotNull(manager, "Unexpected null manager for test " + this);
final FileObject fo = manager.resolveFile(FILE);
fail("Windows File Parser should not allow " + FILE + " " + fo);
} catch (FileSystemException ex) {
@@ -48,11 +48,11 @@ public class WindowsFileNameTests extends AbstractProviderTestCase {
}
@Test
- public void testWindowsFilenameUNCStartError() throws Exception {
+ public void testWindowsFilenameUNCStartError() {
try {
final String FILE = "file://///";
final DefaultFileSystemManager manager = getManager();
- Assert.assertNotNull("Unexpected null manager for test " + this, manager);
+ Assertions.assertNotNull(manager, "Unexpected null manager for test " + this);
final FileObject fo = manager.resolveFile(FILE);
fail("Windows File Parser should not allow " + FILE + " " + fo);
} catch (FileSystemException ex) {
@@ -69,7 +69,7 @@ public class WindowsFileNameTests extends AbstractProviderTestCase {
for (final String name : tests) {
final DefaultFileSystemManager manager = getManager();
- Assert.assertNotNull("Unexpected null manager for test " + this, manager);
+ Assertions.assertNotNull(manager, "Unexpected null manager for test " + this);
final FileName fn = manager.resolveFile(name).getName();
// the following tests work for Windows file names only
@@ -90,13 +90,13 @@ public class WindowsFileNameTests extends AbstractProviderTestCase {
}
@Test
- public void testWindowsWrongRoots() throws Exception {
+ public void testWindowsWrongRoots() {
final String[] tests = { "file:///C:", "file://C:", "file:/C:", "file:C:" };
for (final String name : tests) {
try {
final DefaultFileSystemManager manager = getManager();
- Assert.assertNotNull("Unexpected null manager for test " + this, manager);
+ Assertions.assertNotNull(manager, "Unexpected null manager for test " + this);
final FileName fn = manager.resolveFile(name).getName();
fail("should not accept root " + name);
} catch (final FileSystemException ex) {
@@ -105,4 +105,5 @@ public class WindowsFileNameTests extends AbstractProviderTestCase {
}
}
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ram/CustomRamProviderTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ram/CustomRamProviderTest.java
index b0fa3e9..cc72826 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ram/CustomRamProviderTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ram/CustomRamProviderTest.java
@@ -110,7 +110,6 @@ public class CustomRamProviderTest {
return dir;
}
-
@BeforeEach
public void setUp() throws Exception {
manager = new DefaultFileSystemManager();
@@ -278,7 +277,6 @@ public class CustomRamProviderTest {
final FileObject dir = prepareSpecialFile(testDir, testFileName);
-
// verify we can list dir
// if not it throws:
@@ -335,7 +333,6 @@ public class CustomRamProviderTest {
}
}
-
/**
* Test some special file name symbols.
* <p>
@@ -353,13 +350,11 @@ public class CustomRamProviderTest {
final FileObject dir = prepareSpecialFile(testDir, testFileName);
-
// DO: verify you can list it:
final FileObject[] findFilesResult = dir.findFiles(new AllFileSelector()); // includes dir
final FileObject[] getChildrenResult = dir.getChildren();
final FileObject getChildResult = dir.getChild(UriParser.encode(testFileName, ENC));
-
// validate findFiles returns expected result
assertEquals("Unexpected result findFiles: " + Arrays.toString(findFilesResult), 2, findFilesResult.length);
String resultName = findFilesResult[0].getName().getPathDecoded();
@@ -378,4 +373,5 @@ public class CustomRamProviderTest {
assertEquals("getChild name does not match", expectedName, resultName);
assertEquals("getChild was no file", FileType.FILE, getChildResult.getType());
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ram/RamFileRandomAccessContentTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ram/RamFileRandomAccessContentTest.java
index 4bdb773..317f4c3 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ram/RamFileRandomAccessContentTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ram/RamFileRandomAccessContentTest.java
@@ -16,6 +16,9 @@
*/
package org.apache.commons.vfs2.provider.ram;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -23,7 +26,6 @@ import java.io.OutputStream;
import org.apache.commons.vfs2.FileObject;
import org.apache.commons.vfs2.VFS;
import org.apache.commons.vfs2.util.RandomAccessMode;
-import org.junit.Assert;
import org.junit.jupiter.api.Test;
/**
@@ -49,11 +51,12 @@ public class RamFileRandomAccessContentTest {
try (InputStream in = new RamFileRandomAccessContent((RamFileObject) file, RandomAccessMode.READ).getInputStream()) {
// read first data
final int read = in.read();
- Assert.assertNotEquals(EOF, read);
- Assert.assertEquals(0xFF, read);
+ assertNotEquals(EOF, read);
+ assertEquals(0xFF, read);
// read EOF
- Assert.assertEquals(EOF, in.read());
+ assertEquals(EOF, in.read());
}
}
+
}
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 77f45b4..e19b2b9 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
@@ -33,6 +33,7 @@ import junit.framework.Test;
* Tests for the RAM file system.
*/
public class RamProviderTestCase extends AbstractProviderTestConfig {
+
/** logger */
private static final Log log = LogFactory.getLog(RamProviderTestCase.class);
@@ -81,4 +82,5 @@ public class RamProviderTestCase extends AbstractProviderTestConfig {
throw e;
}
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/res/ResSchemeTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/res/ResSchemeTest.java
index c28c368..41df132 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/res/ResSchemeTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/res/ResSchemeTest.java
@@ -16,12 +16,13 @@
*/
package org.apache.commons.vfs2.provider.res;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.net.URI;
import java.net.URISyntaxException;
import org.apache.commons.vfs2.FileSystemException;
import org.apache.commons.vfs2.VFS;
-import org.junit.Assert;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertThrows;
@@ -30,22 +31,22 @@ public class ResSchemeTest {
@Test
public void test_resolveFile_String() throws FileSystemException {
- Assert.assertTrue(VFS.getManager().resolveFile("res:test.properties").exists());
+ assertTrue(VFS.getManager().resolveFile("res:test.properties").exists());
}
@Test
public void test_resolveFile_String_S() throws FileSystemException {
- Assert.assertTrue(VFS.getManager().resolveFile("res:/test.properties").exists());
+ assertTrue(VFS.getManager().resolveFile("res:/test.properties").exists());
}
@Test
public void test_resolveFile_String_SS() throws FileSystemException {
- Assert.assertTrue(VFS.getManager().resolveFile("res://test.properties").exists());
+ assertTrue(VFS.getManager().resolveFile("res://test.properties").exists());
}
@Test
public void test_resolveFile_String_SSS() throws FileSystemException {
- Assert.assertTrue(VFS.getManager().resolveFile("res://test.properties").exists());
+ assertTrue(VFS.getManager().resolveFile("res://test.properties").exists());
}
@Test
@@ -56,42 +57,42 @@ public class ResSchemeTest {
@Test
public void test_resolveFile_URI() throws FileSystemException, URISyntaxException {
- Assert.assertTrue(VFS.getManager().resolveFile(new URI("res:test.properties")).exists());
+ assertTrue(VFS.getManager().resolveFile(new URI("res:test.properties")).exists());
}
@Test
public void test_resolveFile_URI_S() throws FileSystemException, URISyntaxException {
- Assert.assertTrue(VFS.getManager().resolveFile(new URI("res:/test.properties")).exists());
+ assertTrue(VFS.getManager().resolveFile(new URI("res:/test.properties")).exists());
}
@Test
public void test_resolveFile_URI_SS() throws FileSystemException, URISyntaxException {
- Assert.assertTrue(VFS.getManager().resolveFile(new URI("res://test.properties")).exists());
+ assertTrue(VFS.getManager().resolveFile(new URI("res://test.properties")).exists());
}
@Test
public void test_resolveFile_URI_SSS() throws FileSystemException, URISyntaxException {
- Assert.assertTrue(VFS.getManager().resolveFile(new URI("res://test.properties")).exists());
+ assertTrue(VFS.getManager().resolveFile(new URI("res://test.properties")).exists());
}
@Test
public void test_resolveURI_String() throws FileSystemException {
- Assert.assertTrue(VFS.getManager().resolveURI("res:test.properties").isFile());
+ assertTrue(VFS.getManager().resolveURI("res:test.properties").isFile());
}
@Test
public void test_resolveURI_String_S() throws FileSystemException {
- Assert.assertTrue(VFS.getManager().resolveURI("res:/test.properties").isFile());
+ assertTrue(VFS.getManager().resolveURI("res:/test.properties").isFile());
}
@Test
public void test_resolveURI_String_SS() throws FileSystemException {
- Assert.assertTrue(VFS.getManager().resolveURI("res://test.properties").isFile());
+ assertTrue(VFS.getManager().resolveURI("res://test.properties").isFile());
}
@Test
public void test_resolveURI_String_SSS() throws FileSystemException {
- Assert.assertTrue(VFS.getManager().resolveURI("res:///test.properties").isFile());
+ assertTrue(VFS.getManager().resolveURI("res:///test.properties").isFile());
}
@Test
@@ -99,4 +100,5 @@ public class ResSchemeTest {
// Resulting path is empty
assertThrows(FileSystemException.class, () -> VFS.getManager().resolveURI("res:///").isFile());
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/res/ResourceProviderTestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/res/ResourceProviderTestCase.java
index 85d014c..8e5a6fb 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/res/ResourceProviderTestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/res/ResourceProviderTestCase.java
@@ -32,6 +32,7 @@ import junit.framework.Test;
* Test cases for the resource provider.
*/
public class ResourceProviderTestCase extends AbstractProviderTestConfig {
+
public static Test suite() throws Exception {
return new ProviderTestSuite(new ResourceProviderTestCase());
}
@@ -54,4 +55,5 @@ public class ResourceProviderTestCase extends AbstractProviderTestConfig {
manager.addProvider("file", new UrlFileProvider());
manager.addProvider("jar", new JarFileProvider());
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/res/Vfs444TestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/res/Vfs444TestCase.java
index fd56ab9..9cdda1a 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/res/Vfs444TestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/res/Vfs444TestCase.java
@@ -27,7 +27,7 @@ import org.apache.commons.vfs2.FileSystemManager;
import org.apache.commons.vfs2.ProviderTestSuite;
import org.apache.commons.vfs2.impl.DefaultFileSystemManager;
import org.apache.commons.vfs2.provider.zip.ZipFileProvider;
-import org.junit.Assert;
+import org.junit.jupiter.api.Assertions;
import org.junit.Test;
/**
@@ -40,43 +40,43 @@ public class Vfs444TestCase extends AbstractProviderTestConfig {
@Test
public void testResolveFullPathFile0() throws FileSystemException {
final FileObject result = getManager().resolveFile("res:test-data/test.zip");
- Assert.assertTrue(result.exists());
+ Assertions.assertTrue(result.exists());
}
@Test
public void testResolveFullPathFile1() throws FileSystemException {
final FileObject result = getManager().resolveFile("res:/test-data/test.zip");
- Assert.assertTrue(result.exists());
+ Assertions.assertTrue(result.exists());
}
@Test
public void testResolveFullPathFile2() throws FileSystemException {
final FileObject result = getManager().resolveFile("res://test-data/test.zip");
- Assert.assertTrue(result.exists());
+ Assertions.assertTrue(result.exists());
}
@Test
public void testResolveFullPathURI0() throws FileSystemException {
final FileName result = getManager().resolveURI("res:test-data/test.zip");
- Assert.assertTrue(result.isFile());
+ Assertions.assertTrue(result.isFile());
}
@Test
public void testResolveFullPathURI1() throws FileSystemException {
final FileName result = getManager().resolveURI("res:/test-data/test.zip");
- Assert.assertTrue(result.isFile());
+ Assertions.assertTrue(result.isFile());
}
@Test
public void testResolveFullPathURI2() throws FileSystemException {
final FileName result = getManager().resolveURI("res://test-data/test.zip");
- Assert.assertTrue(result.isFile());
+ Assertions.assertTrue(result.isFile());
}
@Test
public void testResolvePartialPath1() throws FileSystemException {
final FileName result = getManager().resolveURI("res:test-data");
- Assert.assertTrue(result.isFile());
+ Assertions.assertTrue(result.isFile());
}
@Test
@@ -85,8 +85,8 @@ public class Vfs444TestCase extends AbstractProviderTestConfig {
final FileName file = getManager().resolveName(root, "test.zip");
final String uri = file.getURI();
final FileObject result = getManager().resolveFile(uri);
- Assert.assertNotNull(result);
- Assert.assertTrue(result.exists());
+ Assertions.assertNotNull(result);
+ Assertions.assertTrue(result.exists());
}
}
@@ -113,4 +113,5 @@ public class Vfs444TestCase extends AbstractProviderTestConfig {
manager.addProvider("res", new ResourceFileProvider());
manager.addProvider("zip", new ZipFileProvider());
}
+
}
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 6637dde..503fd65 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
@@ -596,4 +596,5 @@ abstract class AbstractSftpProviderTestCase extends AbstractProviderTestConfig {
public void prepare(final DefaultFileSystemManager manager) throws Exception {
manager.addProvider("sftp", new SftpFileProvider());
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/SftpFileSystemConfigBuilderTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/SftpFileSystemConfigBuilderTest.java
index 731ff90..a38a921 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/SftpFileSystemConfigBuilderTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/SftpFileSystemConfigBuilderTest.java
@@ -16,7 +16,7 @@
*/
package org.apache.commons.vfs2.provider.sftp;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.time.Duration;
@@ -55,4 +55,5 @@ public class SftpFileSystemConfigBuilderTest {
assertEquals(ONE_MINUTE, builder.getSessionTimeout(options));
assertEquals(ONE_MINUTE.toMillis(), (long) builder.getSessionTimeoutMillis(options));
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/SftpMultiThreadWriteTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/SftpMultiThreadWriteTests.java
index f37e144..596609f 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/SftpMultiThreadWriteTests.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/SftpMultiThreadWriteTests.java
@@ -100,4 +100,5 @@ public class SftpMultiThreadWriteTests extends AbstractProviderTestCase {
service.shutdown();
}
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/SftpPermissionExceptionTestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/SftpPermissionExceptionTestCase.java
index 22f902b..fcbd516 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/SftpPermissionExceptionTestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/SftpPermissionExceptionTestCase.java
@@ -26,7 +26,7 @@ import org.apache.commons.vfs2.FileObject;
import org.apache.commons.vfs2.Selectors;
import org.apache.commons.vfs2.VFS;
import org.apache.sshd.server.channel.ChannelSession;
-import org.junit.Assert;
+import org.junit.jupiter.api.Assertions;
import org.junit.Test;
/**
@@ -61,7 +61,6 @@ public class SftpPermissionExceptionTestCase extends AbstractSftpProviderTestCas
return scratchFolder;
}
-
/**
* Returns the capabilities required by the tests of this test case.
*/
@@ -87,7 +86,6 @@ public class SftpPermissionExceptionTestCase extends AbstractSftpProviderTestCas
final FileObject scratchFolder = createScratchFolder();
-
// try to create local file
final String fileName = "filecopy.txt";
FileObject fileObjectCopy = scratchFolder.resolveFile(fileName);
@@ -99,9 +97,9 @@ public class SftpPermissionExceptionTestCase extends AbstractSftpProviderTestCas
for (int i = 0; i < 30; i++) {
try{
fileObjectCopy = scratchFolder.resolveFile(fileName);
- Assert.assertFalse(fileObjectCopy.isWriteable());
+ Assertions.assertFalse(fileObjectCopy.isWriteable());
fileObjectCopy.copyFrom(localFileObject, Selectors.SELECT_SELF);
- Assert.fail("permission fail");
+ Assertions.fail("permission fail");
} catch (Exception ex) {
// ignore no perminison
}
@@ -109,17 +107,14 @@ public class SftpPermissionExceptionTestCase extends AbstractSftpProviderTestCas
// try to get created channel number.
final int channelId = Server.getActiveSessions().get(0).registerChannel(new ChannelSession());
- Assert.assertTrue("create too many sftp channel more", channelId<30);
+ Assertions.assertTrue(channelId < 30, "create too many sftp channel more");
// try to set the local file to writable
Paths.get(getTestDirectory(), scratchFolder.getName().getBaseName(), fileName).toFile().setWritable(true);
-
fileObjectCopy = scratchFolder.resolveFile(fileName);
- Assert.assertTrue(fileObjectCopy.isWriteable());
+ Assertions.assertTrue(fileObjectCopy.isWriteable());
fileObjectCopy.copyFrom(localFileObject, Selectors.SELECT_SELF);
-
-
-
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/SftpProviderClosedExecChannelTestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/SftpProviderClosedExecChannelTestCase.java
index 15366a0..162e520 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/SftpProviderClosedExecChannelTestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/SftpProviderClosedExecChannelTestCase.java
@@ -26,6 +26,7 @@ import org.apache.commons.vfs2.ProviderWriteTests;
import junit.framework.Test;
public class SftpProviderClosedExecChannelTestCase extends AbstractSftpProviderTestCase {
+
/**
* Creates the test suite for the sftp file system.
*/
@@ -49,4 +50,5 @@ public class SftpProviderClosedExecChannelTestCase extends AbstractSftpProviderT
protected boolean isExecChannelClosed() {
return true;
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/SftpProviderStreamProxyModeTestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/SftpProviderStreamProxyModeTestCase.java
index cf06773..dca2320 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/SftpProviderStreamProxyModeTestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/SftpProviderStreamProxyModeTestCase.java
@@ -29,6 +29,7 @@ import com.jcraft.jsch.TestIdentityRepositoryFactory;
import junit.framework.Test;
public class SftpProviderStreamProxyModeTestCase extends AbstractSftpProviderTestCase {
+
// --- VFS-440: stream proxy test suite
// We override the addBaseTests method so that only
// one test is run (we just test that the input/output are correctly forwarded, and
@@ -87,7 +88,6 @@ public class SftpProviderStreamProxyModeTestCase extends AbstractSftpProviderTes
uri = String.format("sftp://%s@localhost:%d", userInfo, parsedURI.getPort());
}
-
final FileObject fileObject = manager.resolveFile(uri, fileSystemOptions);
this.fileSystem = (SftpFileSystem) fileObject.getFileSystem();
return fileObject;
@@ -97,4 +97,5 @@ public class SftpProviderStreamProxyModeTestCase extends AbstractSftpProviderTes
protected boolean isExecChannelClosed() {
return false;
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/SftpProviderTestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/SftpProviderTestCase.java
index 948f5e2..e718465 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/SftpProviderTestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/SftpProviderTestCase.java
@@ -37,4 +37,5 @@ public class SftpProviderTestCase extends AbstractSftpProviderTestCase {
protected boolean isExecChannelClosed() {
return false;
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/tar/CreateFileSystemTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/tar/CreateFileSystemTest.java
index 53a3c2e..d17c0a3 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/tar/CreateFileSystemTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/tar/CreateFileSystemTest.java
@@ -16,13 +16,14 @@
*/
package org.apache.commons.vfs2.provider.tar;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.io.File;
import java.io.IOException;
import org.apache.commons.vfs2.FileObject;
import org.apache.commons.vfs2.FileSystemManager;
import org.apache.commons.vfs2.VFS;
-import org.junit.Assert;
import org.junit.jupiter.api.Test;
/**
@@ -48,7 +49,7 @@ public class CreateFileSystemTest {
final String testFilePath = "src/test/resources/test-data/test.tar";
try (FileObject fileObject = createFileSystem(testFilePath)) {
- Assert.assertTrue(fileObject instanceof TarFileObject);
+ assertTrue(fileObject instanceof TarFileObject);
}
}
@@ -57,7 +58,7 @@ public class CreateFileSystemTest {
final String testFilePath = "src/test/resources/test-data/test.tbz2";
try (FileObject fileObject = createFileSystem(testFilePath)) {
- Assert.assertTrue(fileObject instanceof TarFileObject);
+ assertTrue(fileObject instanceof TarFileObject);
}
}
@@ -66,7 +67,8 @@ public class CreateFileSystemTest {
final String testFilePath = "src/test/resources/test-data/test.tgz";
try (FileObject fileObject = createFileSystem(testFilePath)) {
- Assert.assertTrue(fileObject instanceof TarFileObject);
+ assertTrue(fileObject instanceof TarFileObject);
}
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/tar/LargeTarTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/tar/LargeTarTest.java
index 3c12dd1..98a603a 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/tar/LargeTarTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/tar/LargeTarTest.java
@@ -71,32 +71,27 @@ public class LargeTarTest {
final PipedOutputStream outTarFileStream = new PipedOutputStream();
final PipedInputStream inTarFileStream = new PipedInputStream(outTarFileStream);
- final Thread source = new Thread() {
-
- @Override
- public void run() {
- final byte[] ba_1k = new byte[(int) _1K];
- Arrays.fill(ba_1k, (byte) 'a');
- try {
- final TarArchiveOutputStream outTarStream = (TarArchiveOutputStream) new ArchiveStreamFactory()
- .createArchiveOutputStream(ArchiveStreamFactory.TAR, outTarFileStream);
- // Create archive contents
- final TarArchiveEntry tarArchiveEntry = new TarArchiveEntry(name + ".txt");
- tarArchiveEntry.setSize(fileSize);
-
- outTarStream.putArchiveEntry(tarArchiveEntry);
- for (long i = 0; i < fileSize; i += ba_1k.length) {
- outTarStream.write(ba_1k);
- }
- outTarStream.closeArchiveEntry();
- outTarStream.close();
- outTarFileStream.close();
- } catch (final Exception e) {
- e.printStackTrace();
+ final Thread source = new Thread(() -> {
+ final byte[] ba_1k = new byte[(int) _1K];
+ Arrays.fill(ba_1k, (byte) 'a');
+ try {
+ final TarArchiveOutputStream outTarStream = (TarArchiveOutputStream) new ArchiveStreamFactory()
+ .createArchiveOutputStream(ArchiveStreamFactory.TAR, outTarFileStream);
+ // Create archive contents
+ final TarArchiveEntry tarArchiveEntry = new TarArchiveEntry(name + ".txt");
+ tarArchiveEntry.setSize(fileSize);
+
+ outTarStream.putArchiveEntry(tarArchiveEntry);
+ for (long i = 0; i < fileSize; i += ba_1k.length) {
+ outTarStream.write(ba_1k);
}
+ outTarStream.closeArchiveEntry();
+ outTarStream.close();
+ outTarFileStream.close();
+ } catch (final Exception e) {
+ e.printStackTrace();
}
-
- };
+ });
source.start();
final File gzFile = new File(path + name + ".tar.gz");
@@ -191,4 +186,5 @@ public class LargeTarTest {
assertEquals("Expected file not found: " + largeFileName + ".txt", f.getName().getBaseName(), largeFileName + ".txt");
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/tar/NestedTarTestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/tar/NestedTarTestCase.java
index 8bb5eb3..b65240e 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/tar/NestedTarTestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/tar/NestedTarTestCase.java
@@ -33,6 +33,7 @@ import junit.framework.Test;
* Tests for the Tar file system, using a tar file nested inside another tar file.
*/
public class NestedTarTestCase extends AbstractProviderTestConfig {
+
/**
* Creates the test suite for nested tar files.
*/
@@ -69,4 +70,5 @@ public class NestedTarTestCase extends AbstractProviderTestConfig {
manager.addExtensionMap("tar", "tar");
manager.addMimeTypeMap("application/x-tar", "tar");
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/tar/NestedTbz2TestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/tar/NestedTbz2TestCase.java
index 094f187..a73805c 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/tar/NestedTbz2TestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/tar/NestedTbz2TestCase.java
@@ -30,6 +30,7 @@ import junit.framework.Test;
* Tests for the Tar file system, using a tar file nested inside another tar file.
*/
public class NestedTbz2TestCase extends AbstractProviderTestConfig {
+
/**
* Creates the test suite for nested tar files.
*/
@@ -61,4 +62,5 @@ public class NestedTbz2TestCase extends AbstractProviderTestConfig {
manager.addExtensionMap("tbz2", "tbz2");
manager.addProvider("tar", new TarFileProvider());
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/tar/NestedTgzTestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/tar/NestedTgzTestCase.java
index 8e9d8f7..e212ccf 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/tar/NestedTgzTestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/tar/NestedTgzTestCase.java
@@ -30,6 +30,7 @@ import junit.framework.Test;
* Tests for the Tar file system, using a tar file nested inside another tar file.
*/
public class NestedTgzTestCase extends AbstractProviderTestConfig {
+
/**
* Creates the test suite for nested tar files.
*/
@@ -61,4 +62,5 @@ public class NestedTgzTestCase extends AbstractProviderTestConfig {
manager.addExtensionMap("tgz", "tgz");
manager.addProvider("tar", new TarFileProvider());
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/tar/TarFileObjectTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/tar/TarFileObjectTest.java
index 8992e51..0db130b 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/tar/TarFileObjectTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/tar/TarFileObjectTest.java
@@ -16,13 +16,15 @@
*/
package org.apache.commons.vfs2.provider.tar;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
import java.io.File;
import org.apache.commons.vfs2.FileObject;
import org.apache.commons.vfs2.FileSystemException;
import org.apache.commons.vfs2.FileSystemManager;
import org.apache.commons.vfs2.VFS;
-import org.junit.Assert;
import org.junit.jupiter.api.Test;
public class TarFileObjectTest {
@@ -38,11 +40,11 @@ public class TarFileObjectTest {
// test
try (FileObject fileObject = manager.resolveFile(baseUrl)) {
// test getChildren() number equal
- Assert.assertEquals(fileObject.getChildren().length, fileNames.length);
+ assertEquals(fileObject.getChildren().length, fileNames.length);
// test getChild(String)
for (final String fileName : fileNames) {
- Assert.assertNotNull("can't read file " + fileName, fileObject.getChild(fileName));
+ assertNotNull(fileObject.getChild(fileName), "can't read file " + fileName);
}
}
}
@@ -73,4 +75,5 @@ public class TarFileObjectTest {
testReadSpecialNameFileInFile("src/test/resources/test-data/special_fileName.tgz", "tgz");
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/tar/TarFileSystemTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/tar/TarFileSystemTest.java
index 018c3de..b965721 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/tar/TarFileSystemTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/tar/TarFileSystemTest.java
@@ -16,6 +16,8 @@
*/
package org.apache.commons.vfs2.provider.tar;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.io.File;
import org.apache.commons.vfs2.FileObject;
@@ -23,7 +25,6 @@ import org.apache.commons.vfs2.FileSystemException;
import org.apache.commons.vfs2.FilesCache;
import org.apache.commons.vfs2.cache.WeakRefFilesCache;
import org.apache.commons.vfs2.impl.StandardFileSystemManager;
-import org.junit.Assert;
import org.junit.jupiter.api.Test;
public class TarFileSystemTest {
@@ -85,7 +86,7 @@ public class TarFileSystemTest {
// resolve file, assert fileObject exist. clear fileObject to null and wait GC.
try {
fileObject = manager.resolveFile(fileUri);
- Assert.assertTrue(fileObject.exists());
+ assertTrue(fileObject.exists());
} finally {
if (fileObject != null) {
fileObject.close();
@@ -100,4 +101,5 @@ public class TarFileSystemTest {
}
}
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/tar/TarProviderTestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/tar/TarProviderTestCase.java
index f98d1d1..8bbea82 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/tar/TarProviderTestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/tar/TarProviderTestCase.java
@@ -32,6 +32,7 @@ import junit.framework.Test;
* Tests for the Tar file system.
*/
public class TarProviderTestCase extends AbstractProviderTestConfig {
+
/**
* Creates the test suite for the tar file system.
*/
@@ -57,4 +58,5 @@ public class TarProviderTestCase extends AbstractProviderTestConfig {
manager.addProvider("tar", new TarFileProvider());
manager.addMimeTypeMap("application/x-tar", "tar");
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/tar/Tbz2ProviderTestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/tar/Tbz2ProviderTestCase.java
index eb55a13..c0b7178 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/tar/Tbz2ProviderTestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/tar/Tbz2ProviderTestCase.java
@@ -32,6 +32,7 @@ import junit.framework.Test;
* Tests for the Tar file system.
*/
public class Tbz2ProviderTestCase extends AbstractProviderTestConfig {
+
/**
* Creates the test suite for the tar file system.
*/
@@ -57,4 +58,5 @@ public class Tbz2ProviderTestCase extends AbstractProviderTestConfig {
manager.addProvider("tbz2", new TarFileProvider());
manager.addProvider("tar", new TarFileProvider());
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/tar/TgzProviderTestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/tar/TgzProviderTestCase.java
index d489acd..ccdc958 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/tar/TgzProviderTestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/tar/TgzProviderTestCase.java
@@ -32,6 +32,7 @@ import junit.framework.Test;
* Tests for the Tar file system.
*/
public class TgzProviderTestCase extends AbstractProviderTestConfig {
+
/**
* Creates the test suite for the tar file system.
*/
@@ -58,4 +59,5 @@ public class TgzProviderTestCase extends AbstractProviderTestConfig {
manager.addProvider("tgz", new TarFileProvider());
manager.addProvider("tar", new TarFileProvider());
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/temp/TemporaryProviderTestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/temp/TemporaryProviderTestCase.java
index a403648..d39fcbc 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/temp/TemporaryProviderTestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/temp/TemporaryProviderTestCase.java
@@ -32,6 +32,7 @@ import junit.framework.Test;
* Test cases for the tmp: file provider.
*/
public class TemporaryProviderTestCase extends AbstractProviderTestConfig {
+
/**
* Creates the test suite for the tmp file system.
*/
@@ -55,4 +56,5 @@ public class TemporaryProviderTestCase extends AbstractProviderTestConfig {
final File baseDir = getTestDirectoryFile();
manager.addProvider("tmp", new TemporaryFileProvider(baseDir));
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/test/FileObjectSortTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/test/FileObjectSortTest.java
index ba888eb..6aa3bda 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/test/FileObjectSortTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/test/FileObjectSortTest.java
@@ -16,6 +16,11 @@
*/
package org.apache.commons.vfs2.provider.test;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+
import java.util.Arrays;
import java.util.List;
@@ -23,7 +28,6 @@ import org.apache.commons.vfs2.FileObject;
import org.apache.commons.vfs2.FileSystem;
import org.apache.commons.vfs2.FileSystemException;
import org.apache.commons.vfs2.VFS;
-import org.junit.Assert;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@@ -78,59 +82,51 @@ public class FileObjectSortTest {
final FileObject[] actualArray = { file3, file1, file2, file1, file2 };
final FileObject[] expectedArray = { file1, file1, file2, file2, file3 };
Arrays.sort(actualArray);
- Assert.assertArrayEquals(expectedArray, actualArray);
+ assertArrayEquals(expectedArray, actualArray);
}
/**
* Tests sorting an array
- *
- * @throws FileSystemException
*/
@Test
- public void testSortArrayMoveAll() throws FileSystemException {
+ public void testSortArrayMoveAll() {
final FileObject[] actualArray = UnSortedArray.clone();
- Assert.assertFalse(Arrays.equals(UnSortedArray, SortedArray));
+ assertFalse(Arrays.equals(UnSortedArray, SortedArray));
Arrays.sort(actualArray);
- Assert.assertArrayEquals(SortedArray, actualArray);
+ assertArrayEquals(SortedArray, actualArray);
}
/**
* Tests that sorting an array already in oder does not mess it up.
- *
- * @throws FileSystemException
*/
@Test
- public void testSortArrayMoveNone() throws FileSystemException {
+ public void testSortArrayMoveNone() {
final FileObject[] actualArray = SortedArray.clone();
Arrays.sort(actualArray);
- Assert.assertArrayEquals(SortedArray, actualArray);
+ assertArrayEquals(SortedArray, actualArray);
}
/**
* Tests sorting a list
- *
- * @throws FileSystemException
*/
@Test
- public void testSortListMoveAll() throws FileSystemException {
+ public void testSortListMoveAll() {
final List<FileObject> actualList = Arrays.asList(UnSortedArray);
final List<FileObject> expectedSortedList = Arrays.asList(SortedArray);
- Assert.assertNotEquals(actualList, expectedSortedList);
+ assertNotEquals(actualList, expectedSortedList);
actualList.sort(null);
- Assert.assertEquals(actualList, expectedSortedList);
+ assertEquals(actualList, expectedSortedList);
}
/**
* Tests that sorting a list already in oder does not mess it up.
- *
- * @throws FileSystemException
*/
@Test
- public void testSortListMoveNone() throws FileSystemException {
+ public void testSortListMoveNone() {
final List<FileObject> actualList = Arrays.asList(SortedArray);
final List<FileObject> expectedSortedList = Arrays.asList(SortedArray);
actualList.sort(null);
- Assert.assertEquals(actualList, expectedSortedList);
+ assertEquals(actualList, expectedSortedList);
}
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/test/GenericFileNameTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/test/GenericFileNameTest.java
index 4ddcd8a..890c865 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/test/GenericFileNameTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/test/GenericFileNameTest.java
@@ -144,4 +144,5 @@ public class GenericFileNameTest {
assertEquals("ftp://user::%40@hostname/", name.getRootURI());
assertEquals("ftp://user::%40@hostname/", name.getURI());
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/test/JunctionProviderConfig.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/test/JunctionProviderConfig.java
index cff7ae9..3ab87b5 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/test/JunctionProviderConfig.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/test/JunctionProviderConfig.java
@@ -27,6 +27,7 @@ import org.apache.commons.vfs2.impl.DefaultFileSystemManager;
* A provider config that wraps another provider, to run the tests via junctions.
*/
public class JunctionProviderConfig implements ProviderTestConfig {
+
private final ProviderTestConfig config;
public JunctionProviderConfig(final ProviderTestConfig config) {
@@ -73,4 +74,5 @@ public class JunctionProviderConfig implements ProviderTestConfig {
public void prepare(final DefaultFileSystemManager manager) throws Exception {
config.prepare(manager);
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/test/VirtualProviderTestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/test/VirtualProviderTestCase.java
index 1f76030..246d5b1 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/test/VirtualProviderTestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/test/VirtualProviderTestCase.java
@@ -31,6 +31,7 @@ import junit.framework.Test;
* Test cases for the virtual file system provider.
*/
public class VirtualProviderTestCase extends AbstractProviderTestConfig {
+
public static Test suite() throws Exception {
final ProviderTestSuite testSuite = new ProviderTestSuite(new VirtualProviderTestCase());
testSuite.addTests(JunctionTests.class);
@@ -46,4 +47,5 @@ public class VirtualProviderTestCase extends AbstractProviderTestConfig {
final FileObject baseFile = manager.toFileObject(baseDir);
return manager.createVirtualFileSystem(baseFile);
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/url/UrlFileNameParserTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/url/UrlFileNameParserTest.java
index 480f65d..fba2b0d 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/url/UrlFileNameParserTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/url/UrlFileNameParserTest.java
@@ -16,10 +16,11 @@
*/
package org.apache.commons.vfs2.provider.url;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
import java.net.URI;
import org.apache.commons.vfs2.FileName;
-import org.junit.Assert;
import org.junit.jupiter.api.Test;
public class UrlFileNameParserTest {
@@ -29,8 +30,8 @@ public class UrlFileNameParserTest {
final URI uri = new URI(uriStr);
// VFS-739 shows that parseUri throws an NPE:
final FileName fileName = new UrlFileNameParser().parseUri(null, null, uriStr);
- Assert.assertEquals(uriStr, fileName.getURI());
- Assert.assertEquals(uri.getScheme(), fileName.getScheme());
+ assertEquals(uriStr, fileName.getURI());
+ assertEquals(uri.getScheme(), fileName.getScheme());
}
@Test
@@ -47,4 +48,5 @@ public class UrlFileNameParserTest {
public void testJira739_scheme_ram() throws Exception {
testJira739("ram:///");
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/url/UrlHttpProviderTestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/url/UrlHttpProviderTestCase.java
index dcadf0c..202e8d9 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/url/UrlHttpProviderTestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/url/UrlHttpProviderTestCase.java
@@ -32,6 +32,7 @@ import junit.framework.Test;
* Test cases for the generic provider.
*/
public class UrlHttpProviderTestCase extends AbstractProviderTestConfig {
+
public static Test suite() throws Exception {
return new ProviderTestSuite(new UrlHttpProviderTestCase());
}
@@ -52,4 +53,5 @@ public class UrlHttpProviderTestCase extends AbstractProviderTestConfig {
public void prepare(final DefaultFileSystemManager manager) throws Exception {
manager.addProvider("http", new UrlFileProvider());
}
+
}
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 68c4823..3e0d3f9 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
@@ -33,9 +33,9 @@ import junit.framework.Test;
/**
* Test cases for HTTP with the default provider.
- *
*/
public class UrlProviderHttpTestCase extends AbstractProviderTestConfig {
+
private static NHttpFileServer Server;
private static int SocketPort;
@@ -113,4 +113,5 @@ public class UrlProviderHttpTestCase extends AbstractProviderTestConfig {
public void prepare(final DefaultFileSystemManager manager) throws Exception {
manager.addProvider("http", new UrlFileProvider());
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/url/UrlProviderTestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/url/UrlProviderTestCase.java
index a268f6b..11562c1 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/url/UrlProviderTestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/url/UrlProviderTestCase.java
@@ -32,6 +32,7 @@ import junit.framework.Test;
* Test cases for the generic provider.
*/
public class UrlProviderTestCase extends AbstractProviderTestConfig {
+
public static Test suite() throws Exception {
return new ProviderTestSuite(new UrlProviderTestCase());
}
@@ -52,4 +53,5 @@ public class UrlProviderTestCase extends AbstractProviderTestConfig {
public void prepare(final DefaultFileSystemManager manager) throws Exception {
manager.addProvider("file", new UrlFileProvider());
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/zip/FileLockTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/zip/FileLockTest.java
index 6cc2cb7..ab200ab 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/zip/FileLockTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/zip/FileLockTest.java
@@ -16,6 +16,12 @@
*/
package org.apache.commons.vfs2.provider.zip;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assumptions.assumeTrue;
+
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
@@ -28,8 +34,6 @@ import org.apache.commons.vfs2.FileObject;
import org.apache.commons.vfs2.FileSystemException;
import org.apache.commons.vfs2.FileSystemManager;
import org.apache.commons.vfs2.VFS;
-import org.junit.Assert;
-import org.junit.Assume;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -45,13 +49,13 @@ public class FileLockTest {
private void assertDelete() {
// We do not use newZipFile in the Assert message to avoid touching it before calling delete().
- Assert.assertTrue("Could not delete file", newZipFile.delete());
+ assertTrue(newZipFile.delete(), "Could not delete file");
}
private void readAndAssert(final InputStream inputStream) throws IOException {
final String string = IOUtils.toString(inputStream, StandardCharsets.UTF_8);
- Assert.assertNotNull(string);
- Assert.assertEquals("This is a test file.", string);
+ assertNotNull(string);
+ assertEquals("This is a test file.", string);
}
private void resolveAndOpenCloseContent() throws FileSystemException {
@@ -90,7 +94,7 @@ public class FileLockTest {
try (InputStream inputStream = zipFileObject.getContent().getInputStream()) {
if (SystemUtils.IS_OS_WINDOWS) {
// We do not use newZipFile in the Assert message to avoid touching it before calling delete().
- Assert.assertFalse("Could not delete file", newZipFile.delete());
+ assertFalse(newZipFile.delete(), "Could not delete file");
}
}
}
@@ -99,11 +103,11 @@ public class FileLockTest {
@Test
public void testCannotDeleteWhileStreaming2() throws Exception {
- Assume.assumeTrue(SystemUtils.IS_OS_WINDOWS);
+ assumeTrue(SystemUtils.IS_OS_WINDOWS);
try (FileObject zipFileObject = manager.resolveFile(zipFileUri)) {
try (InputStream inputStream = zipFileObject.getContent().getInputStream()) {
// We do not use newZipFile in the Assert message to avoid touching it before calling delete().
- Assert.assertFalse("Could not delete file", newZipFile.delete());
+ assertFalse(newZipFile.delete(), "Could not delete file");
}
}
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/zip/Jira733Test.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/zip/Jira733Test.java
index e3dd196..a9d7fba 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/zip/Jira733Test.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/zip/Jira733Test.java
@@ -16,6 +16,9 @@
*/
package org.apache.commons.vfs2.provider.zip;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.io.File;
import org.apache.commons.vfs2.FileObject;
@@ -23,7 +26,6 @@ import org.apache.commons.vfs2.FileSystemException;
import org.apache.commons.vfs2.VFS;
import org.apache.commons.vfs2.cache.OnCallRefreshFileObject;
import org.apache.commons.vfs2.function.VfsConsumer;
-import org.junit.Assert;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -43,26 +45,26 @@ public class Jira733Test {
try (FileObject fileObject = VFS.getManager().resolveFile(nestedPath);
final FileObject wrappedFileObject = new OnCallRefreshFileObject(fileObject)) {
// VFS.getManager().getFilesCache().close();
- Assert.assertNotNull("getParentLayer() 1", wrappedFileObject.getFileSystem().getParentLayer());
+ assertNotNull(wrappedFileObject.getFileSystem().getParentLayer(), "getParentLayer() 1");
wrappedFileObject.exists();
wrappedFileObject.getContent();
- Assert.assertNotNull("getParentLayer() 2", wrappedFileObject.getFileSystem().getParentLayer());
+ assertNotNull(wrappedFileObject.getFileSystem().getParentLayer(), "getParentLayer() 2");
}
}
private void testZipParentLayer(final VfsConsumer<FileObject> consumer) throws Exception {
final File file = new File("src/test/resources/test-data/test.zip");
- Assert.assertTrue(file.exists());
+ assertTrue(file.exists());
final String nestedPath = "zip:" + file.getAbsolutePath() + "!/read-tests/file1.txt";
try (FileObject fileObject = VFS.getManager().resolveFile(nestedPath);
final FileObject wrappedFileObject = new OnCallRefreshFileObject(fileObject)) {
- Assert.assertTrue(fileObject instanceof ZipFileObject);
+ assertTrue(fileObject instanceof ZipFileObject);
@SuppressWarnings({ "unused", "resource" })
final
ZipFileObject zipFileObject = (ZipFileObject) fileObject;
- Assert.assertNotNull("getParentLayer() 1", wrappedFileObject.getFileSystem().getParentLayer());
+ assertNotNull(wrappedFileObject.getFileSystem().getParentLayer(), "getParentLayer() 1");
consumer.accept(wrappedFileObject);
- Assert.assertNotNull("getParentLayer() 2", wrappedFileObject.getFileSystem().getParentLayer());
+ assertNotNull(wrappedFileObject.getFileSystem().getParentLayer(), "getParentLayer() 2");
}
}
@@ -133,4 +135,5 @@ public class Jira733Test {
public void testZipParentLayer_isWriteable() throws Exception {
testZipParentLayer(FileObject::isWriteable);
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/zip/NestedZipTestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/zip/NestedZipTestCase.java
index df16d9c..abaae1d 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/zip/NestedZipTestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/zip/NestedZipTestCase.java
@@ -30,6 +30,7 @@ import junit.framework.Test;
* Tests for the Zip file system, using a zip file nested inside another zip file.
*/
public class NestedZipTestCase extends AbstractProviderTestConfig {
+
/**
* Creates the test suite for nested zip files.
*/
@@ -61,4 +62,5 @@ public class NestedZipTestCase extends AbstractProviderTestConfig {
manager.addExtensionMap("zip", "zip");
manager.addMimeTypeMap("application/zip", "zip");
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/zip/ParseXmlInZipTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/zip/ParseXmlInZipTest.java
index aae0cf7..edd6fde 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/zip/ParseXmlInZipTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/zip/ParseXmlInZipTest.java
@@ -16,6 +16,9 @@
*/
package org.apache.commons.vfs2.provider.zip;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
@@ -32,7 +35,6 @@ import org.apache.commons.vfs2.FileObject;
import org.apache.commons.vfs2.FileSystemException;
import org.apache.commons.vfs2.FileSystemManager;
import org.apache.commons.vfs2.VFS;
-import org.junit.Assert;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -105,7 +107,7 @@ public class ParseXmlInZipTest {
try (FileObject zipFileObject = manager.resolveFile(xmlFilePath)) {
try (InputStream inputStream = zipFileObject.getContent().getInputStream()) {
final Document document = newDocumentBuilder(zipFileObject, zipFileObject, null).parse(inputStream);
- Assert.assertNotNull(document);
+ assertNotNull(document);
}
}
}
@@ -124,7 +126,7 @@ public class ParseXmlInZipTest {
testResolveAndParseXmlInZip("read-xml-tests/name-invalid.xml", "/read-xml-tests/name.xsd");
} catch (final SAXException e) {
final Pattern p = Pattern.compile("Invalid content was found starting with element.+FOO");
- Assert.assertTrue(p.matcher(e.toString()).find());
+ assertTrue(p.matcher(e.toString()).find());
}
}
@@ -133,7 +135,7 @@ public class ParseXmlInZipTest {
try {
testResolveAndParseXmlInZip("read-xml-tests/name-not-well-formed.xml", "/read-xml-tests/name.xsd");
} catch (final SAXException e) {
- Assert.assertTrue(
+ assertTrue(
e.toString().contains("XML document structures must start and end within the same entity."));
}
}
@@ -156,7 +158,7 @@ public class ParseXmlInZipTest {
try (InputStream inputStream = xmlFileObject.getContent().getInputStream()) {
final Document document = newDocumentBuilder(zipFileObject, xmlFileObject, xsdPathInZip)
.parse(inputStream);
- Assert.assertNotNull(document);
+ assertNotNull(document);
}
}
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/zip/TestErrorHandler.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/zip/TestErrorHandler.java
index 0528bfd..0ea3eb2 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/zip/TestErrorHandler.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/zip/TestErrorHandler.java
@@ -46,7 +46,6 @@ public class TestErrorHandler implements ErrorHandler {
public void warning(final SAXParseException exception) throws SAXException {
System.err.println(header);
exception.printStackTrace(System.err);
-
}
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/zip/ZipFileObjectTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/zip/ZipFileObjectTest.java
index 533a325..ca28bfb 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/zip/ZipFileObjectTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/zip/ZipFileObjectTest.java
@@ -203,4 +203,5 @@ public class ZipFileObjectTest {
}
assertDelete(newZipFile);
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/zip/ZipFileSystemTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/zip/ZipFileSystemTest.java
index 02da16d..089951c 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/zip/ZipFileSystemTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/zip/ZipFileSystemTest.java
@@ -16,13 +16,14 @@
*/
package org.apache.commons.vfs2.provider.zip;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.io.File;
import org.apache.commons.vfs2.FileObject;
import org.apache.commons.vfs2.FileSystemException;
import org.apache.commons.vfs2.cache.WeakRefFilesCache;
import org.apache.commons.vfs2.impl.StandardFileSystemManager;
-import org.junit.Assert;
import org.junit.jupiter.api.Test;
public class ZipFileSystemTest {
@@ -51,7 +52,7 @@ public class ZipFileSystemTest {
// resolve file, assert fileObject exist. clear fileObject to null and wait GC.
try {
fileObject = manager.resolveFile(fileUri);
- Assert.assertTrue(fileObject.exists());
+ assertTrue(fileObject.exists());
} finally {
if (fileObject != null) {
fileObject.close();
@@ -65,4 +66,5 @@ public class ZipFileSystemTest {
}
}
}
+
}
\ No newline at end of file
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/zip/ZipProviderTestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/zip/ZipProviderTestCase.java
index 766ce31..46681fa 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/zip/ZipProviderTestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/zip/ZipProviderTestCase.java
@@ -32,6 +32,7 @@ import junit.framework.Test;
* Tests for the Zip file system.
*/
public class ZipProviderTestCase extends AbstractProviderTestConfig {
+
/**
* Creates the test suite for the zip file system.
*/
@@ -58,4 +59,5 @@ public class ZipProviderTestCase extends AbstractProviderTestConfig {
manager.addExtensionMap("zip", "zip");
manager.addMimeTypeMap("application/zip", "zip");
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/zip/ZipProviderWithCharsetNullTestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/zip/ZipProviderWithCharsetNullTestCase.java
index 3c4bb76..d8d0718 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/zip/ZipProviderWithCharsetNullTestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/zip/ZipProviderWithCharsetNullTestCase.java
@@ -27,7 +27,7 @@ import org.apache.commons.vfs2.FileSystemManager;
import org.apache.commons.vfs2.FileSystemOptions;
import org.apache.commons.vfs2.ProviderTestSuite;
import org.apache.commons.vfs2.impl.DefaultFileSystemManager;
-import org.junit.Assert;
+import org.junit.jupiter.api.Assertions;
import junit.framework.Test;
@@ -35,6 +35,7 @@ import junit.framework.Test;
* Tests for the Zip file system.
*/
public class ZipProviderWithCharsetNullTestCase extends AbstractProviderTestConfig {
+
/**
* Creates the test suite for the zip file system.
*/
@@ -56,9 +57,9 @@ public class ZipProviderWithCharsetNullTestCase extends AbstractProviderTestConf
final String uri = "zip:file:" + zipFile.getAbsolutePath() + "!/";
final FileObject resolvedFile = manager.resolveFile(uri, opts);
final FileSystem fileSystem = resolvedFile.getFileSystem();
- Assert.assertTrue(fileSystem instanceof ZipFileSystem);
+ Assertions.assertTrue(fileSystem instanceof ZipFileSystem);
final ZipFileSystem zipFileSystem = (ZipFileSystem) fileSystem;
- Assert.assertNull(zipFileSystem.getCharset());
+ Assertions.assertNull(zipFileSystem.getCharset());
return resolvedFile;
}
@@ -71,4 +72,5 @@ public class ZipProviderWithCharsetNullTestCase extends AbstractProviderTestConf
manager.addExtensionMap("zip", "zip");
manager.addMimeTypeMap("application/zip", "zip");
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/zip/ZipProviderWithCharsetTestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/zip/ZipProviderWithCharsetTestCase.java
index 68ade16..25843ae 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/zip/ZipProviderWithCharsetTestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/zip/ZipProviderWithCharsetTestCase.java
@@ -28,7 +28,7 @@ import org.apache.commons.vfs2.FileSystemManager;
import org.apache.commons.vfs2.FileSystemOptions;
import org.apache.commons.vfs2.ProviderTestSuite;
import org.apache.commons.vfs2.impl.DefaultFileSystemManager;
-import org.junit.Assert;
+import org.junit.jupiter.api.Assertions;
import junit.framework.Test;
@@ -36,6 +36,7 @@ import junit.framework.Test;
* Tests for the Zip file system.
*/
public class ZipProviderWithCharsetTestCase extends AbstractProviderTestConfig {
+
/**
* Creates the test suite for the zip file system.
*/
@@ -57,9 +58,9 @@ public class ZipProviderWithCharsetTestCase extends AbstractProviderTestConfig {
final String uri = "zip:file:" + zipFile.getAbsolutePath() + "!/";
final FileObject resolvedFile = manager.resolveFile(uri, opts);
final FileSystem fileSystem = resolvedFile.getFileSystem();
- Assert.assertTrue(fileSystem instanceof ZipFileSystem);
+ Assertions.assertTrue(fileSystem instanceof ZipFileSystem);
final ZipFileSystem zipFileSystem = (ZipFileSystem) fileSystem;
- Assert.assertEquals(StandardCharsets.UTF_8, zipFileSystem.getCharset());
+ Assertions.assertEquals(StandardCharsets.UTF_8, zipFileSystem.getCharset());
return resolvedFile;
}
@@ -72,4 +73,5 @@ public class ZipProviderWithCharsetTestCase extends AbstractProviderTestConfig {
manager.addExtensionMap("zip", "zip");
manager.addMimeTypeMap("application/zip", "zip");
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/util/DelegatingFileSystemOptionsBuilderTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/util/DelegatingFileSystemOptionsBuilderTest.java
index 1ee0613..0ab7d8c 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/util/DelegatingFileSystemOptionsBuilderTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/util/DelegatingFileSystemOptionsBuilderTest.java
@@ -39,6 +39,7 @@ import org.junit.jupiter.api.Test;
* Some tests for the DelegatingFileSystemOptionsBuilder
*/
public class DelegatingFileSystemOptionsBuilderTest {
+
private static final String[] schemes = { "http", "ftp", "file", "zip", "tar", "tgz", "bz2", "gz",
"jar", "tmp", "ram" };
@@ -113,4 +114,5 @@ public class DelegatingFileSystemOptionsBuilderTest {
new File(identityPaths[iterIdentities]).getAbsolutePath());
}
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/util/EncryptDecryptTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/util/EncryptDecryptTest.java
index c642b56..07aa6da 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/util/EncryptDecryptTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/util/EncryptDecryptTest.java
@@ -16,7 +16,7 @@
*/
package org.apache.commons.vfs2.util;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import org.junit.jupiter.api.Test;
@@ -39,10 +39,11 @@ public class EncryptDecryptTest {
}
@Test
- public void testInvalidDecrypt() throws Exception {
+ public void testInvalidDecrypt() {
// provider.HostFileNameParser.extractToPath(String, StringBuilder) catches `Exception`
final String broken = "91458";
final Cryptor cryptor = CryptorFactory.getCryptor();
assertThrows(IllegalArgumentException.class, () -> cryptor.decrypt(broken));
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/util/FileObjectUtilsTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/util/FileObjectUtilsTest.java
index 878a264..a026df1 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/util/FileObjectUtilsTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/util/FileObjectUtilsTest.java
@@ -16,6 +16,11 @@
*/
package org.apache.commons.vfs2.util;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
@@ -25,7 +30,6 @@ import java.util.Properties;
import org.apache.commons.lang3.SystemUtils;
import org.apache.commons.vfs2.FileSystemException;
import org.apache.commons.vfs2.VFS;
-import org.junit.Assert;
import org.junit.jupiter.api.Test;
/**
@@ -36,41 +40,41 @@ import org.junit.jupiter.api.Test;
public class FileObjectUtilsTest {
private void assertProperties(final Properties p) {
- Assert.assertNotNull(p);
- Assert.assertEquals("1", p.getProperty("one"));
- Assert.assertEquals("2", p.getProperty("two"));
+ assertNotNull(p);
+ assertEquals("1", p.getProperty("one"));
+ assertEquals("2", p.getProperty("two"));
}
@Test
public void testExistsNotNull() throws FileSystemException {
- Assert.assertTrue(FileObjectUtils.exists(VFS.getManager().toFileObject(SystemUtils.getJavaIoTmpDir())));
+ assertTrue(FileObjectUtils.exists(VFS.getManager().toFileObject(SystemUtils.getJavaIoTmpDir())));
}
@Test
- public void testgetContentAsString_Charset() throws FileSystemException, IOException {
- Assert.assertEquals("This is a test file.",
+ public void testgetContentAsString_Charset() throws IOException {
+ assertEquals("This is a test file.",
FileObjectUtils.getContentAsString(
VFS.getManager().toFileObject(new File("src/test/resources/test-data/read-tests/file1.txt")),
StandardCharsets.UTF_8));
}
@Test
- public void testgetContentAsString_CharsetNull() throws FileSystemException, IOException {
- Assert.assertEquals("This is a test file.",
+ public void testgetContentAsString_CharsetNull() throws IOException {
+ assertEquals("This is a test file.",
FileObjectUtils.getContentAsString(
VFS.getManager().toFileObject(new File("src/test/resources/test-data/read-tests/file1.txt")),
(Charset) null));
}
@Test
- public void testgetContentAsString_String() throws FileSystemException, IOException {
- Assert.assertEquals("This is a test file.", FileObjectUtils.getContentAsString(
+ public void testgetContentAsString_String() throws IOException {
+ assertEquals("This is a test file.", FileObjectUtils.getContentAsString(
VFS.getManager().toFileObject(new File("src/test/resources/test-data/read-tests/file1.txt")), "UTF-8"));
}
@Test
- public void testgetContentAsString_StringNull() throws FileSystemException, IOException {
- Assert.assertEquals("This is a test file.",
+ public void testgetContentAsString_StringNull() throws IOException {
+ assertEquals("This is a test file.",
FileObjectUtils.getContentAsString(
VFS.getManager().toFileObject(new File("src/test/resources/test-data/read-tests/file1.txt")),
(String) null));
@@ -78,13 +82,13 @@ public class FileObjectUtilsTest {
@Test
public void testNotExistsNotNull() throws FileSystemException {
- Assert.assertFalse(
+ assertFalse(
FileObjectUtils.exists(VFS.getManager().toFileObject(new File("This file can't possibly exist, right?"))));
}
@Test
public void testNotExistsNull() throws FileSystemException {
- Assert.assertFalse(FileObjectUtils.exists(null));
+ assertFalse(FileObjectUtils.exists(null));
}
@Test
@@ -94,11 +98,12 @@ public class FileObjectUtilsTest {
}
@Test
- public void testReadPropertiesInto() throws FileSystemException, IOException {
+ public void testReadPropertiesInto() throws IOException {
final Properties p = new Properties();
p.setProperty("extraKey", "extraValue");
assertProperties(FileObjectUtils
.readProperties(VFS.getManager().toFileObject(new File("src/test/resources/test.properties")), p));
- Assert.assertEquals("extraValue", p.getProperty("extraKey"));
+ assertEquals("extraValue", p.getProperty("extraKey"));
}
+
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/util/FreeSocketPortUtil.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/util/FreeSocketPortUtil.java
index 99c7758..87f6480 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/util/FreeSocketPortUtil.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/util/FreeSocketPortUtil.java
@@ -36,4 +36,5 @@ public class FreeSocketPortUtil {
public static void main(final String[] args) throws IOException {
System.out.println(FreeSocketPortUtil.findFreeLocalPort());
}
+
}
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 0f95906..3f12609 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
@@ -255,13 +255,7 @@ public class NHttpFileServer {
server = bootstrap.setIOReactorConfig(config).register("*", new HttpFileHandler(docRoot)).create();
- Runtime.getRuntime().addShutdownHook(new Thread() {
- @Override
- public void run() {
- close();
- }
-
- });
+ Runtime.getRuntime().addShutdownHook(new Thread(() -> close()));
server.start();
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/util/RandomAccessModeTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/util/RandomAccessModeTest.java
index 3599628..4748946 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/util/RandomAccessModeTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/util/RandomAccessModeTest.java
@@ -16,11 +16,11 @@
*/
package org.apache.commons.vfs2.util;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertThrows;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.nio.file.AccessMode;
@@ -71,4 +71,5 @@ public class RandomAccessModeTest {
assertArrayEquals(new AccessMode[] {AccessMode.READ}, RandomAccessMode.READ.toAccessModes());
assertArrayEquals(new AccessMode[] {AccessMode.READ, AccessMode.WRITE}, RandomAccessMode.READWRITE.toAccessModes());
}
+
}