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 2019/12/29 15:49:40 UTC

[commons-vfs] branch master updated: [commons-vfs] clean up tests and simplify assertions (#76)

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 6e15054  [commons-vfs] clean up tests and simplify assertions (#76)
6e15054 is described below

commit 6e15054950bf5d2249cf3296b6ba18522a103bb6
Author: Eitan Adler <gr...@users.noreply.github.com>
AuthorDate: Sun Dec 29 07:49:33 2019 -0800

    [commons-vfs] clean up tests and simplify assertions (#76)
    
    This is a mostly mechanical change to tests such that it is easier to
    convert from junit 3 to junit 4
---
 .../webdav/test/WebdavVersioningTests.java         | 12 ++--
 .../webdav4/test/Webdav4VersioningTests.java       | 12 ++--
 .../commons/vfs2/cache/FileSystemAndNameKey.java   |  2 +
 .../org/apache/commons/AbstractVfsTestCase.java    | 60 +----------------
 .../commons/vfs2/PatternFileSelectorTest.java      | 16 ++---
 .../vfs2/cache/AbstractFilesCacheTestsBase.java    |  2 +-
 .../commons/vfs2/cache/LRUFilesCacheTests.java     |  4 +-
 .../commons/vfs2/cache/NullFilesCacheTests.java    |  2 +-
 .../vfs2/impl/test/DefaultFileMonitorTest.java     | 24 +++----
 .../vfs2/impl/test/VfsClassLoaderTests.java        |  6 +-
 .../vfs2/provider/DefaultFileContentTest.java      |  8 ++-
 .../commons/vfs2/provider/UriParserTestCase.java   |  6 +-
 .../provider/hdfs/test/HdfsFileProviderTest.java   | 10 +--
 .../provider/ram/test/CustomRamProviderTest.java   | 10 +--
 .../vfs2/provider/tar/test/LargeTarTestCase.java   |  3 +-
 .../vfs2/provider/test/FileObjectSortTestCase.java |  6 +-
 .../zip/ZipProviderWithCharsetNullTestCase.java    |  2 +-
 .../vfs2/test/AbstractProviderTestCase.java        | 22 +++----
 .../commons/vfs2/test/AbstractTestSuite.java       |  2 +-
 .../org/apache/commons/vfs2/test/ContentTests.java | 34 +++++-----
 .../org/apache/commons/vfs2/test/NamingTests.java  |  6 +-
 .../apache/commons/vfs2/test/PermissionsTests.java |  2 +-
 .../commons/vfs2/test/ProviderDeleteTests.java     |  6 +-
 .../commons/vfs2/test/ProviderRandomReadTests.java | 28 ++++----
 .../vfs2/test/ProviderRandomSetLengthTests.java    |  2 +-
 .../commons/vfs2/test/ProviderRenameTests.java     | 14 ++--
 .../vfs2/test/ProviderWriteAppendTests.java        |  4 +-
 .../commons/vfs2/test/ProviderWriteTests.java      | 76 +++++++++++-----------
 .../DelegatingFileSystemOptionsBuilderTest.java    |  7 +-
 29 files changed, 170 insertions(+), 218 deletions(-)

diff --git a/commons-vfs2-jackrabbit1/src/test/java/org/apache/commons/vfs2/provider/webdav/test/WebdavVersioningTests.java b/commons-vfs2-jackrabbit1/src/test/java/org/apache/commons/vfs2/provider/webdav/test/WebdavVersioningTests.java
index 9bdaf53..85f91b4 100644
--- a/commons-vfs2-jackrabbit1/src/test/java/org/apache/commons/vfs2/provider/webdav/test/WebdavVersioningTests.java
+++ b/commons-vfs2-jackrabbit1/src/test/java/org/apache/commons/vfs2/provider/webdav/test/WebdavVersioningTests.java
@@ -43,9 +43,9 @@ public class WebdavVersioningTests extends AbstractProviderTestCase {
         builder.setVersioning(opts, true);
         final FileObject file = getManager().resolveFile(scratchFolder, "file1.txt", opts);
         final FileSystemOptions newOpts = file.getFileSystem().getFileSystemOptions();
-        assertTrue(opts == newOpts);
+        assertSame(opts, newOpts);
         assertTrue(builder.isVersioning(newOpts));
-        assertTrue(!file.exists());
+        assertFalse(file.exists());
         file.createFile();
         assertTrue(file.exists());
         assertSame(FileType.FILE, file.getType());
@@ -94,9 +94,9 @@ public class WebdavVersioningTests extends AbstractProviderTestCase {
         builder.setCreatorName(opts, "testUser");
         final FileObject file = getManager().resolveFile(scratchFolder, "file1.txt", opts);
         final FileSystemOptions newOpts = file.getFileSystem().getFileSystemOptions();
-        assertTrue(opts == newOpts);
+        assertSame(opts, newOpts);
         assertTrue(builder.isVersioning(newOpts));
-        assertTrue(!file.exists());
+        assertFalse(file.exists());
         file.createFile();
         assertTrue(file.exists());
         assertSame(FileType.FILE, file.getType());
@@ -110,7 +110,7 @@ public class WebdavVersioningTests extends AbstractProviderTestCase {
         Map<?, ?> map = file.getContent().getAttributes();
         final String name = ((URLFileName) file.getName()).getUserName();
         assertTrue(map.containsKey(DeltaVConstants.CREATOR_DISPLAYNAME.toString()));
-        assertEquals(map.get(DeltaVConstants.CREATOR_DISPLAYNAME.toString()), "testUser");
+        assertEquals("testUser", map.get(DeltaVConstants.CREATOR_DISPLAYNAME.toString()));
         if (name != null) {
             assertTrue(map.containsKey(DeltaVConstants.COMMENT.toString()));
             assertEquals("Modified by user " + name, map.get(DeltaVConstants.COMMENT.toString()));
@@ -129,7 +129,7 @@ public class WebdavVersioningTests extends AbstractProviderTestCase {
         assertSameContent(content, file);
         map = file.getContent().getAttributes();
         assertTrue(map.containsKey(DeltaVConstants.CREATOR_DISPLAYNAME.toString()));
-        assertEquals(map.get(DeltaVConstants.CREATOR_DISPLAYNAME.toString()), "testUser");
+        assertEquals("testUser", map.get(DeltaVConstants.CREATOR_DISPLAYNAME.toString()));
         if (name != null) {
             assertTrue(map.containsKey(DeltaVConstants.COMMENT.toString()));
             assertEquals("Modified by user " + name, map.get(DeltaVConstants.COMMENT.toString()));
diff --git a/commons-vfs2-jackrabbit2/src/test/java/org/apache/commons/vfs2/provider/webdav4/test/Webdav4VersioningTests.java b/commons-vfs2-jackrabbit2/src/test/java/org/apache/commons/vfs2/provider/webdav4/test/Webdav4VersioningTests.java
index da2821a..fa9e8a1 100644
--- a/commons-vfs2-jackrabbit2/src/test/java/org/apache/commons/vfs2/provider/webdav4/test/Webdav4VersioningTests.java
+++ b/commons-vfs2-jackrabbit2/src/test/java/org/apache/commons/vfs2/provider/webdav4/test/Webdav4VersioningTests.java
@@ -45,9 +45,9 @@ public class Webdav4VersioningTests extends AbstractProviderTestCase {
         builder.setVersioning(opts, true);
         final FileObject file = getManager().resolveFile(scratchFolder, "file1.txt", opts);
         final FileSystemOptions newOpts = file.getFileSystem().getFileSystemOptions();
-        assertTrue(opts == newOpts);
+        assertSame(opts, newOpts);
         assertTrue(builder.isVersioning(newOpts));
-        assertTrue(!file.exists());
+        assertFalse(file.exists());
         file.createFile();
         assertTrue(file.exists());
         assertSame(FileType.FILE, file.getType());
@@ -96,9 +96,9 @@ public class Webdav4VersioningTests extends AbstractProviderTestCase {
         builder.setCreatorName(opts, "testUser");
         final FileObject file = getManager().resolveFile(scratchFolder, "file1.txt", opts);
         final FileSystemOptions newOpts = file.getFileSystem().getFileSystemOptions();
-        assertTrue(opts == newOpts);
+        assertSame(opts, newOpts);
         assertTrue(builder.isVersioning(newOpts));
-        assertTrue(!file.exists());
+        assertFalse(file.exists());
         file.createFile();
         assertTrue(file.exists());
         assertSame(FileType.FILE, file.getType());
@@ -112,7 +112,7 @@ public class Webdav4VersioningTests extends AbstractProviderTestCase {
         Map<?, ?> map = file.getContent().getAttributes();
         final String name = ((GenericURLFileName) file.getName()).getUserName();
         assertTrue(map.containsKey(DeltaVConstants.CREATOR_DISPLAYNAME.toString()));
-        assertEquals(map.get(DeltaVConstants.CREATOR_DISPLAYNAME.toString()), "testUser");
+        assertEquals("testUser", map.get(DeltaVConstants.CREATOR_DISPLAYNAME.toString()));
         if (name != null) {
             assertTrue(map.containsKey(DeltaVConstants.COMMENT.toString()));
             assertEquals("Modified by user " + name, map.get(DeltaVConstants.COMMENT.toString()));
@@ -131,7 +131,7 @@ public class Webdav4VersioningTests extends AbstractProviderTestCase {
         assertSameContent(content, file);
         map = file.getContent().getAttributes();
         assertTrue(map.containsKey(DeltaVConstants.CREATOR_DISPLAYNAME.toString()));
-        assertEquals(map.get(DeltaVConstants.CREATOR_DISPLAYNAME.toString()), "testUser");
+        assertEquals("testUser", map.get(DeltaVConstants.CREATOR_DISPLAYNAME.toString()));
         if (name != null) {
             assertTrue(map.containsKey(DeltaVConstants.COMMENT.toString()));
             assertEquals("Modified by user " + name, map.get(DeltaVConstants.COMMENT.toString()));
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/FileSystemAndNameKey.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/FileSystemAndNameKey.java
index e7d1c57..2d13134 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/FileSystemAndNameKey.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/FileSystemAndNameKey.java
@@ -19,6 +19,8 @@ package org.apache.commons.vfs2.cache;
 import org.apache.commons.vfs2.FileName;
 import org.apache.commons.vfs2.FileSystem;
 
+import java.util.Comparator;
+
 /**
  * Key for various cache implementations.
  * <p>
diff --git a/commons-vfs2/src/test/java/org/apache/commons/AbstractVfsTestCase.java b/commons-vfs2/src/test/java/org/apache/commons/AbstractVfsTestCase.java
index c996848..a4e1dc9 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/AbstractVfsTestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/AbstractVfsTestCase.java
@@ -18,7 +18,6 @@ package org.apache.commons;
 
 import java.io.File;
 import java.io.IOException;
-import java.lang.reflect.Method;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.regex.Matcher;
@@ -42,24 +41,6 @@ public abstract class AbstractVfsTestCase extends TestCase {
     private static final Pattern PASSWORD_PATTERN = Pattern.compile(":(?:[^/]+)@");
 
     /**
-     * Returns the name of the package containing a class.
-     *
-     * @return The . delimited package name, or an empty string if the class is in the default package.
-     */
-    public static String getPackageName(final Class<?> clazz) {
-        final Package pkg = clazz.getPackage();
-        if (null != pkg) {
-            return pkg.getName();
-        }
-
-        final String name = clazz.getName();
-        if (-1 == name.lastIndexOf(".")) {
-            return "";
-        }
-        return name.substring(0, name.lastIndexOf("."));
-    }
-
-    /**
      * Locates a test resource, and asserts that the resource exists
      *
      * @param name path of the resource, relative to this test's base directory.
@@ -79,7 +60,7 @@ public abstract class AbstractVfsTestCase extends TestCase {
         if (mustExist) {
             assertTrue("Test file \"" + file + "\" does not exist.", file.exists());
         } else {
-            assertTrue("Test file \"" + file + "\" should not exist.", !file.exists());
+            assertFalse("Test file \"" + file + "\" should not exist.", file.exists());
         }
 
         return file;
@@ -145,46 +126,9 @@ public abstract class AbstractVfsTestCase extends TestCase {
     }
 
     /**
-     * Asserts that an exception chain contains the expected messages.
-     *
-     * @param messages The messages, in order. A null entry in this array indicates that the message should be ignored.
-     */
-    public static void assertSameMessage(final String[] messages, final Throwable throwable) {
-        Throwable current = throwable;
-        for (final String message : messages) {
-            assertNotNull(current);
-            if (message != null) {
-                assertEquals(message, current.getMessage());
-            }
-
-            // Get the next exception in the chain
-            current = getCause(current);
-        }
-    }
-
-    /**
-     * Returns the cause of an exception.
-     */
-    public static Throwable getCause(final Throwable throwable) {
-        try {
-            final Method method = throwable.getClass().getMethod("getCause", (Class[]) null);
-            return (Throwable) method.invoke(throwable, (Object[]) null);
-        } catch (final Exception e) {
-            return null;
-        }
-    }
-
-    /**
-     * Asserts that an exception contains the expected message.
-     */
-    public static void assertSameMessage(final String code, final Throwable throwable) {
-        assertSameMessage(code, new Object[0], throwable);
-    }
-
-    /**
      * Asserts that an exception contains the expected message.
      */
-    public static void assertSameMessage(final String code, final Object[] params, final Throwable throwable) {
+    private static void assertSameMessage(final String code, final Object[] params, final Throwable throwable) {
         Object[] parmArray = params;
         if (throwable instanceof FileSystemException) {
             final FileSystemException fse = (FileSystemException) throwable;
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 f6d398a..b05f8dc 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
@@ -96,7 +96,7 @@ public class PatternFileSelectorTest {
     @Test
     public void testMatchAll() throws Exception {
         final FileObject[] list = BaseFolder.findFiles(new PatternFileSelector(".*"));
-        Assert.assertEquals(EntryCount, list.length);
+        assertEquals(EntryCount, list.length);
     }
 
     /**
@@ -116,18 +116,18 @@ public class PatternFileSelectorTest {
         }
         final String message = String.format("Extensions: %s; files: %s", extensionSet.toString(),
                 Arrays.asList(foArray).toString());
-        Assert.assertEquals(message, ExtensionCount, extensionSet.size());
+        assertEquals(message, ExtensionCount, extensionSet.size());
         // check each extension
         for (final String extension : extensionSet) {
             final FileSelector selector = new PatternFileSelector(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 PatternFileSelector(regExPrefix + fo.getName().getExtension());
             final FileObject[] list = BaseFolder.findFiles(selector);
-            Assert.assertEquals(FilesPerExtensionCount, list.length);
+            assertEquals(FilesPerExtensionCount, list.length);
         }
     }
 
@@ -139,8 +139,8 @@ public class PatternFileSelectorTest {
     @Test
     public void testMatchPartial() throws Exception {
         final FileObject[] list = BaseFolder.findFiles(new PatternFileSelector(".*a.htm"));
-        Assert.assertEquals(1, list.length);
-        assertEquals(list[0].getName().getBaseName(), "aa.htm");
+        assertEquals(1, list.length);
+        assertEquals("aa.htm", list[0].getName().getBaseName());
     }
 
     /**
@@ -151,8 +151,8 @@ public class PatternFileSelectorTest {
     @Test
     public void testMatchPartialDelimited() throws Exception {
         final FileObject[] list = BaseFolder.findFiles(new PatternFileSelector("^.*\\/b.htm$"));
-        Assert.assertEquals(1, list.length);
-        assertEquals(list[0].getName().getBaseName(), "b.htm");
+        assertEquals(1, list.length);
+        assertEquals("b.htm", list[0].getName().getBaseName());
     }
 
     static FileObject getBaseFolder() {
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 75e7593..2ed68c3 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
@@ -46,7 +46,7 @@ public abstract class AbstractFilesCacheTestsBase extends AbstractProviderTestCa
 
         final FileObject fo2 = getWriteFolder().resolveFile("dir1");
 
-        assertFalse("Objects after cache clear should be different", fo1 == fo2);
+        assertNotSame("Objects after cache clear should be different", fo1, fo2);
     }
 
     /**
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 6fe761b..d5bf5b0 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
@@ -64,11 +64,11 @@ public class LRUFilesCacheTests extends AbstractFilesCacheTestsBase {
 
         // check if the cache still holds the right instance
         final FileObject dir2_2 = scratchFolder.resolveFile("dir2");
-        assertTrue(dir2 == dir2_2);
+        assertSame(dir2, dir2_2);
 
         // check if the cache still holds the right instance
         final FileObject dir1_2 = scratchFolder.resolveFile("dir1");
-        assertFalse(dir1 == dir1_2);
+        assertNotSame(dir1, dir1_2);
     }
 
     public void testClass() {
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 68a5985..2eda9b3 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
@@ -35,7 +35,7 @@ public class NullFilesCacheTests extends AbstractFilesCacheTestsBase {
         final FileObject dir1 = scratchFolder.resolveFile("dir1");
         final FileObject dir1_2 = scratchFolder.resolveFile("dir1");
 
-        assertFalse("Should always be new instance with NullCache", dir1 == dir1_2);
+        assertNotSame("Should always be new instance with NullCache", dir1, dir1_2);
     }
 
     @Override
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/test/DefaultFileMonitorTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/test/DefaultFileMonitorTest.java
index 8e78cdc..3940d62 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/test/DefaultFileMonitorTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/test/DefaultFileMonitorTest.java
@@ -54,8 +54,8 @@ public class DefaultFileMonitorTest extends AbstractVfsTestCase {
 
     @Override
     public void tearDown() throws Exception {
-        if (testFile != null && testFile.exists()) {
-            testFile.delete();
+        if (testFile != null) {
+            testFile.deleteOnExit();
         }
         super.tearDown();
     }
@@ -71,7 +71,7 @@ public class DefaultFileMonitorTest extends AbstractVfsTestCase {
             writeToFile(testFile);
             Thread.sleep(300);
             assertTrue("No event occurred", changeStatus != 0);
-            assertTrue("Incorrect event", changeStatus == 3);
+            assertEquals("Incorrect event", 3, changeStatus);
         } finally {
             monitor.stop();
         }
@@ -89,7 +89,7 @@ public class DefaultFileMonitorTest extends AbstractVfsTestCase {
             testFile.delete();
             Thread.sleep(300);
             assertTrue("No event occurred", changeStatus != 0);
-            assertTrue("Incorrect event", changeStatus == 2);
+            assertEquals("Incorrect event", 2, changeStatus);
         } finally {
             monitor.stop();
         }
@@ -112,7 +112,7 @@ public class DefaultFileMonitorTest extends AbstractVfsTestCase {
             assertTrue("setLastModified succeeded", rc);
             Thread.sleep(300);
             assertTrue("No event occurred", changeStatus != 0);
-            assertTrue("Incorrect event", changeStatus == 1);
+            assertEquals("Incorrect event", 1, changeStatus);
         } finally {
             monitor.stop();
         }
@@ -129,19 +129,19 @@ public class DefaultFileMonitorTest extends AbstractVfsTestCase {
             writeToFile(testFile);
             Thread.sleep(300);
             assertTrue("No event occurred", changeStatus != 0);
-            assertTrue("Incorrect event " + changeStatus, changeStatus == 3);
+            assertEquals("Incorrect event " + changeStatus, 3, changeStatus);
             changeStatus = 0;
             testFile.delete();
             Thread.sleep(300);
             assertTrue("No event occurred", changeStatus != 0);
-            assertTrue("Incorrect event " + changeStatus, changeStatus == 2);
+            assertEquals("Incorrect event " + changeStatus, 2, changeStatus);
             changeStatus = 0;
             Thread.sleep(500);
             monitor.addFile(fileObj);
             writeToFile(testFile);
             Thread.sleep(300);
             assertTrue("No event occurred", changeStatus != 0);
-            assertTrue("Incorrect event " + changeStatus, changeStatus == 3);
+            assertEquals("Incorrect event " + changeStatus, 3, changeStatus);
         } finally {
             monitor.stop();
         }
@@ -161,13 +161,13 @@ public class DefaultFileMonitorTest extends AbstractVfsTestCase {
             testFile.delete();
             Thread.sleep(3000);
             assertTrue("No event occurred", changeStatus != 0);
-            assertTrue("Incorrect event " + changeStatus, changeStatus == 2);
+            assertEquals("Incorrect event " + changeStatus, 2, changeStatus);
             changeStatus = 0;
             Thread.sleep(300);
             writeToFile(testFile);
             Thread.sleep(3000);
             assertTrue("No event occurred", changeStatus != 0);
-            assertTrue("Incorrect event " + changeStatus, changeStatus == 3);
+            assertEquals("Incorrect event " + changeStatus, 3, changeStatus);
         } finally {
             monitor.stop();
         }
@@ -186,7 +186,7 @@ public class DefaultFileMonitorTest extends AbstractVfsTestCase {
             Thread.sleep(300);
             testFile.delete();
             Thread.sleep(3000);
-            assertTrue("Event should not have occurred", changeStatus == 0);
+            assertEquals("Event should not have occurred", 0, changeStatus);
         } finally {
             monitor.stop();
         }
@@ -209,7 +209,7 @@ public class DefaultFileMonitorTest extends AbstractVfsTestCase {
             testFile.delete();
             Thread.sleep(300);
             assertTrue("No event occurred", changeStatus != 0);
-            assertTrue("Incorrect event", changeStatus == 2);
+            assertEquals("Incorrect event", 2, changeStatus);
         } finally {
             monitor.stop();
         }
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/test/VfsClassLoaderTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/test/VfsClassLoaderTests.java
index 8df392b..70659c5 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/test/VfsClassLoaderTests.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/test/VfsClassLoaderTests.java
@@ -122,8 +122,8 @@ public class VfsClassLoaderTests extends AbstractProviderTestCase {
         }
 
         // verify test setup
-        assertTrue("nested.jar is required for testing", nestedJar.getType() == FileType.FILE);
-        assertTrue("test.jar is required for testing", testJar.getType() == FileType.FILE);
+        assertSame("nested.jar is required for testing", nestedJar.getType(), FileType.FILE);
+        assertSame("test.jar is required for testing", testJar.getType(), FileType.FILE);
 
         // System class loader (null) might be unpredictable in regards
         // to returning resources for META-INF/MANIFEST.MF (see VFS-500)
@@ -161,7 +161,7 @@ public class VfsClassLoaderTests extends AbstractProviderTestCase {
 
         // setup test folder
         final FileObject dir = manager.resolveFile(baseDir, "read-tests/dir1/subdir4.jar");
-        assertTrue("subdir4.jar/ is required for testing " + dir, dir.getType() == FileType.FOLDER);
+        assertSame("subdir4.jar/ is required for testing " + dir, dir.getType(), FileType.FOLDER);
         assertFalse(manager.canCreateFileSystem(dir));
 
         // prepare classloader
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 71f426f..ed89c47 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
@@ -64,10 +64,12 @@ public class DefaultFileContentTest {
         }
     }
 
+    @Test
     public void testInputStreamBufferSize0() throws Exception {
         testInputStreamBufferSize(0);
     }
 
+    @Test
     public void testInputStreamBufferSize1() throws Exception {
         testInputStreamBufferSize(1);
     }
@@ -95,10 +97,10 @@ public class DefaultFileContentTest {
                         final byte[] data = new byte[100];
                         readCount = stream.read(data, 0, 7);
                         stream.read();
-                        Assert.assertEquals(readCount, 7);
+                        Assert.assertEquals(7, readCount);
                         Assert.assertEquals(expected, new String(data).trim());
                         readCount = stream.read(data, 8, 10);
-                        Assert.assertEquals(readCount, -1);
+                        Assert.assertEquals(-1, readCount);
                         stream.reset();
                     }
                 }
@@ -140,10 +142,12 @@ public class DefaultFileContentTest {
         }
     }
 
+    @Test
     public void testOutputStreamBufferSize0() throws Exception {
         testOutputStreamBufferSize(0);
     }
 
+    @Test
     public void testOutputStreamBufferSize1() throws Exception {
         testOutputStreamBufferSize(1);
     }
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/UriParserTestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/UriParserTestCase.java
index fb734e5..4091c0d 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/UriParserTestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/UriParserTestCase.java
@@ -35,12 +35,12 @@ public class UriParserTestCase {
 
 	@Test
 	public void testColonInFileNameAndNotSupportedScheme() {
-		Assert.assertEquals(null, UriParser.extractScheme(schemes, "some:file"));
+        Assert.assertNull(UriParser.extractScheme(schemes, "some:file"));
 	}
 
 	@Test
 	public void testColonInFileNameWithPath() {
-		Assert.assertEquals(null, UriParser.extractScheme(schemes, "some/path/some:file"));
+        Assert.assertNull(UriParser.extractScheme(schemes, "some/path/some:file"));
 	}
 
 	@Test
@@ -74,7 +74,7 @@ public class UriParserTestCase {
 
 	@Test
 	public void testColonInFileName() {
-		Assert.assertEquals(null, UriParser.extractScheme("some/path/some:file"));
+        Assert.assertNull(UriParser.extractScheme("some/path/some:file"));
 	}
 
 }
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/hdfs/test/HdfsFileProviderTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/hdfs/test/HdfsFileProviderTest.java
index 7bd14c6..ee1f789 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/hdfs/test/HdfsFileProviderTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/hdfs/test/HdfsFileProviderTest.java
@@ -148,14 +148,14 @@ public class HdfsFileProviderTest {
         final FileObject dir = manager.resolveFile(TEST_DIR1);
         Assert.assertNotNull(dir);
         Assert.assertTrue(dir.exists());
-        Assert.assertTrue(dir.getType().equals(FileType.FOLDER));
+        Assert.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.assertTrue(f.getType().equals(FileType.FILE));
+        Assert.assertEquals(f.getType(), FileType.FILE);
         return f;
     }
 
@@ -178,8 +178,8 @@ public class HdfsFileProviderTest {
         final FileObject dir = file.getParent();
 
         final FileObject[] children = dir.getChildren();
-        Assert.assertTrue(children.length == 1);
-        Assert.assertTrue(children[0].getName().equals(file.getName()));
+        Assert.assertEquals(1, children.length);
+        Assert.assertEquals(children[0].getName(), file.getName());
 
     }
 
@@ -298,7 +298,7 @@ public class HdfsFileProviderTest {
         // Create the test file
         final FileObject file = createTestFile(hdfs);
         Assert.assertTrue(fo.exists());
-        Assert.assertFalse(-1 == file.getContent().getLastModifiedTime());
+        Assert.assertNotEquals(-1, file.getContent().getLastModifiedTime());
     }
 
     @Test(expected = FileSystemException.class)
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ram/test/CustomRamProviderTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ram/test/CustomRamProviderTest.java
index 6bdc1b1..e6cc0b2 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ram/test/CustomRamProviderTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ram/test/CustomRamProviderTest.java
@@ -19,6 +19,8 @@ package org.apache.commons.vfs2.provider.ram.test;
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertSame;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
@@ -228,7 +230,7 @@ public class CustomRamProviderTest {
         // Default FS
         final FileObject fo1 = manager.resolveFile("ram:/");
         final FileObject fo2 = manager.resolveFile("ram:/");
-        assertTrue("Both files should exist in the same fs instance.", fo1.getFileSystem() == fo2.getFileSystem());
+        assertSame("Both files should exist in the same fs instance.", fo1.getFileSystem(), fo2.getFileSystem());
 
         FileSystemOptions fsOptions = fo1.getFileSystem().getFileSystemOptions();
         long maxFilesystemSize = RamFileSystemConfigBuilder.getInstance().getLongMaxSize(fsOptions);
@@ -237,10 +239,8 @@ public class CustomRamProviderTest {
         // Small FS
         final FileObject fo3 = manager.resolveFile("ram:/fo3", smallSizedFso);
         final FileObject fo4 = manager.resolveFile("ram:/", smallSizedFso);
-        assertTrue("Both files should exist in the same FileSystem instance.",
-                fo3.getFileSystem() == fo4.getFileSystem());
-        assertTrue("Both files should exist in different FileSystem instance.",
-                fo1.getFileSystem() != fo3.getFileSystem());
+        assertSame("Both files should exist in the same FileSystem instance.", fo3.getFileSystem(), fo4.getFileSystem());
+        assertNotSame("Both files should exist in different FileSystem instance.", fo1.getFileSystem(), fo3.getFileSystem());
 
         fsOptions = fo3.getFileSystem().getFileSystemOptions();
         maxFilesystemSize = RamFileSystemConfigBuilder.getInstance().getLongMaxSize(fsOptions);
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/tar/test/LargeTarTestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/tar/test/LargeTarTestCase.java
index 0dcd8ca..360dc57 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/tar/test/LargeTarTestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/tar/test/LargeTarTestCase.java
@@ -79,8 +79,7 @@ public class LargeTarTestCase {
         assertEquals(1, files.size());
         final FileObject f = files.get(0);
 
-        assertTrue("Expected file not found: " + largeFileName + ".txt",
-                f.getName().getBaseName().equals(largeFileName + ".txt"));
+        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/test/FileObjectSortTestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/test/FileObjectSortTestCase.java
index 93eb682..b821598 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/test/FileObjectSortTestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/test/FileObjectSortTestCase.java
@@ -116,9 +116,9 @@ public class FileObjectSortTestCase {
     public void testSortListMoveAll() throws FileSystemException {
         final List<FileObject> actualList = Arrays.asList(UnSortedArray);
         final List<FileObject> expectedSortedList = Arrays.asList(SortedArray);
-        Assert.assertFalse(actualList.equals(expectedSortedList));
+        Assert.assertNotEquals(actualList, expectedSortedList);
         Collections.sort(actualList);
-        Assert.assertTrue(actualList.equals(expectedSortedList));
+        Assert.assertEquals(actualList, expectedSortedList);
     }
 
     /**
@@ -131,7 +131,7 @@ public class FileObjectSortTestCase {
         final List<FileObject> actualList = Arrays.asList(SortedArray);
         final List<FileObject> expectedSortedList = Arrays.asList(SortedArray);
         Collections.sort(actualList);
-        Assert.assertTrue(actualList.equals(expectedSortedList));
+        Assert.assertEquals(actualList, expectedSortedList);
     }
 
 }
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 a247894..ff72b86 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
@@ -67,7 +67,7 @@ public class ZipProviderWithCharsetNullTestCase extends AbstractProviderTestConf
         final FileSystem fileSystem = resolvedFile.getFileSystem();
         Assert.assertTrue(fileSystem instanceof ZipFileSystem);
         final ZipFileSystem zipFileSystem = (ZipFileSystem) fileSystem;
-        Assert.assertEquals(null, zipFileSystem.getCharset());
+        Assert.assertNull(zipFileSystem.getCharset());
         return resolvedFile;
     }
 }
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/AbstractProviderTestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/AbstractProviderTestCase.java
index a7afba5..927ca39 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/AbstractProviderTestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/AbstractProviderTestCase.java
@@ -16,13 +16,8 @@
  */
 package org.apache.commons.vfs2.test;
 
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.net.URLConnection;
-import java.util.Arrays;
-
+import junit.framework.Test;
+import junit.framework.TestCase;
 import org.apache.commons.AbstractVfsTestCase;
 import org.apache.commons.vfs2.Capability;
 import org.apache.commons.vfs2.FileContent;
@@ -36,8 +31,13 @@ import org.apache.commons.vfs2.provider.AbstractFileSystem;
 import org.apache.commons.vfs2.provider.local.DefaultLocalFileProvider;
 import org.junit.Assert;
 
-import junit.framework.Test;
-import junit.framework.TestCase;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.net.URLConnection;
+
+import static org.junit.Assert.assertArrayEquals;
 
 /**
  * File system test cases, which verifies the structure and naming functionality.
@@ -244,7 +244,7 @@ public abstract class AbstractProviderTestCase extends AbstractVfsTestCase {
         }
 
         // Compare
-        assertTrue("same binary content", Arrays.equals(expectedBin, outstr.toByteArray()));
+        assertArrayEquals("same binary content", expectedBin, outstr.toByteArray());
     }
 
     /**
@@ -281,7 +281,7 @@ public abstract class AbstractProviderTestCase extends AbstractVfsTestCase {
         }
 
         // Compare
-        assertTrue("same binary content", Arrays.equals(expectedBin, outstr.toByteArray()));
+        assertArrayEquals("same binary content", expectedBin, outstr.toByteArray());
     }
 
     /**
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/AbstractTestSuite.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/AbstractTestSuite.java
index ce9e3c6..06890f1 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/AbstractTestSuite.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/AbstractTestSuite.java
@@ -166,7 +166,7 @@ public abstract class AbstractTestSuite extends TestSetup {
 
         // Make some assumptions about the read folder
         Assert.assertTrue("Folder does not exist: " + readFolder, readFolder.exists());
-        Assert.assertFalse(readFolder.getName().getPath().equals(FileName.ROOT_PATH));
+        Assert.assertNotEquals(readFolder.getName().getPath(), FileName.ROOT_PATH);
 
         // Configure the tests
         final Enumeration<Test> tests = testSuite.tests();
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ContentTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ContentTests.java
index ca65d78..b2e7e90 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ContentTests.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ContentTests.java
@@ -64,22 +64,22 @@ public class ContentTests extends AbstractProviderTestCase {
         // Test a file
         FileObject file = getReadFolder().resolveFile("file1.txt");
         assertTrue("file exists", file.exists());
-        assertTrue("file exists", file.getType() != FileType.IMAGINARY);
+        assertNotSame("file exists", file.getType(), FileType.IMAGINARY);
 
         // Test a folder
         file = getReadFolder().resolveFile("dir1");
         assertTrue("folder exists", file.exists());
-        assertTrue("folder exists", file.getType() != FileType.IMAGINARY);
+        assertNotSame("folder exists", file.getType(), FileType.IMAGINARY);
 
         // Test an unknown file
         file = getReadFolder().resolveFile("unknown-child");
-        assertTrue("unknown file does not exist", !file.exists());
-        assertTrue("unknown file does not exist", file.getType() == FileType.IMAGINARY);
+        assertFalse("unknown file does not exist", file.exists());
+        assertSame("unknown file does not exist", file.getType(), FileType.IMAGINARY);
 
         // Test an unknown file in an unknown folder
         file = getReadFolder().resolveFile("unknown-folder/unknown-child");
-        assertTrue("unknown file does not exist", !file.exists());
-        assertTrue("unknown file does not exist", file.getType() == FileType.IMAGINARY);
+        assertFalse("unknown file does not exist", file.exists());
+        assertSame("unknown file does not exist", file.getType(), FileType.IMAGINARY);
     }
 
     /**
@@ -113,7 +113,7 @@ public class ContentTests extends AbstractProviderTestCase {
 
     private void testRoot(final FileObject root) throws FileSystemException {
         assertTrue(root.exists());
-        assertTrue(root.getType() != FileType.IMAGINARY);
+        assertNotSame(root.getType(), FileType.IMAGINARY);
     }
 
     /**
@@ -130,14 +130,14 @@ public class ContentTests extends AbstractProviderTestCase {
         // Test when file does not exist
         child = folder.resolveFile("unknown-file");
         assertTrue("folder exists", folder.exists());
-        assertTrue("child does not exist", !child.exists());
+        assertFalse("child does not exist", child.exists());
         assertSame(folder, child.getParent());
 
         // Test when neither exists
         folder = getReadFolder().resolveFile("unknown-folder");
         child = folder.resolveFile("unknown-file");
-        assertTrue("folder does not exist", !folder.exists());
-        assertTrue("child does not exist", !child.exists());
+        assertFalse("folder does not exist", folder.exists());
+        assertFalse("child does not exist", child.exists());
         assertSame(folder, child.getParent());
 
         // Test the parent of the root of the file system
@@ -174,7 +174,7 @@ public class ContentTests extends AbstractProviderTestCase {
 
         // Check for unknown file
         file = getReadFolder().resolveFile("unknown-file");
-        assertTrue(!file.exists());
+        assertFalse(file.exists());
         try {
             file.getChildren();
             fail();
@@ -303,16 +303,16 @@ public class ContentTests extends AbstractProviderTestCase {
 
         // Open some input streams
         final InputStream instr1 = file.getContent().getInputStream();
-        assertTrue(instr1.read() == FILE1_CONTENT.charAt(0));
+        assertEquals(instr1.read(), FILE1_CONTENT.charAt(0));
         final InputStream instr2 = file.getContent().getInputStream();
-        assertTrue(instr2.read() == FILE1_CONTENT.charAt(0));
+        assertEquals(instr2.read(), FILE1_CONTENT.charAt(0));
 
         // Close the file
         file.close();
 
         // Check
-        assertTrue(instr1.read() == -1);
-        assertTrue(instr2.read() == -1);
+        assertEquals(instr1.read(), -1);
+        assertEquals(instr2.read(), -1);
     }
 
     /**
@@ -326,13 +326,13 @@ public class ContentTests extends AbstractProviderTestCase {
 
         // Open some input streams
         final InputStream instr1 = file.getContent().getInputStream();
-        assertTrue(instr1.read() == FILE1_CONTENT.charAt(0));
+        assertEquals(instr1.read(), FILE1_CONTENT.charAt(0));
 
         // Close the file
         file.close();
 
         // Check
-        assertTrue(instr1.read() == -1);
+        assertEquals(instr1.read(), -1);
     }
 
     /**
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/NamingTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/NamingTests.java
index 25c06d7..3107156 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/NamingTests.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/NamingTests.java
@@ -162,9 +162,9 @@ public class NamingTests extends AbstractProviderTestCase {
      */
     private void checkDescendentNames(final FileName name, final NameScope scope) throws Exception {
         // Make some assumptions about the name
-        assertTrue(!name.getPath().equals("/"));
-        assertTrue(!name.getPath().endsWith("/a"));
-        assertTrue(!name.getPath().endsWith("/a/b"));
+        assertFalse(name.getPath().equals("/"));
+        assertFalse(name.getPath().endsWith("/a"));
+        assertFalse(name.getPath().endsWith("/a/b"));
 
         // Test names with the same prefix
         final String path = name.getPath() + "/a";
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/PermissionsTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/PermissionsTests.java
index 11f092d..340d12a 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/PermissionsTests.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/PermissionsTests.java
@@ -136,7 +136,7 @@ public class PermissionsTests extends AbstractProviderTestCase {
 
         // Create direct child of the test folder
         final FileObject file = scratchFolder.resolveFile(FILENAME);
-        assertTrue(!file.exists());
+        assertFalse(file.exists());
 
         // Create the source file
         final String content = "Here is some sample content for the file.  Blah Blah Blah.";
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ProviderDeleteTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ProviderDeleteTests.java
index a239e1a..ae06fb4 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ProviderDeleteTests.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ProviderDeleteTests.java
@@ -83,7 +83,7 @@ public class ProviderDeleteTests extends AbstractProviderTestCase {
     public void testDeleteFiles() throws Exception {
         final FileObject scratchFolder = createScratchFolder();
 
-        assertEquals(scratchFolder.delete(Selectors.EXCLUDE_SELF), 4);
+        assertEquals(4, scratchFolder.delete(Selectors.EXCLUDE_SELF));
     }
 
     /**
@@ -114,7 +114,7 @@ public class ProviderDeleteTests extends AbstractProviderTestCase {
     public void testDeleteAllFiles() throws Exception {
         final FileObject scratchFolder = createScratchFolder();
 
-        assertEquals(scratchFolder.delete(new FileTypeSelector(FileType.FILE)), 2);
+        assertEquals(2, scratchFolder.delete(new FileTypeSelector(FileType.FILE)));
     }
 
     /**
@@ -123,6 +123,6 @@ public class ProviderDeleteTests extends AbstractProviderTestCase {
     public void testDeleteOneFiles() throws Exception {
         final FileObject scratchFolder = createScratchFolder();
 
-        assertEquals(scratchFolder.delete(new FileNameSelector("a.txt")), 1);
+        assertEquals(1, scratchFolder.delete(new FileNameSelector("a.txt")));
     }
 }
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ProviderRandomReadTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ProviderRandomReadTests.java
index 957980b..d7794f9 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ProviderRandomReadTests.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ProviderRandomReadTests.java
@@ -47,38 +47,38 @@ public class ProviderRandomReadTests extends AbstractProviderTestCase {
 
             // read first byte
             byte c = ra.readByte();
-            assertEquals(c, TEST_DATA.charAt(0));
-            assertEquals("fp", ra.getFilePointer(), 1);
+            assertEquals(TEST_DATA.charAt(0), c);
+            assertEquals("fp", 1, ra.getFilePointer());
 
             // start at pos 4
             ra.seek(3);
             c = ra.readByte();
-            assertEquals(c, TEST_DATA.charAt(3));
-            assertEquals("fp", ra.getFilePointer(), 4);
+            assertEquals(TEST_DATA.charAt(3), c);
+            assertEquals("fp", 4, ra.getFilePointer());
 
             c = ra.readByte();
-            assertEquals(c, TEST_DATA.charAt(4));
-            assertEquals("fp", ra.getFilePointer(), 5);
+            assertEquals(TEST_DATA.charAt(4), c);
+            assertEquals("fp", 5, ra.getFilePointer());
 
             // restart at pos 4
             ra.seek(3);
             c = ra.readByte();
-            assertEquals(c, TEST_DATA.charAt(3));
-            assertEquals("fp", ra.getFilePointer(), 4);
+            assertEquals(TEST_DATA.charAt(3), c);
+            assertEquals("fp", 4, ra.getFilePointer());
 
             c = ra.readByte();
-            assertEquals(c, TEST_DATA.charAt(4));
-            assertEquals("fp", ra.getFilePointer(), 5);
+            assertEquals(TEST_DATA.charAt(4), c);
+            assertEquals("fp", 5, ra.getFilePointer());
 
             // advance to pos 11
             ra.seek(10);
             c = ra.readByte();
-            assertEquals(c, TEST_DATA.charAt(10));
-            assertEquals("fp", ra.getFilePointer(), 11);
+            assertEquals(TEST_DATA.charAt(10), c);
+            assertEquals("fp", 11, ra.getFilePointer());
 
             c = ra.readByte();
-            assertEquals(c, TEST_DATA.charAt(11));
-            assertEquals("fp", ra.getFilePointer(), 12);
+            assertEquals(TEST_DATA.charAt(11), c);
+            assertEquals("fp", 12, ra.getFilePointer());
         } finally {
             if (file != null) {
                 file.close();
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ProviderRandomSetLengthTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ProviderRandomSetLengthTests.java
index 5e644a4..3fc5d70 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ProviderRandomSetLengthTests.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ProviderRandomSetLengthTests.java
@@ -74,7 +74,7 @@ public class ProviderRandomSetLengthTests extends AbstractProviderTestCase {
             Assert.assertEquals(fileString, 1, ra.length());
             // now read 1
             ra.seek(0);
-            Assert.assertEquals(fileString, ra.readByte(), TEST_DATA.charAt(0));
+            Assert.assertEquals(fileString, TEST_DATA.charAt(0), ra.readByte());
 
             try {
                 ra.readByte();
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ProviderRenameTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ProviderRenameTests.java
index ea60d8b..698ef98 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ProviderRenameTests.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ProviderRenameTests.java
@@ -54,11 +54,11 @@ public class ProviderRenameTests extends AbstractProviderTestCase {
     private void moveFile(final FileObject scratchFolder, final FileObject file, final String content)
             throws FileSystemException, Exception {
         final FileObject fileMove = scratchFolder.resolveFile("file1move.txt");
-        assertTrue(!fileMove.exists());
+        assertFalse(fileMove.exists());
 
         file.moveTo(fileMove);
 
-        assertTrue(!file.exists());
+        assertFalse(file.exists());
         assertTrue(fileMove.exists());
 
         assertSameContent(content, fileMove);
@@ -91,7 +91,7 @@ public class ProviderRenameTests extends AbstractProviderTestCase {
 
         // Create direct child of the test folder
         final FileObject file = scratchFolder.resolveFile("file1.txt");
-        assertTrue(!file.exists());
+        assertFalse(file.exists());
 
         final String content = createTestFile(file);
 
@@ -109,14 +109,14 @@ public class ProviderRenameTests extends AbstractProviderTestCase {
 
         // Create direct child of the test folder
         final FileObject file = scratchFolder.resolveFile("file1.txt");
-        assertTrue(!file.exists());
+        assertFalse(file.exists());
 
         final String content = createTestFile(file);
 
         final FileObject destFolder = scratchFolder.resolveFile("empty-target-folder");
         destFolder.createFolder();
         assertTrue("new destination must be folder", destFolder.getType().hasChildren());
-        assertTrue("new destination must be emty", destFolder.getChildren().length == 0);
+        assertEquals("new destination must be emty", 0, destFolder.getChildren().length);
 
         moveFile(destFolder, file, content);
     }
@@ -132,12 +132,12 @@ public class ProviderRenameTests extends AbstractProviderTestCase {
         folder.createFolder();
         assertTrue(folder.exists());
         final FileObject file = folder.resolveFile("file1.txt");
-        assertTrue(!file.exists());
+        assertFalse(file.exists());
 
         final String content = createTestFile(file);
 
         // Make sure we can move the new file to another file on the same file system
         moveFile(scratchFolder, file, content);
-        assertTrue(folder.getChildren().length == 0);
+        assertEquals(0, folder.getChildren().length);
     }
 }
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ProviderWriteAppendTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ProviderWriteAppendTests.java
index 1d2fd83..f794b9e 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ProviderWriteAppendTests.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ProviderWriteAppendTests.java
@@ -56,7 +56,7 @@ public class ProviderWriteAppendTests extends AbstractProviderTestCase {
 
         // Create direct child of the test folder
         final FileObject file = scratchFolder.resolveFile("file1.txt");
-        assertTrue(!file.exists());
+        assertFalse(file.exists());
 
         // Create the source file
         final String content = "Here is some sample content for the file.  Blah Blah Blah.";
@@ -81,7 +81,7 @@ public class ProviderWriteAppendTests extends AbstractProviderTestCase {
 
         // Make sure we can copy the new file to another file on the same filesystem
         final FileObject fileCopy = scratchFolder.resolveFile("file1copy.txt");
-        assertTrue(!fileCopy.exists());
+        assertFalse(fileCopy.exists());
         fileCopy.copyFrom(file, Selectors.SELECT_SELF);
 
         assertSameContent(contentAppend, fileCopy);
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ProviderWriteTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ProviderWriteTests.java
index 7ccc0f1..8ec3e03 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ProviderWriteTests.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ProviderWriteTests.java
@@ -32,6 +32,8 @@ import org.apache.commons.vfs2.FileType;
 import org.apache.commons.vfs2.Selectors;
 import org.junit.Assert;
 
+import static junit.framework.TestCase.assertFalse;
+
 /**
  * File system test that check that a file system can be modified.
  */
@@ -71,7 +73,7 @@ public class ProviderWriteTests extends AbstractProviderTestCase {
 
         // Create direct child of the test folder
         FileObject folder = scratchFolder.resolveFile("dir1");
-        assertTrue(!folder.exists());
+        assertFalse(folder.exists());
         folder.createFolder();
         assertTrue(folder.exists());
         assertSame(FileType.FOLDER, folder.getType());
@@ -80,9 +82,9 @@ public class ProviderWriteTests extends AbstractProviderTestCase {
 
         // Create a descendant, where the intermediate folders don't exist
         folder = scratchFolder.resolveFile("dir2/dir1/dir1");
-        assertTrue(!folder.exists());
-        assertTrue(!folder.getParent().exists());
-        assertTrue(!folder.getParent().getParent().exists());
+        assertFalse(folder.exists());
+        assertFalse(folder.getParent().exists());
+        assertFalse(folder.getParent().getParent().exists());
         folder.createFolder();
         assertTrue(folder.exists());
         assertSame(FileType.FOLDER, folder.getType());
@@ -104,7 +106,7 @@ public class ProviderWriteTests extends AbstractProviderTestCase {
 
         // Create direct child of the test folder
         FileObject file = scratchFolder.resolveFile("file1.txt");
-        assertTrue(!file.exists());
+        assertFalse(file.exists());
         file.createFile();
         assertTrue(file.exists());
         assertSame(FileType.FILE, file.getType());
@@ -118,7 +120,7 @@ public class ProviderWriteTests extends AbstractProviderTestCase {
 
         // Create direct child of the test folder - special name
         file = scratchFolder.resolveFile("file1%25.txt");
-        assertTrue(!file.exists());
+        assertFalse(file.exists());
         file.createFile();
         assertTrue(file.exists());
         assertSame(FileType.FILE, file.getType());
@@ -130,9 +132,9 @@ public class ProviderWriteTests extends AbstractProviderTestCase {
 
         // Create a descendant, where the intermediate folders don't exist
         file = scratchFolder.resolveFile("dir1/dir1/file1.txt");
-        assertTrue(!file.exists());
-        assertTrue(!file.getParent().exists());
-        assertTrue(!file.getParent().getParent().exists());
+        assertFalse(file.exists());
+        assertFalse(file.getParent().exists());
+        assertFalse(file.getParent().getParent().exists());
         file.createFile();
         assertTrue(file.exists());
         assertSame(FileType.FILE, file.getType());
@@ -207,19 +209,19 @@ public class ProviderWriteTests extends AbstractProviderTestCase {
         FileObject file = folder.resolveFile("file1.txt");
         assertTrue(file.exists());
         file.deleteAll();
-        assertTrue(!file.exists());
+        assertFalse(file.exists());
 
         // Delete a special name file
         file = folder.resolveFile("file%25.txt");
         assertTrue(file.exists());
         file.deleteAll();
-        assertTrue(!file.exists());
+        assertFalse(file.exists());
 
         // Delete an empty folder
         file = folder.resolveFile("emptydir");
         assertTrue(file.exists());
         file.deleteAll();
-        assertTrue(!file.exists());
+        assertFalse(file.exists());
 
         // Recursive delete
         file = folder.resolveFile("dir1");
@@ -227,14 +229,14 @@ public class ProviderWriteTests extends AbstractProviderTestCase {
         assertTrue(file.exists());
         assertTrue(file2.exists());
         file.deleteAll();
-        assertTrue(!file.exists());
-        assertTrue(!file2.exists());
+        assertFalse(file.exists());
+        assertFalse(file2.exists());
 
         // Delete a file that does not exist
         file = folder.resolveFile("some-folder/some-file");
-        assertTrue(!file.exists());
+        assertFalse(file.exists());
         file.deleteAll();
-        assertTrue(!file.exists());
+        assertFalse(file.exists());
     }
 
     /**
@@ -253,19 +255,19 @@ public class ProviderWriteTests extends AbstractProviderTestCase {
         FileObject file = folder.resolveFile("file1.txt");
         assertTrue(file.exists());
         file.deleteAll();
-        assertTrue(!file.exists());
+        assertFalse(file.exists());
 
         // Delete a special name file
         file = folder.resolveFile("file%25.txt");
         assertTrue(file.exists());
         file.deleteAll();
-        assertTrue(!file.exists());
+        assertFalse(file.exists());
 
         // Delete an empty folder
         file = folder.resolveFile("emptydir");
         assertTrue(file.exists());
         file.deleteAll();
-        assertTrue(!file.exists());
+        assertFalse(file.exists());
 
         // Recursive delete
         file = folder.resolveFile("dir1");
@@ -273,14 +275,14 @@ public class ProviderWriteTests extends AbstractProviderTestCase {
         assertTrue(file.exists());
         assertTrue(file2.exists());
         file.deleteAll();
-        assertTrue(!file.exists());
-        assertTrue(!file2.exists());
+        assertFalse(file.exists());
+        assertFalse(file2.exists());
 
         // Delete a file that does not exist
         file = folder.resolveFile("some-folder/some-file");
-        assertTrue(!file.exists());
+        assertFalse(file.exists());
         file.deleteAll();
-        assertTrue(!file.exists());
+        assertFalse(file.exists());
     }
 
     /**
@@ -328,7 +330,7 @@ public class ProviderWriteTests extends AbstractProviderTestCase {
 
         // Create direct child of the test folder
         final FileObject file = scratchFolder.resolveFile("file1.txt");
-        assertTrue(!file.exists());
+        assertFalse(file.exists());
 
         // Create the source file
         final String content = "Here is some sample content for the file.  Blah Blah Blah.";
@@ -343,7 +345,7 @@ public class ProviderWriteTests extends AbstractProviderTestCase {
 
         // Make sure we can copy the new file to another file on the same filesystem
         final FileObject fileCopy = scratchFolder.resolveFile("file1copy.txt");
-        assertTrue(!fileCopy.exists());
+        assertFalse(fileCopy.exists());
         fileCopy.copyFrom(file, Selectors.SELECT_SELF);
 
         assertSameContent(content, fileCopy);
@@ -357,7 +359,7 @@ public class ProviderWriteTests extends AbstractProviderTestCase {
 
         // Create direct child of the test folder
         final FileObject file = scratchFolder.resolveFile("file1.txt");
-        assertTrue(!file.exists());
+        assertFalse(file.exists());
 
         // Create the source file
         final String content = "Here is some sample content for the file.  Blah Blah Blah.";
@@ -372,7 +374,7 @@ public class ProviderWriteTests extends AbstractProviderTestCase {
 
         // Make sure we can copy the new file to another file on the same filesystem
         final FileObject fileCopy = scratchFolder.resolveFile("file1copy.txt");
-        assertTrue(!fileCopy.exists());
+        assertFalse(fileCopy.exists());
         fileCopy.copyFrom(file, Selectors.SELECT_SELF);
 
         assertSameContent(content, fileCopy);
@@ -392,7 +394,7 @@ public class ProviderWriteTests extends AbstractProviderTestCase {
 
         // Create direct child of the test folder
         final FileObject file = scratchFolder.resolveFile("file1.txt");
-        assertTrue(!file.exists());
+        assertFalse(file.exists());
 
         // Create the source file
         final String content = "Here is some sample content for the file.  Blah Blah Blah.";
@@ -407,7 +409,7 @@ public class ProviderWriteTests extends AbstractProviderTestCase {
 
         // Make sure we can copy the new file to another file on the same filesystem
         final FileObject fileCopy = scratchFolder.resolveFile("file1copy.txt");
-        assertTrue(!fileCopy.exists());
+        assertFalse(fileCopy.exists());
         fileCopy.copyFrom(file, Selectors.SELECT_SELF);
 
         assertSameContent(content, fileCopy);
@@ -417,7 +419,7 @@ public class ProviderWriteTests extends AbstractProviderTestCase {
         assertTrue(fileCopy.delete());
 
         // Make sure we can copy the same new file to the same target file on the same filesystem
-        assertTrue(!fileCopy.exists());
+        assertFalse(fileCopy.exists());
         fileCopy.copyFrom(file, Selectors.SELECT_SELF);
 
         assertSameContent(content, fileCopy);
@@ -501,7 +503,7 @@ public class ProviderWriteTests extends AbstractProviderTestCase {
         final FileObject baseFile = createScratchFolder();
 
         final FileObject child = baseFile.resolveFile("newfile.txt");
-        assertTrue(!child.exists());
+        assertFalse(child.exists());
 
         final FileSystem fs = baseFile.getFileSystem();
         final TestListener listener = new TestListener(child);
@@ -606,7 +608,7 @@ public class ProviderWriteTests extends AbstractProviderTestCase {
             assertSame("Expecting a delete event", DELETE, events.remove(0));
             assertEquals(file, event.getFileObject());
             try {
-                assertTrue(!file.exists());
+                assertFalse(file.exists());
             } catch (final FileSystemException e) {
                 fail();
             }
@@ -618,7 +620,7 @@ public class ProviderWriteTests extends AbstractProviderTestCase {
             assertSame("Expecting a changed event", CHANGED, events.remove(0));
             assertEquals(file, event.getFileObject());
             try {
-                assertTrue(!file.exists());
+                assertFalse(file.exists());
             } catch (final FileSystemException e) {
                 fail();
             }
@@ -645,7 +647,7 @@ public class ProviderWriteTests extends AbstractProviderTestCase {
 
         // Create direct child of the test folder
         final FileObject fileSource = scratchFolder.resolveFile("file1.txt");
-        assertTrue(!fileSource.exists());
+        assertFalse(fileSource.exists());
 
         // Create the source file
         final String expectedString = "Here is some sample content for the file.  Blah Blah Blah.";
@@ -660,7 +662,7 @@ public class ProviderWriteTests extends AbstractProviderTestCase {
 
         // Make sure we can copy the new file to another file on the same filesystem
         final FileObject fileTarget = scratchFolder.resolveFile("file1copy.txt");
-        assertTrue(!fileTarget.exists());
+        assertFalse(fileTarget.exists());
 
         final FileContent contentSource = fileSource.getContent();
         //
@@ -695,7 +697,7 @@ public class ProviderWriteTests extends AbstractProviderTestCase {
 
         // Create direct child of the test folder
         final FileObject file = scratchFolder.resolveFile("file1.txt");
-        assertTrue(!file.exists());
+        assertFalse(file.exists());
 
         // Create the source file
         final String content = "Here is some sample content for the file.  Blah Blah Blah.";
@@ -710,7 +712,7 @@ public class ProviderWriteTests extends AbstractProviderTestCase {
 
         // Make sure we can copy the new file to another file on the same file system
         final FileObject fileCopy = scratchFolder.resolveFile("file1copy.txt");
-        assertTrue(!fileCopy.exists());
+        assertFalse(fileCopy.exists());
         file.getContent().write(fileCopy);
 
         assertSameContent(content, fileCopy);
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 4b3776c..52ad3b8 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
@@ -18,6 +18,7 @@ package org.apache.commons.vfs2.util;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertSame;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
@@ -69,7 +70,7 @@ public class DelegatingFileSystemOptionsBuilderTest {
 
         assertEquals("http.proxyHost", HttpFileSystemConfigBuilder.getInstance().getProxyHost(opts), "proxy");
         assertEquals("http.proxyPort", HttpFileSystemConfigBuilder.getInstance().getProxyPort(opts), 8080);
-        assertEquals("sftp.userInfo", SftpFileSystemConfigBuilder.getInstance().getUserInfo(opts).getClass(),
+        assertSame("sftp.userInfo", SftpFileSystemConfigBuilder.getInstance().getUserInfo(opts).getClass(),
                 TrustEveryoneUserInfo.class);
 
         final File identities[] = SftpFileSystemConfigBuilder.getInstance().getIdentities(opts);
@@ -90,8 +91,8 @@ public class DelegatingFileSystemOptionsBuilderTest {
             delgate.setConfigString(opts, "http", "proxyPort", "wrong_port");
             fail();
         } catch (final FileSystemException e) {
-            assertEquals(e.getCause().getClass(), InvocationTargetException.class);
-            assertEquals(((InvocationTargetException) e.getCause()).getTargetException().getClass(),
+            assertSame(e.getCause().getClass(), InvocationTargetException.class);
+            assertSame(((InvocationTargetException) e.getCause()).getTargetException().getClass(),
                     NumberFormatException.class);
         }