commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1415850 [7/15] - in /commons/proper/io/trunk/src: main/java/org/apache/commons/io/ main/java/org/apache/commons/io/comparator/ main/java/org/apache/commons/io/filefilter/ main/java/org/apache/commons/io/input/ main/java/org/apache/commons/...
Date Fri, 30 Nov 2012 20:52:08 GMT
Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/DirectoryWalkerTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/DirectoryWalkerTestCase.java?rev=1415850&r1=1415849&r2=1415850&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/DirectoryWalkerTestCase.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/DirectoryWalkerTestCase.java Fri Nov 30 20:51:39 2012
@@ -80,7 +80,7 @@ public class DirectoryWalkerTestCase {
      */
     @Test
     public void testFilter() {
-        List<File> results = new TestFileFinder(dirsAndFilesFilter, -1).find(javaDir);
+        final List<File> results = new TestFileFinder(dirsAndFilesFilter, -1).find(javaDir);
         assertEquals("Result Size", 1 + dirs.length + ioFiles.length + outputFiles.length, results.size());
         assertTrue("Start Dir", results.contains(javaDir));
         checkContainsFiles("Dir", dirs, results);
@@ -93,7 +93,7 @@ public class DirectoryWalkerTestCase {
      */
     @Test
     public void testFilterAndLimitA() {
-        List<File> results = new TestFileFinder(NOT_SVN, 0).find(javaDir);
+        final List<File> results = new TestFileFinder(NOT_SVN, 0).find(javaDir);
         assertEquals("[A] Result Size", 1, results.size());
         assertTrue("[A] Start Dir",   results.contains(javaDir));
     }
@@ -103,7 +103,7 @@ public class DirectoryWalkerTestCase {
      */
     @Test
     public void testFilterAndLimitB() {
-        List<File> results = new TestFileFinder(NOT_SVN, 1).find(javaDir);
+        final List<File> results = new TestFileFinder(NOT_SVN, 1).find(javaDir);
         assertEquals("[B] Result Size", 2, results.size());
         assertTrue("[B] Start Dir",   results.contains(javaDir));
         assertTrue("[B] Org Dir",     results.contains(orgDir));
@@ -114,7 +114,7 @@ public class DirectoryWalkerTestCase {
      */
     @Test
     public void testFilterAndLimitC() {
-        List<File> results = new TestFileFinder(NOT_SVN, 3).find(javaDir);
+        final List<File> results = new TestFileFinder(NOT_SVN, 3).find(javaDir);
         assertEquals("[C] Result Size", 4, results.size());
         assertTrue("[C] Start Dir",   results.contains(javaDir));
         assertTrue("[C] Org Dir",     results.contains(orgDir));
@@ -127,7 +127,7 @@ public class DirectoryWalkerTestCase {
      */
     @Test
     public void testFilterAndLimitD() {
-        List<File> results = new TestFileFinder(dirsAndFilesFilter, 5).find(javaDir);
+        final List<File> results = new TestFileFinder(dirsAndFilesFilter, 5).find(javaDir);
         assertEquals("[D] Result Size", 1 + dirs.length + ioFiles.length, results.size());
         assertTrue("[D] Start Dir", results.contains(javaDir));
         checkContainsFiles("[D] Dir", dirs, results);
@@ -139,7 +139,7 @@ public class DirectoryWalkerTestCase {
      */
     @Test
     public void testFilterDirAndFile1() {
-        List<File> results = new TestFileFinder(dirsFilter, iofilesFilter, -1).find(javaDir);
+        final List<File> results = new TestFileFinder(dirsFilter, iofilesFilter, -1).find(javaDir);
         assertEquals("[DirAndFile1] Result Size", 1 + dirs.length + ioFiles.length, results.size());
         assertTrue("[DirAndFile1] Start Dir", results.contains(javaDir));
         checkContainsFiles("[DirAndFile1] Dir", dirs, results);
@@ -151,7 +151,7 @@ public class DirectoryWalkerTestCase {
      */
     @Test
     public void testFilterDirAndFile2() {
-        List<File> results = new TestFileFinder((IOFileFilter) null, (IOFileFilter) null, -1).find(javaDir);
+        final List<File> results = new TestFileFinder((IOFileFilter) null, (IOFileFilter) null, -1).find(javaDir);
         assertTrue("[DirAndFile2] Result Size", results.size() > 1 + dirs.length + ioFiles.length);
         assertTrue("[DirAndFile2] Start Dir", results.contains(javaDir));
         checkContainsFiles("[DirAndFile2] Dir", dirs, results);
@@ -163,8 +163,8 @@ public class DirectoryWalkerTestCase {
      */
     @Test
     public void testFilterDirAndFile3() {
-        List<File> results = new TestFileFinder(dirsFilter, (IOFileFilter) null, -1).find(javaDir);
-        List<File> resultDirs = directoriesOnly(results);
+        final List<File> results = new TestFileFinder(dirsFilter, (IOFileFilter) null, -1).find(javaDir);
+        final List<File> resultDirs = directoriesOnly(results);
         assertEquals("[DirAndFile3] Result Size", 1 + dirs.length, resultDirs.size());
         assertTrue("[DirAndFile3] Start Dir", results.contains(javaDir));
         checkContainsFiles("[DirAndFile3] Dir", dirs, resultDirs);
@@ -175,8 +175,8 @@ public class DirectoryWalkerTestCase {
      */
     @Test
     public void testFilterDirAndFile4() {
-        List<File> results = new TestFileFinder((IOFileFilter) null, iofilesFilter, -1).find(javaDir);
-        List<File> resultFiles = filesOnly(results);
+        final List<File> results = new TestFileFinder((IOFileFilter) null, iofilesFilter, -1).find(javaDir);
+        final List<File> resultFiles = filesOnly(results);
         assertEquals("[DirAndFile4] Result Size", ioFiles.length, resultFiles.size());
         assertTrue("[DirAndFile4] Start Dir", results.contains(javaDir));
         checkContainsFiles("[DirAndFile4] File", ioFiles, resultFiles);
@@ -187,7 +187,7 @@ public class DirectoryWalkerTestCase {
      */
     @Test
     public void testLimitToCurrent() {
-        List<File> results = new TestFileFinder(null, 0).find(current);
+        final List<File> results = new TestFileFinder(null, 0).find(current);
         assertEquals("Result Size", 1, results.size());
         assertTrue("Current Dir", results.contains(new File(".")));
     }
@@ -199,15 +199,15 @@ public class DirectoryWalkerTestCase {
     public void testMissingStartDirectory() {
 
         // TODO is this what we want with invalid directory?
-        File invalidDir = new File("invalid-dir");
-        List<File> results = new TestFileFinder(null, -1).find(invalidDir);
+        final File invalidDir = new File("invalid-dir");
+        final List<File> results = new TestFileFinder(null, -1).find(invalidDir);
         assertEquals("Result Size", 1, results.size());
         assertTrue("Current Dir", results.contains(invalidDir));
  
         try {
             new TestFileFinder(null, -1).find(null);
             fail("Null start directory didn't throw Exception");
-        } catch (NullPointerException ignore) {
+        } catch (final NullPointerException ignore) {
             // expected result
         }
     }
@@ -218,7 +218,7 @@ public class DirectoryWalkerTestCase {
     @Test
     public void testHandleStartDirectoryFalse() {
 
-        List<File> results = new TestFalseFileFinder(null, -1).find(current);
+        final List<File> results = new TestFalseFileFinder(null, -1).find(current);
         assertEquals("Result Size", 0, results.size());
 
     }
@@ -228,13 +228,13 @@ public class DirectoryWalkerTestCase {
     /**
      * Check the files in the array are in the results list.
      */
-    private void checkContainsFiles(String prefix, File[] files, Collection<File> results) {
+    private void checkContainsFiles(final String prefix, final File[] files, final Collection<File> results) {
         for (int i = 0; i < files.length; i++) {
             assertTrue(prefix + "["+i+"] " + files[i], results.contains(files[i]));
         }
     }
 
-    private void checkContainsString(String prefix, File[] files, Collection<String> results) {
+    private void checkContainsString(final String prefix, final File[] files, final Collection<String> results) {
         for (int i = 0; i < files.length; i++) {
             assertTrue(prefix + "["+i+"] " + files[i], results.contains(files[i].toString()));
         }
@@ -243,9 +243,9 @@ public class DirectoryWalkerTestCase {
     /**
      * Extract the directories.
      */
-    private List<File> directoriesOnly(Collection<File> results) {
-        List<File> list = new ArrayList<File>(results.size());
-        for (File file : results) {
+    private List<File> directoriesOnly(final Collection<File> results) {
+        final List<File> list = new ArrayList<File>(results.size());
+        for (final File file : results) {
             if (file.isDirectory()) {
                 list.add(file);
             }
@@ -256,9 +256,9 @@ public class DirectoryWalkerTestCase {
     /**
      * Extract the files.
      */
-    private List<File> filesOnly(Collection<File> results) {
-        List<File> list = new ArrayList<File>(results.size());
-        for (File file : results) {
+    private List<File> filesOnly(final Collection<File> results) {
+        final List<File> list = new ArrayList<File>(results.size());
+        for (final File file : results) {
             if (file.isFile()) {
                 list.add(file);
             }
@@ -270,8 +270,8 @@ public class DirectoryWalkerTestCase {
      * Create an name filter containg the names of the files
      * in the array.
      */
-    private static IOFileFilter createNameFilter(File[] files) {
-        String[] names = new String[files.length];
+    private static IOFileFilter createNameFilter(final File[] files) {
+        final String[] names = new String[files.length];
         for (int i = 0; i < files.length; i++) {
             names[i] = files[i].getName();
         }
@@ -290,10 +290,10 @@ public class DirectoryWalkerTestCase {
             cancelName = "DirectoryWalker.java";
             new TestCancelWalker(cancelName, false).find(javaDir);
             fail("CancelException not thrown for '" + cancelName + "'");
-        } catch (DirectoryWalker.CancelException cancel) {
+        } catch (final DirectoryWalker.CancelException cancel) {
             assertEquals("File:  " + cancelName,   cancelName, cancel.getFile().getName());
             assertEquals("Depth: " + cancelName,  5, cancel.getDepth());
-        } catch(IOException ex) {
+        } catch(final IOException ex) {
             fail("IOException: " + cancelName + " " + ex);
         }
 
@@ -302,19 +302,19 @@ public class DirectoryWalkerTestCase {
             cancelName = "commons";
             new TestCancelWalker(cancelName, false).find(javaDir);
             fail("CancelException not thrown for '" + cancelName + "'");
-        } catch (DirectoryWalker.CancelException cancel) {
+        } catch (final DirectoryWalker.CancelException cancel) {
             assertEquals("File:  " + cancelName,   cancelName, cancel.getFile().getName());
             assertEquals("Depth: " + cancelName,  3, cancel.getDepth());
-        } catch(IOException ex) {
+        } catch(final IOException ex) {
             fail("IOException: " + cancelName + " " + ex);
         }
 
         // Suppress CancelException (use same file name as preceding test)
         try {
-            List<File> results = new TestCancelWalker(cancelName, true).find(javaDir);
-            File lastFile = results.get(results.size() - 1);
+            final List<File> results = new TestCancelWalker(cancelName, true).find(javaDir);
+            final File lastFile = results.get(results.size() - 1);
             assertEquals("Suppress:  " + cancelName,   cancelName, lastFile.getName());
-        } catch(IOException ex) {
+        } catch(final IOException ex) {
             fail("Suppress threw " + ex);
         }
 
@@ -331,11 +331,11 @@ public class DirectoryWalkerTestCase {
         try {
             walker.find(javaDir);
             fail("CancelException not thrown for '" + cancelName + "'");
-        } catch (DirectoryWalker.CancelException cancel) {
-            File last = walker.results.get(walker.results.size() - 1);
+        } catch (final DirectoryWalker.CancelException cancel) {
+            final File last = walker.results.get(walker.results.size() - 1);
             assertEquals(cancelName, last.getName());
             assertEquals("Depth: " + cancelName,  5, cancel.getDepth());
-        } catch(IOException ex) {
+        } catch(final IOException ex) {
             fail("IOException: " + cancelName + " " + ex);
         }
         
@@ -345,20 +345,20 @@ public class DirectoryWalkerTestCase {
             walker = new TestMultiThreadCancelWalker(cancelName, false);
             walker.find(javaDir);
             fail("CancelException not thrown for '" + cancelName + "'");
-        } catch (DirectoryWalker.CancelException cancel) {
+        } catch (final DirectoryWalker.CancelException cancel) {
             assertEquals("File:  " + cancelName,   cancelName, cancel.getFile().getName());
             assertEquals("Depth: " + cancelName,  3, cancel.getDepth());
-        } catch(IOException ex) {
+        } catch(final IOException ex) {
             fail("IOException: " + cancelName + " " + ex);
         }
         
         // Suppress CancelException (use same file name as preceding test)
         try {
             walker = new TestMultiThreadCancelWalker(cancelName, true);
-            List<File> results = walker.find(javaDir);
-            File lastFile = results.get(results.size() - 1);
+            final List<File> results = walker.find(javaDir);
+            final File lastFile = results.get(results.size() - 1);
             assertEquals("Suppress:  " + cancelName, cancelName, lastFile.getName());
-        } catch(IOException ex) {
+        } catch(final IOException ex) {
             fail("Suppress threw " + ex);
         }
 
@@ -369,7 +369,7 @@ public class DirectoryWalkerTestCase {
      */
     @Test
     public void testFilterString() {
-        List<String> results = new TestFileFinderString(dirsAndFilesFilter, -1).find(javaDir);
+        final List<String> results = new TestFileFinderString(dirsAndFilesFilter, -1).find(javaDir);
         assertEquals("Result Size", outputFiles.length + ioFiles.length, results.size());
         checkContainsString("IO File", ioFiles, results);
         checkContainsString("Output File", outputFiles, results);
@@ -383,20 +383,20 @@ public class DirectoryWalkerTestCase {
      */
     private static class TestFileFinder extends DirectoryWalker<File> {
 
-        protected TestFileFinder(FileFilter filter, int depthLimit) {
+        protected TestFileFinder(final FileFilter filter, final int depthLimit) {
             super(filter, depthLimit);
         }
 
-        protected TestFileFinder(IOFileFilter dirFilter, IOFileFilter fileFilter, int depthLimit) {
+        protected TestFileFinder(final IOFileFilter dirFilter, final IOFileFilter fileFilter, final int depthLimit) {
             super(dirFilter, fileFilter, depthLimit);
         }
 
         /** find files. */
-        protected List<File> find(File startDirectory) {
-           List<File> results = new ArrayList<File>();
+        protected List<File> find(final File startDirectory) {
+           final List<File> results = new ArrayList<File>();
            try {
                walk(startDirectory, results);
-           } catch(IOException ex) {
+           } catch(final IOException ex) {
                Assert.fail(ex.toString());
            }
            return results;
@@ -404,13 +404,13 @@ public class DirectoryWalkerTestCase {
 
         /** Handles a directory end by adding the File to the result set. */
         @Override
-        protected void handleDirectoryEnd(File directory, int depth, Collection<File> results) {
+        protected void handleDirectoryEnd(final File directory, final int depth, final Collection<File> results) {
             results.add(directory);
         }
 
         /** Handles a file by adding the File to the result set. */
         @Override
-        protected void handleFile(File file, int depth, Collection<File> results) {
+        protected void handleFile(final File file, final int depth, final Collection<File> results) {
             results.add(file);
         }
     }
@@ -423,13 +423,13 @@ public class DirectoryWalkerTestCase {
      */
     private static class TestFalseFileFinder extends TestFileFinder {
 
-        protected TestFalseFileFinder(FileFilter filter, int depthLimit) {
+        protected TestFalseFileFinder(final FileFilter filter, final int depthLimit) {
             super(filter, depthLimit);
         }
 
         /** Always returns false. */
         @Override
-        protected boolean handleDirectory(File directory, int depth, Collection<File> results) {
+        protected boolean handleDirectory(final File directory, final int depth, final Collection<File> results) {
             return false;
         }
     }
@@ -441,25 +441,25 @@ public class DirectoryWalkerTestCase {
      * applying a file filter.
      */
     static class TestCancelWalker extends DirectoryWalker<File> {
-        private String cancelFileName;
-        private boolean suppressCancel;
+        private final String cancelFileName;
+        private final boolean suppressCancel;
 
-        TestCancelWalker(String cancelFileName,boolean suppressCancel) {
+        TestCancelWalker(final String cancelFileName,final boolean suppressCancel) {
             super();
             this.cancelFileName = cancelFileName;
             this.suppressCancel = suppressCancel;
         }
 
         /** find files. */
-        protected List<File> find(File startDirectory) throws IOException {
-           List<File> results = new ArrayList<File>();
+        protected List<File> find(final File startDirectory) throws IOException {
+           final List<File> results = new ArrayList<File>();
            walk(startDirectory, results);
            return results;
         }
 
         /** Handles a directory end by adding the File to the result set. */
         @Override
-        protected void handleDirectoryEnd(File directory, int depth, Collection<File> results) throws IOException {
+        protected void handleDirectoryEnd(final File directory, final int depth, final Collection<File> results) throws IOException {
             results.add(directory);
             if (cancelFileName.equals(directory.getName())) {
                 throw new CancelException(directory, depth);
@@ -468,7 +468,7 @@ public class DirectoryWalkerTestCase {
 
         /** Handles a file by adding the File to the result set. */
         @Override
-        protected void handleFile(File file, int depth, Collection<File> results) throws IOException {
+        protected void handleFile(final File file, final int depth, final Collection<File> results) throws IOException {
             results.add(file);
             if (cancelFileName.equals(file.getName())) {
                 throw new CancelException(file, depth);
@@ -477,8 +477,8 @@ public class DirectoryWalkerTestCase {
 
         /** Handles Cancel. */
         @Override
-        protected void handleCancelled(File startDirectory, Collection<File> results,
-                       CancelException cancel) throws IOException {
+        protected void handleCancelled(final File startDirectory, final Collection<File> results,
+                       final CancelException cancel) throws IOException {
             if (!suppressCancel) {
                 super.handleCancelled(startDirectory, results, cancel);
             }
@@ -490,19 +490,19 @@ public class DirectoryWalkerTestCase {
      * applying a file filter.
      */
     static class TestMultiThreadCancelWalker extends DirectoryWalker<File> {
-        private String cancelFileName;
-        private boolean suppressCancel;
+        private final String cancelFileName;
+        private final boolean suppressCancel;
         private boolean cancelled;
         public List<File> results;
 
-        TestMultiThreadCancelWalker(String cancelFileName, boolean suppressCancel) {
+        TestMultiThreadCancelWalker(final String cancelFileName, final boolean suppressCancel) {
             super();
             this.cancelFileName = cancelFileName;
             this.suppressCancel = suppressCancel;
         }
 
         /** find files. */
-        protected List<File> find(File startDirectory) throws IOException {
+        protected List<File> find(final File startDirectory) throws IOException {
            results = new ArrayList<File>();
            walk(startDirectory, results);
            return results;
@@ -510,7 +510,7 @@ public class DirectoryWalkerTestCase {
 
         /** Handles a directory end by adding the File to the result set. */
         @Override
-        protected void handleDirectoryEnd(File directory, int depth, Collection<File> results) throws IOException {
+        protected void handleDirectoryEnd(final File directory, final int depth, final Collection<File> results) throws IOException {
             results.add(directory);
             assertFalse(cancelled);
             if (cancelFileName.equals(directory.getName())) {
@@ -520,7 +520,7 @@ public class DirectoryWalkerTestCase {
 
         /** Handles a file by adding the File to the result set. */
         @Override
-        protected void handleFile(File file, int depth, Collection<File> results) throws IOException {
+        protected void handleFile(final File file, final int depth, final Collection<File> results) throws IOException {
             results.add(file);
             assertFalse(cancelled);
             if (cancelFileName.equals(file.getName())) {
@@ -530,14 +530,14 @@ public class DirectoryWalkerTestCase {
 
         /** Handles Cancelled. */
         @Override
-        protected boolean handleIsCancelled(File file, int depth, Collection<File> results) throws IOException {
+        protected boolean handleIsCancelled(final File file, final int depth, final Collection<File> results) throws IOException {
             return cancelled;
         }
 
         /** Handles Cancel. */
         @Override
-        protected void handleCancelled(File startDirectory, Collection<File> results,
-                       CancelException cancel) throws IOException {
+        protected void handleCancelled(final File startDirectory, final Collection<File> results,
+                       final CancelException cancel) throws IOException {
             if (!suppressCancel) {
                 super.handleCancelled(startDirectory, results, cancel);
             }
@@ -550,16 +550,16 @@ public class DirectoryWalkerTestCase {
      */
     private static class TestFileFinderString extends DirectoryWalker<String> {
 
-        protected TestFileFinderString(FileFilter filter, int depthLimit) {
+        protected TestFileFinderString(final FileFilter filter, final int depthLimit) {
             super(filter, depthLimit);
         }
 
         /** find files. */
-        protected List<String> find(File startDirectory) {
-           List<String> results = new ArrayList<String>();
+        protected List<String> find(final File startDirectory) {
+           final List<String> results = new ArrayList<String>();
            try {
                walk(startDirectory, results);
-           } catch(IOException ex) {
+           } catch(final IOException ex) {
                Assert.fail(ex.toString());
            }
            return results;
@@ -567,7 +567,7 @@ public class DirectoryWalkerTestCase {
 
         /** Handles a file by adding the File to the result set. */
         @Override
-        protected void handleFile(File file, int depth, Collection<String> results) {
+        protected void handleFile(final File file, final int depth, final Collection<String> results) {
             results.add(file.toString());
         }
     }

Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/DirectoryWalkerTestCaseJava4.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/DirectoryWalkerTestCaseJava4.java?rev=1415850&r1=1415849&r2=1415850&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/DirectoryWalkerTestCaseJava4.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/DirectoryWalkerTestCaseJava4.java Fri Nov 30 20:51:39 2012
@@ -71,7 +71,7 @@ public class DirectoryWalkerTestCaseJava
     private static final IOFileFilter NOT_SVN = FileFilterUtils.makeSVNAware(null);
 
     /** Construct the TestCase using the name */
-    public DirectoryWalkerTestCaseJava4(String name) {
+    public DirectoryWalkerTestCaseJava4(final String name) {
         super(name);
     }
 
@@ -93,7 +93,7 @@ public class DirectoryWalkerTestCaseJava
      * Test Filtering
      */
     public void testFilter() {
-        List results = new TestFileFinder(dirsAndFilesFilter, -1).find(javaDir);
+        final List results = new TestFileFinder(dirsAndFilesFilter, -1).find(javaDir);
         assertEquals("Result Size", 1 + dirs.length + ioFiles.length + outputFiles.length, results.size());
         assertTrue("Start Dir", results.contains(javaDir));
         checkContainsFiles("Dir", dirs, results);
@@ -105,7 +105,7 @@ public class DirectoryWalkerTestCaseJava
      * Test Filtering and limit to depth 0
      */
     public void testFilterAndLimitA() {
-        List results = new TestFileFinder(NOT_SVN, 0).find(javaDir);
+        final List results = new TestFileFinder(NOT_SVN, 0).find(javaDir);
         assertEquals("[A] Result Size", 1, results.size());
         assertTrue("[A] Start Dir",   results.contains(javaDir));
     }
@@ -114,7 +114,7 @@ public class DirectoryWalkerTestCaseJava
      * Test Filtering and limit to depth 1
      */
     public void testFilterAndLimitB() {
-        List results = new TestFileFinder(NOT_SVN, 1).find(javaDir);
+        final List results = new TestFileFinder(NOT_SVN, 1).find(javaDir);
         assertEquals("[B] Result Size", 2, results.size());
         assertTrue("[B] Start Dir",   results.contains(javaDir));
         assertTrue("[B] Org Dir",     results.contains(orgDir));
@@ -124,7 +124,7 @@ public class DirectoryWalkerTestCaseJava
      * Test Filtering and limit to depth 3
      */
     public void testFilterAndLimitC() {
-        List results = new TestFileFinder(NOT_SVN, 3).find(javaDir);
+        final List results = new TestFileFinder(NOT_SVN, 3).find(javaDir);
         assertEquals("[C] Result Size", 4, results.size());
         assertTrue("[C] Start Dir",   results.contains(javaDir));
         assertTrue("[C] Org Dir",     results.contains(orgDir));
@@ -136,7 +136,7 @@ public class DirectoryWalkerTestCaseJava
      * Test Filtering and limit to depth 5
      */
     public void testFilterAndLimitD() {
-        List results = new TestFileFinder(dirsAndFilesFilter, 5).find(javaDir);
+        final List results = new TestFileFinder(dirsAndFilesFilter, 5).find(javaDir);
         assertEquals("[D] Result Size", 1 + dirs.length + ioFiles.length, results.size());
         assertTrue("[D] Start Dir", results.contains(javaDir));
         checkContainsFiles("[D] Dir", dirs, results);
@@ -147,7 +147,7 @@ public class DirectoryWalkerTestCaseJava
      * Test separate dir and file filters
      */
     public void testFilterDirAndFile1() {
-        List results = new TestFileFinder(dirsFilter, iofilesFilter, -1).find(javaDir);
+        final List results = new TestFileFinder(dirsFilter, iofilesFilter, -1).find(javaDir);
         assertEquals("[DirAndFile1] Result Size", 1 + dirs.length + ioFiles.length, results.size());
         assertTrue("[DirAndFile1] Start Dir", results.contains(javaDir));
         checkContainsFiles("[DirAndFile1] Dir", dirs, results);
@@ -158,7 +158,7 @@ public class DirectoryWalkerTestCaseJava
      * Test separate dir and file filters
      */
     public void testFilterDirAndFile2() {
-        List results = new TestFileFinder((IOFileFilter) null, (IOFileFilter) null, -1).find(javaDir);
+        final List results = new TestFileFinder((IOFileFilter) null, (IOFileFilter) null, -1).find(javaDir);
         assertTrue("[DirAndFile2] Result Size", results.size() > 1 + dirs.length + ioFiles.length);
         assertTrue("[DirAndFile2] Start Dir", results.contains(javaDir));
         checkContainsFiles("[DirAndFile2] Dir", dirs, results);
@@ -169,8 +169,8 @@ public class DirectoryWalkerTestCaseJava
      * Test separate dir and file filters
      */
     public void testFilterDirAndFile3() {
-        List results = new TestFileFinder(dirsFilter, (IOFileFilter) null, -1).find(javaDir);
-        List resultDirs = directoriesOnly(results);
+        final List results = new TestFileFinder(dirsFilter, (IOFileFilter) null, -1).find(javaDir);
+        final List resultDirs = directoriesOnly(results);
         assertEquals("[DirAndFile3] Result Size", 1 + dirs.length, resultDirs.size());
         assertTrue("[DirAndFile3] Start Dir", results.contains(javaDir));
         checkContainsFiles("[DirAndFile3] Dir", dirs, resultDirs);
@@ -180,8 +180,8 @@ public class DirectoryWalkerTestCaseJava
      * Test separate dir and file filters
      */
     public void testFilterDirAndFile4() {
-        List results = new TestFileFinder((IOFileFilter) null, iofilesFilter, -1).find(javaDir);
-        List resultFiles = filesOnly(results);
+        final List results = new TestFileFinder((IOFileFilter) null, iofilesFilter, -1).find(javaDir);
+        final List resultFiles = filesOnly(results);
         assertEquals("[DirAndFile4] Result Size", ioFiles.length, resultFiles.size());
         assertTrue("[DirAndFile4] Start Dir", results.contains(javaDir));
         checkContainsFiles("[DirAndFile4] File", ioFiles, resultFiles);
@@ -191,7 +191,7 @@ public class DirectoryWalkerTestCaseJava
      * Test Limiting to current directory
      */
     public void testLimitToCurrent() {
-        List results = new TestFileFinder(null, 0).find(current);
+        final List results = new TestFileFinder(null, 0).find(current);
         assertEquals("Result Size", 1, results.size());
         assertTrue("Current Dir", results.contains(new File(".")));
     }
@@ -202,15 +202,15 @@ public class DirectoryWalkerTestCaseJava
     public void testMissingStartDirectory() {
 
         // TODO is this what we want with invalid directory?
-        File invalidDir = new File("invalid-dir");
-        List results = new TestFileFinder(null, -1).find(invalidDir);
+        final File invalidDir = new File("invalid-dir");
+        final List results = new TestFileFinder(null, -1).find(invalidDir);
         assertEquals("Result Size", 1, results.size());
         assertTrue("Current Dir", results.contains(invalidDir));
  
         try {
             new TestFileFinder(null, -1).find(null);
             fail("Null start directory didn't throw Exception");
-        } catch (NullPointerException ignore) {
+        } catch (final NullPointerException ignore) {
             // expected result
         }
     }
@@ -220,7 +220,7 @@ public class DirectoryWalkerTestCaseJava
      */
     public void testHandleStartDirectoryFalse() {
 
-        List results = new TestFalseFileFinder(null, -1).find(current);
+        final List results = new TestFalseFileFinder(null, -1).find(current);
         assertEquals("Result Size", 0, results.size());
 
     }
@@ -230,7 +230,7 @@ public class DirectoryWalkerTestCaseJava
     /**
      * Check the files in the array are in the results list.
      */
-    private void checkContainsFiles(String prefix, File[] files, Collection results) {
+    private void checkContainsFiles(final String prefix, final File[] files, final Collection results) {
         for (int i = 0; i < files.length; i++) {
             assertTrue(prefix + "["+i+"] " + files[i], results.contains(files[i]));
         }
@@ -239,10 +239,10 @@ public class DirectoryWalkerTestCaseJava
     /**
      * Extract the directories.
      */
-    private List directoriesOnly(Collection results) {
-        List list = new ArrayList(results.size());
-        for (Iterator it = results.iterator(); it.hasNext(); ) {
-            File file = (File) it.next();
+    private List directoriesOnly(final Collection results) {
+        final List list = new ArrayList(results.size());
+        for (final Iterator it = results.iterator(); it.hasNext(); ) {
+            final File file = (File) it.next();
             if (file.isDirectory()) {
                 list.add(file);
             }
@@ -253,10 +253,10 @@ public class DirectoryWalkerTestCaseJava
     /**
      * Extract the files.
      */
-    private List filesOnly(Collection results) {
-        List list = new ArrayList(results.size());
-        for (Iterator it = results.iterator(); it.hasNext(); ) {
-            File file = (File) it.next();
+    private List filesOnly(final Collection results) {
+        final List list = new ArrayList(results.size());
+        for (final Iterator it = results.iterator(); it.hasNext(); ) {
+            final File file = (File) it.next();
             if (file.isFile()) {
                 list.add(file);
             }
@@ -268,8 +268,8 @@ public class DirectoryWalkerTestCaseJava
      * Create an name filter containg the names of the files
      * in the array.
      */
-    private static IOFileFilter createNameFilter(File[] files) {
-        String[] names = new String[files.length];
+    private static IOFileFilter createNameFilter(final File[] files) {
+        final String[] names = new String[files.length];
         for (int i = 0; i < files.length; i++) {
             names[i] = files[i].getName();
         }
@@ -287,10 +287,10 @@ public class DirectoryWalkerTestCaseJava
             cancelName = "DirectoryWalker.java";
             new TestCancelWalker(cancelName, false).find(javaDir);
             fail("CancelException not thrown for '" + cancelName + "'");
-        } catch (DirectoryWalker.CancelException cancel) {
+        } catch (final DirectoryWalker.CancelException cancel) {
             assertEquals("File:  " + cancelName,   cancelName, cancel.getFile().getName());
             assertEquals("Depth: " + cancelName,  5, cancel.getDepth());
-        } catch(IOException ex) {
+        } catch(final IOException ex) {
             fail("IOException: " + cancelName + " " + ex);
         }
 
@@ -299,19 +299,19 @@ public class DirectoryWalkerTestCaseJava
             cancelName = "commons";
             new TestCancelWalker(cancelName, false).find(javaDir);
             fail("CancelException not thrown for '" + cancelName + "'");
-        } catch (DirectoryWalker.CancelException cancel) {
+        } catch (final DirectoryWalker.CancelException cancel) {
             assertEquals("File:  " + cancelName,   cancelName, cancel.getFile().getName());
             assertEquals("Depth: " + cancelName,  3, cancel.getDepth());
-        } catch(IOException ex) {
+        } catch(final IOException ex) {
             fail("IOException: " + cancelName + " " + ex);
         }
 
         // Suppress CancelException (use same file name as preceding test)
         try {
-            List results = new TestCancelWalker(cancelName, true).find(javaDir);
-            File lastFile = (File) results.get(results.size() - 1);
+            final List results = new TestCancelWalker(cancelName, true).find(javaDir);
+            final File lastFile = (File) results.get(results.size() - 1);
             assertEquals("Suppress:  " + cancelName,   cancelName, lastFile.getName());
-        } catch(IOException ex) {
+        } catch(final IOException ex) {
             fail("Suppress threw " + ex);
         }
 
@@ -327,11 +327,11 @@ public class DirectoryWalkerTestCaseJava
         try {
             walker.find(javaDir);
             fail("CancelException not thrown for '" + cancelName + "'");
-        } catch (DirectoryWalker.CancelException cancel) {
-            File last = (File) walker.results.get(walker.results.size() - 1);
+        } catch (final DirectoryWalker.CancelException cancel) {
+            final File last = (File) walker.results.get(walker.results.size() - 1);
             assertEquals(cancelName, last.getName());
             assertEquals("Depth: " + cancelName,  5, cancel.getDepth());
-        } catch(IOException ex) {
+        } catch(final IOException ex) {
             fail("IOException: " + cancelName + " " + ex);
         }
         
@@ -341,20 +341,20 @@ public class DirectoryWalkerTestCaseJava
             walker = new TestMultiThreadCancelWalker(cancelName, false);
             walker.find(javaDir);
             fail("CancelException not thrown for '" + cancelName + "'");
-        } catch (DirectoryWalker.CancelException cancel) {
+        } catch (final DirectoryWalker.CancelException cancel) {
             assertEquals("File:  " + cancelName,   cancelName, cancel.getFile().getName());
             assertEquals("Depth: " + cancelName,  3, cancel.getDepth());
-        } catch(IOException ex) {
+        } catch(final IOException ex) {
             fail("IOException: " + cancelName + " " + ex);
         }
         
         // Suppress CancelException (use same file name as preceding test)
         try {
             walker = new TestMultiThreadCancelWalker(cancelName, true);
-            List results = walker.find(javaDir);
-            File lastFile = (File) results.get(results.size() - 1);
+            final List results = walker.find(javaDir);
+            final File lastFile = (File) results.get(results.size() - 1);
             assertEquals("Suppress:  " + cancelName, cancelName, lastFile.getName());
-        } catch(IOException ex) {
+        } catch(final IOException ex) {
             fail("Suppress threw " + ex);
         }
 
@@ -368,20 +368,20 @@ public class DirectoryWalkerTestCaseJava
      */
     private static class TestFileFinder extends DirectoryWalker {
 
-        protected TestFileFinder(FileFilter filter, int depthLimit) {
+        protected TestFileFinder(final FileFilter filter, final int depthLimit) {
             super(filter, depthLimit);
         }
 
-        protected TestFileFinder(IOFileFilter dirFilter, IOFileFilter fileFilter, int depthLimit) {
+        protected TestFileFinder(final IOFileFilter dirFilter, final IOFileFilter fileFilter, final int depthLimit) {
             super(dirFilter, fileFilter, depthLimit);
         }
 
         /** find files. */
-        protected List find(File startDirectory) {
-           List results = new ArrayList();
+        protected List find(final File startDirectory) {
+           final List results = new ArrayList();
            try {
                walk(startDirectory, results);
-           } catch(IOException ex) {
+           } catch(final IOException ex) {
                Assert.fail(ex.toString());
            }
            return results;
@@ -389,13 +389,13 @@ public class DirectoryWalkerTestCaseJava
 
         /** Handles a directory end by adding the File to the result set. */
         @Override
-        protected void handleDirectoryEnd(File directory, int depth, Collection results) {
+        protected void handleDirectoryEnd(final File directory, final int depth, final Collection results) {
             results.add(directory);
         }
 
         /** Handles a file by adding the File to the result set. */
         @Override
-        protected void handleFile(File file, int depth, Collection results) {
+        protected void handleFile(final File file, final int depth, final Collection results) {
             results.add(file);
         }
     }
@@ -408,13 +408,13 @@ public class DirectoryWalkerTestCaseJava
      */
     private static class TestFalseFileFinder extends TestFileFinder {
 
-        protected TestFalseFileFinder(FileFilter filter, int depthLimit) {
+        protected TestFalseFileFinder(final FileFilter filter, final int depthLimit) {
             super(filter, depthLimit);
         }
 
         /** Always returns false. */
         @Override
-        protected boolean handleDirectory(File directory, int depth, Collection results) {
+        protected boolean handleDirectory(final File directory, final int depth, final Collection results) {
             return false;
         }
     }
@@ -426,25 +426,25 @@ public class DirectoryWalkerTestCaseJava
      * applying a file filter.
      */
     static class TestCancelWalker extends DirectoryWalker {
-        private String cancelFileName;
-        private boolean suppressCancel;
+        private final String cancelFileName;
+        private final boolean suppressCancel;
 
-        TestCancelWalker(String cancelFileName,boolean suppressCancel) {
+        TestCancelWalker(final String cancelFileName,final boolean suppressCancel) {
             super();
             this.cancelFileName = cancelFileName;
             this.suppressCancel = suppressCancel;
         }
 
         /** find files. */
-        protected List find(File startDirectory) throws IOException {
-           List results = new ArrayList();
+        protected List find(final File startDirectory) throws IOException {
+           final List results = new ArrayList();
            walk(startDirectory, results);
            return results;
         }
 
         /** Handles a directory end by adding the File to the result set. */
         @Override
-        protected void handleDirectoryEnd(File directory, int depth, Collection results) throws IOException {
+        protected void handleDirectoryEnd(final File directory, final int depth, final Collection results) throws IOException {
             results.add(directory);
             if (cancelFileName.equals(directory.getName())) {
                 throw new CancelException(directory, depth);
@@ -453,7 +453,7 @@ public class DirectoryWalkerTestCaseJava
 
         /** Handles a file by adding the File to the result set. */
         @Override
-        protected void handleFile(File file, int depth, Collection results) throws IOException {
+        protected void handleFile(final File file, final int depth, final Collection results) throws IOException {
             results.add(file);
             if (cancelFileName.equals(file.getName())) {
                 throw new CancelException(file, depth);
@@ -462,8 +462,8 @@ public class DirectoryWalkerTestCaseJava
 
         /** Handles Cancel. */
         @Override
-        protected void handleCancelled(File startDirectory, Collection results,
-                       CancelException cancel) throws IOException {
+        protected void handleCancelled(final File startDirectory, final Collection results,
+                       final CancelException cancel) throws IOException {
             if (!suppressCancel) {
                 super.handleCancelled(startDirectory, results, cancel);
             }
@@ -475,19 +475,19 @@ public class DirectoryWalkerTestCaseJava
      * applying a file filter.
      */
     static class TestMultiThreadCancelWalker extends DirectoryWalker {
-        private String cancelFileName;
-        private boolean suppressCancel;
+        private final String cancelFileName;
+        private final boolean suppressCancel;
         private boolean cancelled;
         public List results;
 
-        TestMultiThreadCancelWalker(String cancelFileName, boolean suppressCancel) {
+        TestMultiThreadCancelWalker(final String cancelFileName, final boolean suppressCancel) {
             super();
             this.cancelFileName = cancelFileName;
             this.suppressCancel = suppressCancel;
         }
 
         /** find files. */
-        protected List find(File startDirectory) throws IOException {
+        protected List find(final File startDirectory) throws IOException {
            results = new ArrayList();
            walk(startDirectory, results);
            return results;
@@ -495,7 +495,7 @@ public class DirectoryWalkerTestCaseJava
 
         /** Handles a directory end by adding the File to the result set. */
         @Override
-        protected void handleDirectoryEnd(File directory, int depth, Collection results) throws IOException {
+        protected void handleDirectoryEnd(final File directory, final int depth, final Collection results) throws IOException {
             results.add(directory);
             assertFalse(cancelled);
             if (cancelFileName.equals(directory.getName())) {
@@ -505,7 +505,7 @@ public class DirectoryWalkerTestCaseJava
 
         /** Handles a file by adding the File to the result set. */
         @Override
-        protected void handleFile(File file, int depth, Collection results) throws IOException {
+        protected void handleFile(final File file, final int depth, final Collection results) throws IOException {
             results.add(file);
             assertFalse(cancelled);
             if (cancelFileName.equals(file.getName())) {
@@ -515,14 +515,14 @@ public class DirectoryWalkerTestCaseJava
 
         /** Handles Cancelled. */
         @Override
-        protected boolean handleIsCancelled(File file, int depth, Collection results) throws IOException {
+        protected boolean handleIsCancelled(final File file, final int depth, final Collection results) throws IOException {
             return cancelled;
         }
 
         /** Handles Cancel. */
         @Override
-        protected void handleCancelled(File startDirectory, Collection results,
-                       CancelException cancel) throws IOException {
+        protected void handleCancelled(final File startDirectory, final Collection results,
+                       final CancelException cancel) throws IOException {
             if (!suppressCancel) {
                 super.handleCancelled(startDirectory, results, cancel);
             }

Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/EndianUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/EndianUtilsTest.java?rev=1415850&r1=1415849&r2=1415850&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/EndianUtilsTest.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/EndianUtilsTest.java Fri Nov 30 20:51:39 2012
@@ -28,7 +28,7 @@ import junit.framework.TestCase;
  */
 public class EndianUtilsTest extends TestCase {
 
-    public EndianUtilsTest(String name) {
+    public EndianUtilsTest(final String name) {
         super(name);
     }
 
@@ -38,11 +38,11 @@ public class EndianUtilsTest extends Tes
     }
 
     public void testEOFException() throws IOException {
-        ByteArrayInputStream input = new ByteArrayInputStream(new byte[] {});
+        final ByteArrayInputStream input = new ByteArrayInputStream(new byte[] {});
         try {
             EndianUtils.readSwappedDouble(input);
             fail("Expected EOFException");
-        } catch (EOFException e) {
+        } catch (final EOFException e) {
             // expected
         }
     }
@@ -73,15 +73,15 @@ public class EndianUtilsTest extends Tes
 
     public void testSwapFloat() {
         assertEquals( 0.0f, EndianUtils.swapFloat( 0.0f ), 0.0 );
-        float f1 = Float.intBitsToFloat( 0x01020304 );
-        float f2 = Float.intBitsToFloat( 0x04030201 );
+        final float f1 = Float.intBitsToFloat( 0x01020304 );
+        final float f2 = Float.intBitsToFloat( 0x04030201 );
         assertEquals( f2, EndianUtils.swapFloat( f1 ), 0.0 );
     }
 
     public void testSwapDouble() {
         assertEquals( 0.0, EndianUtils.swapDouble( 0.0 ), 0.0 );
-        double d1 = Double.longBitsToDouble( 0x0102030405060708L );
-        double d2 = Double.longBitsToDouble( 0x0807060504030201L );
+        final double d1 = Double.longBitsToDouble( 0x0102030405060708L );
+        final double d2 = Double.longBitsToDouble( 0x0807060504030201L );
         assertEquals( d2, EndianUtils.swapDouble( d1 ), 0.0 );
     }
 
@@ -93,17 +93,17 @@ public class EndianUtilsTest extends Tes
         assertEquals( (short) 0x0102, EndianUtils.swapShort( EndianUtils.swapShort( (short) 0x0102 ) ) );
         assertEquals( 0x01020304, EndianUtils.swapInteger( EndianUtils.swapInteger( 0x01020304 ) ) );
         assertEquals( 0x0102030405060708L, EndianUtils.swapLong( EndianUtils.swapLong( 0x0102030405060708L ) ) );
-        float f1 = Float.intBitsToFloat( 0x01020304 );
+        final float f1 = Float.intBitsToFloat( 0x01020304 );
         assertEquals( f1, EndianUtils.swapFloat( EndianUtils.swapFloat( f1 ) ), 0.0 );
-        double d1 = Double.longBitsToDouble( 0x0102030405060708L );
+        final double d1 = Double.longBitsToDouble( 0x0102030405060708L );
         assertEquals( d1, EndianUtils.swapDouble( EndianUtils.swapDouble( d1 ) ), 0.0 );
     }
 
     public void testReadSwappedShort() throws IOException {
-        byte[] bytes = new byte[] { 0x02, 0x01 };
+        final byte[] bytes = new byte[] { 0x02, 0x01 };
         assertEquals( 0x0102, EndianUtils.readSwappedShort( bytes, 0 ) );
 
-        ByteArrayInputStream input = new ByteArrayInputStream(bytes);
+        final ByteArrayInputStream input = new ByteArrayInputStream(bytes);
         assertEquals( 0x0102, EndianUtils.readSwappedShort( input ) );
     }
 
@@ -113,7 +113,7 @@ public class EndianUtilsTest extends Tes
         assertEquals( 0x02, bytes[0] );
         assertEquals( 0x01, bytes[1] );
 
-        ByteArrayOutputStream baos = new ByteArrayOutputStream(2);
+        final ByteArrayOutputStream baos = new ByteArrayOutputStream(2);
         EndianUtils.writeSwappedShort( baos, (short) 0x0102 );
         bytes = baos.toByteArray();
         assertEquals( 0x02, bytes[0] );
@@ -121,18 +121,18 @@ public class EndianUtilsTest extends Tes
     }
 
     public void testReadSwappedUnsignedShort() throws IOException {
-        byte[] bytes = new byte[] { 0x02, 0x01 };
+        final byte[] bytes = new byte[] { 0x02, 0x01 };
         assertEquals( 0x00000102, EndianUtils.readSwappedUnsignedShort( bytes, 0 ) );
 
-        ByteArrayInputStream input = new ByteArrayInputStream(bytes);
+        final ByteArrayInputStream input = new ByteArrayInputStream(bytes);
         assertEquals( 0x00000102, EndianUtils.readSwappedUnsignedShort( input ) );
     }
 
     public void testReadSwappedInteger() throws IOException {
-        byte[] bytes = new byte[] { 0x04, 0x03, 0x02, 0x01 };
+        final byte[] bytes = new byte[] { 0x04, 0x03, 0x02, 0x01 };
         assertEquals( 0x01020304, EndianUtils.readSwappedInteger( bytes, 0 ) );
 
-        ByteArrayInputStream input = new ByteArrayInputStream(bytes);
+        final ByteArrayInputStream input = new ByteArrayInputStream(bytes);
         assertEquals( 0x01020304, EndianUtils.readSwappedInteger( input ) );
     }
 
@@ -144,7 +144,7 @@ public class EndianUtilsTest extends Tes
         assertEquals( 0x02, bytes[2] );
         assertEquals( 0x01, bytes[3] );
 
-        ByteArrayOutputStream baos = new ByteArrayOutputStream(4);
+        final ByteArrayOutputStream baos = new ByteArrayOutputStream(4);
         EndianUtils.writeSwappedInteger( baos, 0x01020304 );
         bytes = baos.toByteArray();
         assertEquals( 0x04, bytes[0] );
@@ -154,18 +154,18 @@ public class EndianUtilsTest extends Tes
     }
 
     public void testReadSwappedUnsignedInteger() throws IOException {
-        byte[] bytes = new byte[] { 0x04, 0x03, 0x02, 0x01 };
+        final byte[] bytes = new byte[] { 0x04, 0x03, 0x02, 0x01 };
         assertEquals( 0x0000000001020304L, EndianUtils.readSwappedUnsignedInteger( bytes, 0 ) );
 
-        ByteArrayInputStream input = new ByteArrayInputStream(bytes);
+        final ByteArrayInputStream input = new ByteArrayInputStream(bytes);
         assertEquals( 0x0000000001020304L, EndianUtils.readSwappedUnsignedInteger( input ) );
     }
 
     public void testReadSwappedLong() throws IOException {
-        byte[] bytes = new byte[] { 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01 };
+        final byte[] bytes = new byte[] { 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01 };
         assertEquals( 0x0102030405060708L, EndianUtils.readSwappedLong( bytes, 0 ) );
 
-        ByteArrayInputStream input = new ByteArrayInputStream(bytes);
+        final ByteArrayInputStream input = new ByteArrayInputStream(bytes);
         assertEquals( 0x0102030405060708L, EndianUtils.readSwappedLong( input ) );
     }
 
@@ -181,7 +181,7 @@ public class EndianUtilsTest extends Tes
         assertEquals( 0x02, bytes[6] );
         assertEquals( 0x01, bytes[7] );
 
-        ByteArrayOutputStream baos = new ByteArrayOutputStream(8);
+        final ByteArrayOutputStream baos = new ByteArrayOutputStream(8);
         EndianUtils.writeSwappedLong( baos, 0x0102030405060708L );
         bytes = baos.toByteArray();
         assertEquals( 0x08, bytes[0] );
@@ -195,25 +195,25 @@ public class EndianUtilsTest extends Tes
     }
 
     public void testReadSwappedFloat() throws IOException {
-        byte[] bytes = new byte[] { 0x04, 0x03, 0x02, 0x01 };
-        float f1 = Float.intBitsToFloat( 0x01020304 );
-        float f2 = EndianUtils.readSwappedFloat( bytes, 0 );
+        final byte[] bytes = new byte[] { 0x04, 0x03, 0x02, 0x01 };
+        final float f1 = Float.intBitsToFloat( 0x01020304 );
+        final float f2 = EndianUtils.readSwappedFloat( bytes, 0 );
         assertEquals( f1, f2, 0.0 );
 
-        ByteArrayInputStream input = new ByteArrayInputStream(bytes);
+        final ByteArrayInputStream input = new ByteArrayInputStream(bytes);
         assertEquals( f1, EndianUtils.readSwappedFloat( input ), 0.0 );
     }
 
     public void testWriteSwappedFloat() throws IOException {
         byte[] bytes = new byte[4];
-        float f1 = Float.intBitsToFloat( 0x01020304 );
+        final float f1 = Float.intBitsToFloat( 0x01020304 );
         EndianUtils.writeSwappedFloat( bytes, 0, f1 );
         assertEquals( 0x04, bytes[0] );
         assertEquals( 0x03, bytes[1] );
         assertEquals( 0x02, bytes[2] );
         assertEquals( 0x01, bytes[3] );
 
-        ByteArrayOutputStream baos = new ByteArrayOutputStream(4);
+        final ByteArrayOutputStream baos = new ByteArrayOutputStream(4);
         EndianUtils.writeSwappedFloat( baos, f1 );
         bytes = baos.toByteArray();
         assertEquals( 0x04, bytes[0] );
@@ -223,18 +223,18 @@ public class EndianUtilsTest extends Tes
     }
 
     public void testReadSwappedDouble() throws IOException {
-        byte[] bytes = new byte[] { 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01 };
-        double d1 = Double.longBitsToDouble( 0x0102030405060708L );
-        double d2 = EndianUtils.readSwappedDouble( bytes, 0 );
+        final byte[] bytes = new byte[] { 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01 };
+        final double d1 = Double.longBitsToDouble( 0x0102030405060708L );
+        final double d2 = EndianUtils.readSwappedDouble( bytes, 0 );
         assertEquals( d1, d2, 0.0 );
 
-        ByteArrayInputStream input = new ByteArrayInputStream(bytes);
+        final ByteArrayInputStream input = new ByteArrayInputStream(bytes);
         assertEquals( d1, EndianUtils.readSwappedDouble( input ), 0.0 );
     }
 
     public void testWriteSwappedDouble() throws IOException {
         byte[] bytes = new byte[8];
-        double d1 = Double.longBitsToDouble( 0x0102030405060708L );
+        final double d1 = Double.longBitsToDouble( 0x0102030405060708L );
         EndianUtils.writeSwappedDouble( bytes, 0, d1 );
         assertEquals( 0x08, bytes[0] );
         assertEquals( 0x07, bytes[1] );
@@ -245,7 +245,7 @@ public class EndianUtilsTest extends Tes
         assertEquals( 0x02, bytes[6] );
         assertEquals( 0x01, bytes[7] );
 
-        ByteArrayOutputStream baos = new ByteArrayOutputStream(8);
+        final ByteArrayOutputStream baos = new ByteArrayOutputStream(8);
         EndianUtils.writeSwappedDouble( baos, d1 );
         bytes = baos.toByteArray();
         assertEquals( 0x08, bytes[0] );
@@ -261,33 +261,33 @@ public class EndianUtilsTest extends Tes
     // tests #IO-101
     public void testSymmetryOfLong() {
 
-        double[] tests = new double[] {34.345, -345.5645, 545.12, 10.043, 7.123456789123};
-        for (double test : tests) {
+        final double[] tests = new double[] {34.345, -345.5645, 545.12, 10.043, 7.123456789123};
+        for (final double test : tests) {
 
             // testing the real problem
             byte[] buffer = new byte[8];
-            long ln1 = Double.doubleToLongBits( test );
+            final long ln1 = Double.doubleToLongBits( test );
             EndianUtils.writeSwappedLong(buffer, 0, ln1);
-            long ln2 = EndianUtils.readSwappedLong(buffer, 0);
+            final long ln2 = EndianUtils.readSwappedLong(buffer, 0);
             assertEquals( ln1, ln2 );
 
             // testing the bug report
             buffer = new byte[8];
             EndianUtils.writeSwappedDouble(buffer, 0, test);
-            double val = EndianUtils.readSwappedDouble(buffer, 0);
+            final double val = EndianUtils.readSwappedDouble(buffer, 0);
             assertEquals( test, val, 0 );
         }
     }
 
     // tests #IO-117
     public void testUnsignedOverrun() throws Exception {
-        byte[] target = new byte[] { 0, 0, 0, (byte)0x80 };
-        long expected = 0x80000000L;
+        final byte[] target = new byte[] { 0, 0, 0, (byte)0x80 };
+        final long expected = 0x80000000L;
     
         long actual = EndianUtils.readSwappedUnsignedInteger(target, 0);
         assertEquals("readSwappedUnsignedInteger(byte[], int) was incorrect", expected, actual);
 
-        ByteArrayInputStream in = new ByteArrayInputStream(target);
+        final ByteArrayInputStream in = new ByteArrayInputStream(target);
         actual = EndianUtils.readSwappedUnsignedInteger(in);
         assertEquals("readSwappedUnsignedInteger(InputStream) was incorrect", expected, actual);
     }

Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileCleanerTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileCleanerTestCase.java?rev=1415850&r1=1415849&r2=1415850&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileCleanerTestCase.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileCleanerTestCase.java Fri Nov 30 20:51:39 2012
@@ -30,7 +30,7 @@ public class FileCleanerTestCase extends
         return FileCleaner.getInstance();
     }
 
-    public FileCleanerTestCase(String name) {
+    public FileCleanerTestCase(final String name) {
         super(name);
     }
 }

Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileCleaningTrackerTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileCleaningTrackerTestCase.java?rev=1415850&r1=1415849&r2=1415850&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileCleaningTrackerTestCase.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileCleaningTrackerTestCase.java Fri Nov 30 20:51:39 2012
@@ -38,7 +38,7 @@ public class FileCleaningTrackerTestCase
     private File testFile;
     private FileCleaningTracker theInstance;
 
-    public FileCleaningTrackerTestCase(String name) {
+    public FileCleaningTrackerTestCase(final String name) {
         super(name);
         testFile = new File(getTestDirectory(), "file-test.txt");
     }
@@ -76,7 +76,7 @@ public class FileCleaningTrackerTestCase
 
     //-----------------------------------------------------------------------
     public void testFileCleanerFile() throws Exception {
-        String path = testFile.getPath();
+        final String path = testFile.getPath();
         
         assertFalse(testFile.exists());
         RandomAccessFile r = new RandomAccessFile(testFile, "rw");
@@ -159,25 +159,25 @@ public class FileCleaningTrackerTestCase
         try {
             theInstance.track((File) null, new Object());
             fail();
-        } catch (NullPointerException ex) {
+        } catch (final NullPointerException ex) {
             // expected
         }
         try {
             theInstance.track((File) null, new Object(), FileDeleteStrategy.NORMAL);
             fail();
-        } catch (NullPointerException ex) {
+        } catch (final NullPointerException ex) {
             // expected
         }
         try {
             theInstance.track((String) null, new Object());
             fail();
-        } catch (NullPointerException ex) {
+        } catch (final NullPointerException ex) {
             // expected
         }
         try {
             theInstance.track((String) null, new Object(), FileDeleteStrategy.NORMAL);
             fail();
-        } catch (NullPointerException ex) {
+        } catch (final NullPointerException ex) {
             // expected
         }
     }
@@ -201,12 +201,12 @@ public class FileCleaningTrackerTestCase
         assertTrue(theInstance.exitWhenFinished);
         assertEquals(null, theInstance.reaper);
         
-        String path = testFile.getPath();
-        Object marker = new Object();
+        final String path = testFile.getPath();
+        final Object marker = new Object();
         try {
             theInstance.track(path, marker);
             fail();
-        } catch (IllegalStateException ex) {
+        } catch (final IllegalStateException ex) {
             // expected
         }
         assertTrue(theInstance.exitWhenFinished);
@@ -214,7 +214,7 @@ public class FileCleaningTrackerTestCase
     }
 
     public void testFileCleanerExitWhenFinished1() throws Exception {
-        String path = testFile.getPath();
+        final String path = testFile.getPath();
         
         assertEquals("1-testFile exists", false, testFile.exists());
         RandomAccessFile r = new RandomAccessFile(testFile, "rw");
@@ -245,7 +245,7 @@ public class FileCleaningTrackerTestCase
     }
 
     public void testFileCleanerExitWhenFinished2() throws Exception {
-        String path = testFile.getPath();
+        final String path = testFile.getPath();
         
         assertFalse(testFile.exists());
         RandomAccessFile r = new RandomAccessFile(testFile, "rw");
@@ -284,7 +284,7 @@ public class FileCleaningTrackerTestCase
         while(file.exists() && count++ < 40) {
             try {
                 Thread.sleep(500L);
-            } catch (InterruptedException e) {
+            } catch (final InterruptedException e) {
             }
             file = new File(file.getPath());
         }
@@ -308,7 +308,7 @@ public class FileCleaningTrackerTestCase
                 while (theInstance.getTrackCount() != 0) {
                     list.add("A Big String A Big String A Big String A Big String A Big String A Big String A Big String A Big String A Big String A Big String " + (i++));
                 }
-            } catch (Throwable ignored) {
+            } catch (final Throwable ignored) {
             }
             list = null;
             System.gc(); 

Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileDeleteStrategyTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileDeleteStrategyTestCase.java?rev=1415850&r1=1415849&r2=1415850&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileDeleteStrategyTestCase.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileDeleteStrategyTestCase.java Fri Nov 30 20:51:39 2012
@@ -29,7 +29,7 @@ import org.apache.commons.io.testtools.F
  */
 public class FileDeleteStrategyTestCase extends FileBasedTestCase {
 
-    public FileDeleteStrategyTestCase(String name) {
+    public FileDeleteStrategyTestCase(final String name) {
         super(name);
     }
 
@@ -45,10 +45,10 @@ public class FileDeleteStrategyTestCase 
 
     //-----------------------------------------------------------------------
     public void testDeleteNormal() throws Exception {
-        File baseDir = getTestDirectory();
-        File subDir = new File(baseDir, "test");
+        final File baseDir = getTestDirectory();
+        final File subDir = new File(baseDir, "test");
         assertTrue(subDir.mkdir());
-        File subFile = new File(subDir, "a.txt");
+        final File subFile = new File(subDir, "a.txt");
         createFile(subFile, 16);
         
         assertTrue(subDir.exists());
@@ -57,7 +57,7 @@ public class FileDeleteStrategyTestCase 
         try {
             FileDeleteStrategy.NORMAL.delete(subDir);
             fail();
-        } catch (IOException ex) {
+        } catch (final IOException ex) {
             // expected
         }
         assertTrue(subDir.exists());
@@ -75,10 +75,10 @@ public class FileDeleteStrategyTestCase 
     }
 
     public void testDeleteQuietlyNormal() throws Exception {
-        File baseDir = getTestDirectory();
-        File subDir = new File(baseDir, "test");
+        final File baseDir = getTestDirectory();
+        final File subDir = new File(baseDir, "test");
         assertTrue(subDir.mkdir());
-        File subFile = new File(subDir, "a.txt");
+        final File subFile = new File(subDir, "a.txt");
         createFile(subFile, 16);
         
         assertTrue(subDir.exists());
@@ -100,10 +100,10 @@ public class FileDeleteStrategyTestCase 
     }
 
     public void testDeleteForce() throws Exception {
-        File baseDir = getTestDirectory();
-        File subDir = new File(baseDir, "test");
+        final File baseDir = getTestDirectory();
+        final File subDir = new File(baseDir, "test");
         assertTrue(subDir.mkdir());
-        File subFile = new File(subDir, "a.txt");
+        final File subFile = new File(subDir, "a.txt");
         createFile(subFile, 16);
         
         assertTrue(subDir.exists());
@@ -121,7 +121,7 @@ public class FileDeleteStrategyTestCase 
         try {
             FileDeleteStrategy.NORMAL.delete((File) null);
             fail();
-        } catch (NullPointerException ex) {
+        } catch (final NullPointerException ex) {
             // expected
         }
         assertTrue(FileDeleteStrategy.NORMAL.deleteQuietly((File) null));



Mime
View raw message