commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bay...@apache.org
Subject cvs commit: jakarta-commons-sandbox/io/src/test/org/apache/commons/io/testtools FileBasedTestCase.java
Date Tue, 30 Dec 2003 07:00:04 GMT
bayard      2003/12/29 23:00:04

  Modified:    io/src/test/org/apache/commons/io CopyUtilsTest.java
                        DemuxTestCase.java FileUtilsFileNewerTestCase.java
                        FileUtilsListFilesTestCase.java
                        FileUtilsTestCase.java FilenameUtilsTestCase.java
                        HexDumpTest.java IOTestSuite.java
                        IOUtilsTestCase.java
               io/src/test/org/apache/commons/io/filefilter
                        FileFilterTestCase.java
               io/src/test/org/apache/commons/io/input
                        CountingInputStreamTest.java
               io/src/test/org/apache/commons/io/output
                        ByteArrayOutputStreamTestCase.java
               io/src/test/org/apache/commons/io/testtools
                        FileBasedTestCase.java
  Log:
  removed finals from test code
  
  Revision  Changes    Path
  1.4       +6 -6      jakarta-commons-sandbox/io/src/test/org/apache/commons/io/CopyUtilsTest.java
  
  Index: CopyUtilsTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/io/src/test/org/apache/commons/io/CopyUtilsTest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- CopyUtilsTest.java	22 Nov 2003 20:18:55 -0000	1.3
  +++ CopyUtilsTest.java	30 Dec 2003 07:00:03 -0000	1.4
  @@ -87,7 +87,7 @@
        * relevant methods are called. (JT)
        */
   
  -    private final int FILE_SIZE = 1024 * 4 + 1;
  +    private int FILE_SIZE = 1024 * 4 + 1;
   
   
       private byte[] inData = generateTestData(FILE_SIZE);
  @@ -180,7 +180,7 @@
           
           CopyUtils.copy(reader, out);
           //Note: this method *does* flush. It is equivalent to:
  -        //  final OutputStreamWriter _out = new OutputStreamWriter(fout);
  +        //  OutputStreamWriter _out = new OutputStreamWriter(fout);
           //  IOUtils.copy( fin, _out, 4096 ); // copy( Reader, Writer, int );
           //  _out.flush();
           //  out = fout;
  @@ -210,14 +210,14 @@
       }
   
       public void testCopy_stringToOutputStream() throws Exception {
  -        final String str = new String(inData, "US-ASCII");
  +        String str = new String(inData, "US-ASCII");
           
           ByteArrayOutputStream baout = new ByteArrayOutputStream();
           OutputStream out = new YellOnFlushAndCloseOutputStream(baout, false, true);
   
           CopyUtils.copy(str, out);
           //Note: this method *does* flush. It is equivalent to:
  -        //  final OutputStreamWriter _out = new OutputStreamWriter(fout);
  +        //  OutputStreamWriter _out = new OutputStreamWriter(fout);
           //  IOUtils.copy( str, _out, 4096 ); // copy( Reader, Writer, int );
           //  _out.flush();
           //  out = fout;
  @@ -228,7 +228,7 @@
       }
   
       public void testCopy_stringToWriter() throws Exception {
  -        final String str = new String(inData, "US-ASCII");
  +        String str = new String(inData, "US-ASCII");
   
           ByteArrayOutputStream baout = new ByteArrayOutputStream();
           OutputStream out = new YellOnFlushAndCloseOutputStream(baout, false, true);
  
  
  
  1.8       +59 -59    jakarta-commons-sandbox/io/src/test/org/apache/commons/io/DemuxTestCase.java
  
  Index: DemuxTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/io/src/test/org/apache/commons/io/DemuxTestCase.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- DemuxTestCase.java	22 Nov 2003 20:18:54 -0000	1.7
  +++ DemuxTestCase.java	30 Dec 2003 07:00:03 -0000	1.8
  @@ -79,42 +79,42 @@
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
    */
  -public final class DemuxTestCase
  +public class DemuxTestCase
       extends TestCase
   {
  -    private static final String T1 = "Thread1";
  -    private static final String T2 = "Thread2";
  -    private static final String T3 = "Thread3";
  -    private static final String T4 = "Thread4";
  -
  -    private static final String DATA1 = "Data for thread1";
  -    private static final String DATA2 = "Data for thread2";
  -    private static final String DATA3 = "Data for thread3";
  -    private static final String DATA4 = "Data for thread4";
  -
  -    private static final Random c_random = new Random();
  -    private final HashMap m_outputMap = new HashMap();
  -    private final HashMap m_threadMap = new HashMap();
  +    private static String T1 = "Thread1";
  +    private static String T2 = "Thread2";
  +    private static String T3 = "Thread3";
  +    private static String T4 = "Thread4";
  +
  +    private static String DATA1 = "Data for thread1";
  +    private static String DATA2 = "Data for thread2";
  +    private static String DATA3 = "Data for thread3";
  +    private static String DATA4 = "Data for thread4";
  +
  +    private static Random c_random = new Random();
  +    private HashMap m_outputMap = new HashMap();
  +    private HashMap m_threadMap = new HashMap();
   
  -    public DemuxTestCase( final String name )
  +    public DemuxTestCase( String name )
       {
           super( name );
       }
   
  -    private String getOutput( final String threadName )
  +    private String getOutput( String threadName )
           throws IOException
       {
  -        final ByteArrayOutputStream output =
  +        ByteArrayOutputStream output =
               (ByteArrayOutputStream)m_outputMap.get( threadName );
           assertNotNull( "getOutput()", output );
   
           return output.toString();
       }
   
  -    private String getInput( final String threadName )
  +    private String getInput( String threadName )
           throws IOException
       {
  -        final ReaderThread thread = (ReaderThread)m_threadMap.get( threadName );
  +        ReaderThread thread = (ReaderThread)m_threadMap.get( threadName );
           assertNotNull( "getInput()", thread );
   
           return thread.getData();
  @@ -123,11 +123,11 @@
       private void doStart()
           throws Exception
       {
  -        final Iterator iterator = m_threadMap.keySet().iterator();
  +        Iterator iterator = m_threadMap.keySet().iterator();
           while( iterator.hasNext() )
           {
  -            final String name = (String)iterator.next();
  -            final Thread thread = (Thread)m_threadMap.get( name );
  +            String name = (String)iterator.next();
  +            Thread thread = (Thread)m_threadMap.get( name );
               thread.start();
           }
       }
  @@ -135,41 +135,41 @@
       private void doJoin()
           throws Exception
       {
  -        final Iterator iterator = m_threadMap.keySet().iterator();
  +        Iterator iterator = m_threadMap.keySet().iterator();
           while( iterator.hasNext() )
           {
  -            final String name = (String)iterator.next();
  -            final Thread thread = (Thread)m_threadMap.get( name );
  +            String name = (String)iterator.next();
  +            Thread thread = (Thread)m_threadMap.get( name );
               thread.join();
           }
       }
   
  -    private void startWriter( final String name,
  -                              final String data,
  -                              final DemuxOutputStream demux )
  +    private void startWriter( String name,
  +                              String data,
  +                              DemuxOutputStream demux )
           throws Exception
       {
  -        final ByteArrayOutputStream output = new ByteArrayOutputStream();
  +        ByteArrayOutputStream output = new ByteArrayOutputStream();
           m_outputMap.put( name, output );
  -        final WriterThread thread =
  +        WriterThread thread =
               new WriterThread( name, data, output, demux );
           m_threadMap.put( name, thread );
       }
   
  -    private void startReader( final String name,
  -                              final String data,
  -                              final DemuxInputStream demux )
  +    private void startReader( String name,
  +                              String data,
  +                              DemuxInputStream demux )
           throws Exception
       {
  -        final ByteArrayInputStream input = new ByteArrayInputStream( data.getBytes() );
  -        final ReaderThread thread = new ReaderThread( name, input, demux );
  +        ByteArrayInputStream input = new ByteArrayInputStream( data.getBytes() );
  +        ReaderThread thread = new ReaderThread( name, input, demux );
           m_threadMap.put( name, thread );
       }
   
       public void testOutputStream()
           throws Exception
       {
  -        final DemuxOutputStream output = new DemuxOutputStream();
  +        DemuxOutputStream output = new DemuxOutputStream();
           startWriter( T1, DATA1, output );
           startWriter( T2, DATA2, output );
           startWriter( T3, DATA3, output );
  @@ -187,7 +187,7 @@
       public void testInputStream()
           throws Exception
       {
  -        final DemuxInputStream input = new DemuxInputStream();
  +        DemuxInputStream input = new DemuxInputStream();
           startReader( T1, DATA1, input );
           startReader( T2, DATA2, input );
           startReader( T3, DATA3, input );
  @@ -205,13 +205,13 @@
       private static class ReaderThread
           extends Thread
       {
  -        private final StringBuffer m_buffer = new StringBuffer();
  -        private final InputStream m_input;
  -        private final DemuxInputStream m_demux;
  -
  -        ReaderThread( final String name,
  -                      final InputStream input,
  -                      final DemuxInputStream demux )
  +        private StringBuffer m_buffer = new StringBuffer();
  +        private InputStream m_input;
  +        private DemuxInputStream m_demux;
  +
  +        ReaderThread( String name,
  +                      InputStream input,
  +                      DemuxInputStream demux )
           {
               super( name );
               m_input = input;
  @@ -235,12 +235,12 @@
                       //System.out.println( "Reading: " + (char)ch );
                       m_buffer.append( (char)ch );
   
  -                    final int sleepTime = Math.abs( c_random.nextInt() % 10 );
  +                    int sleepTime = Math.abs( c_random.nextInt() % 10 );
                       Thread.sleep( sleepTime );
                       ch = m_demux.read();
                   }
               }
  -            catch( final Exception e )
  +            catch( Exception e )
               {
                   e.printStackTrace();
               }
  @@ -250,14 +250,14 @@
       private static class WriterThread
           extends Thread
       {
  -        private final byte[] m_data;
  -        private final OutputStream m_output;
  -        private final DemuxOutputStream m_demux;
  -
  -        WriterThread( final String name,
  -                      final String data,
  -                      final OutputStream output,
  -                      final DemuxOutputStream demux )
  +        private byte[] m_data;
  +        private OutputStream m_output;
  +        private DemuxOutputStream m_demux;
  +
  +        WriterThread( String name,
  +                      String data,
  +                      OutputStream output,
  +                      DemuxOutputStream demux )
           {
               super( name );
               m_output = output;
  @@ -274,10 +274,10 @@
                   {
                       //System.out.println( "Writing: " + (char)m_data[ i ] );
                       m_demux.write( m_data[ i ] );
  -                    final int sleepTime = Math.abs( c_random.nextInt() % 10 );
  +                    int sleepTime = Math.abs( c_random.nextInt() % 10 );
                       Thread.sleep( sleepTime );
                   }
  -                catch( final Exception e )
  +                catch( Exception e )
                   {
                       e.printStackTrace();
                   }
  
  
  
  1.3       +11 -11    jakarta-commons-sandbox/io/src/test/org/apache/commons/io/FileUtilsFileNewerTestCase.java
  
  Index: FileUtilsFileNewerTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/io/src/test/org/apache/commons/io/FileUtilsFileNewerTestCase.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- FileUtilsFileNewerTestCase.java	13 Oct 2003 07:06:04 -0000	1.2
  +++ FileUtilsFileNewerTestCase.java	30 Dec 2003 07:00:03 -0000	1.3
  @@ -70,16 +70,16 @@
    *
    * @author <a href="mailto:alban.peignier@free.fr">Alban Peignier</a>
    */
  -public final class FileUtilsFileNewerTestCase extends FileBasedTestCase {
  +public class FileUtilsFileNewerTestCase extends FileBasedTestCase {
   
       // Test data
  -    private static final int FILE1_SIZE = 1;
  -    private static final int FILE2_SIZE = 1024 * 4 + 1;
  +    private static int FILE1_SIZE = 1;
  +    private static int FILE2_SIZE = 1024 * 4 + 1;
   
  -    private final File m_testFile1;
  -    private final File m_testFile2;
  +    private File m_testFile1;
  +    private File m_testFile2;
   
  -    public FileUtilsFileNewerTestCase(final String name) {
  +    public FileUtilsFileNewerTestCase(String name) {
           super(name);
           
           m_testFile1 = new File(getTestDirectory(), "file1-test.txt");
  @@ -111,7 +111,7 @@
               throw new IllegalStateException("The m_testFile1 should exist");
   
           long fileLastModified = m_testFile1.lastModified();
  -        final long ONE_SECOND = 1000;
  +        long ONE_SECOND = 1000;
   
           testIsFileNewer("one second earlier is not newer" , m_testFile1, fileLastModified + ONE_SECOND, false);
           testIsFileNewer("same time is not newer" , m_testFile1, fileLastModified, false);
  @@ -159,7 +159,7 @@
           assertEquals(description + " - time", wantedResult, FileUtils.isFileNewer(file, time));
           assertEquals(description + " - date", wantedResult, FileUtils.isFileNewer(file, new Date(time)));
           
  -        final File temporaryFile = m_testFile2;
  +        File temporaryFile = m_testFile2;
   
           temporaryFile.setLastModified(time);
           if (temporaryFile.lastModified() != time)
  
  
  
  1.3       +1 -1      jakarta-commons-sandbox/io/src/test/org/apache/commons/io/FileUtilsListFilesTestCase.java
  
  Index: FileUtilsListFilesTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/io/src/test/org/apache/commons/io/FileUtilsListFilesTestCase.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- FileUtilsListFilesTestCase.java	25 Dec 2003 11:03:35 -0000	1.2
  +++ FileUtilsListFilesTestCase.java	30 Dec 2003 07:00:03 -0000	1.3
  @@ -76,7 +76,7 @@
       }
       
       public void testListFilesByExtension() throws Exception {
  -        final String[] extensions = {"xml", "txt"};
  +        String[] extensions = {"xml", "txt"};
           
           Collection files = FileUtils.listFiles(getLocalTestDirectory(), extensions, false);
           assertEquals(1, files.size());
  
  
  
  1.9       +33 -33    jakarta-commons-sandbox/io/src/test/org/apache/commons/io/FileUtilsTestCase.java
  
  Index: FileUtilsTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/io/src/test/org/apache/commons/io/FileUtilsTestCase.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- FileUtilsTestCase.java	23 Nov 2003 20:43:30 -0000	1.8
  +++ FileUtilsTestCase.java	30 Dec 2003 07:00:03 -0000	1.9
  @@ -78,17 +78,17 @@
    * @version $Id$
    * @see FileUtils
    */
  -public final class FileUtilsTestCase extends FileBasedTestCase {
  +public class FileUtilsTestCase extends FileBasedTestCase {
   
       // Test data
   
       /**
        * Size of test directory.
        */
  -    private static final int TEST_DIRECTORY_SIZE = 0;
  +    private static int TEST_DIRECTORY_SIZE = 0;
   
  -    private final File testFile1;
  -    private final File testFile2;
  +    private File testFile1;
  +    private File testFile2;
   
       private static int testFile1Size;
       private static int testFile2Size;
  @@ -101,7 +101,7 @@
           return new TestSuite(FileUtilsTestCase.class);
       }
   
  -    public FileUtilsTestCase(final String name) throws IOException {
  +    public FileUtilsTestCase(String name) throws IOException {
           super(name);
   
           testFile1 = new File(getTestDirectory(), "file1-test.txt");
  @@ -149,9 +149,9 @@
       // toURL
   
       public void testToURLs() throws Exception {
  -        final File[] files = new File[] { new File("file1"), new File("file2")};
  +        File[] files = new File[] { new File("file1"), new File("file2")};
   
  -        final URL[] urls = FileUtils.toURLs(files);
  +        URL[] urls = FileUtils.toURLs(files);
   
           // Path separator causes equality tests to fail
           //assertEquals(urls[0].getFile(), File.separator + files[0].getAbsolutePath());
  @@ -163,7 +163,7 @@
   
       public void testContentEquals() throws Exception {
           // Non-existent files
  -        final File file = new File(getTestDirectory(), getName());
  +        File file = new File(getTestDirectory(), getName());
           assertTrue(FileUtils.contentEquals(file, file));
   
           // Directories
  @@ -175,14 +175,14 @@
           }
   
           // Different files
  -        final File objFile1 =
  +        File objFile1 =
               new File(getTestDirectory(), getName() + ".object");
           objFile1.deleteOnExit();
           FileUtils.copyURLToFile(
               getClass().getResource("/java/lang/Object.class"),
               objFile1);
   
  -        final File objFile2 =
  +        File objFile2 =
               new File(getTestDirectory(), getName() + ".collection");
           objFile2.deleteOnExit();
           FileUtils.copyURLToFile(
  @@ -202,15 +202,15 @@
   
       public void testCopyURLToFile() throws Exception {
           // Creates file
  -        final File file = new File(getTestDirectory(), getName());
  +        File file = new File(getTestDirectory(), getName());
           file.deleteOnExit();
   
           // Loads resource
  -        final String resourceName = "/java/lang/Object.class";
  +        String resourceName = "/java/lang/Object.class";
           FileUtils.copyURLToFile(getClass().getResource(resourceName), file);
   
           // Tests that resuorce was copied correctly
  -        final FileInputStream fis = new FileInputStream(file);
  +        FileInputStream fis = new FileInputStream(file);
           try {
               assertTrue(
                   "Content is not equal.",
  @@ -229,7 +229,7 @@
           FileUtils.forceMkdir(getTestDirectory());
   
           // Creates test file
  -        final File testFile = new File(getTestDirectory(), getName());
  +        File testFile = new File(getTestDirectory(), getName());
           testFile.deleteOnExit();
           testFile.createNewFile();
           assertTrue("Test file does not exist.", testFile.exists());
  @@ -250,7 +250,7 @@
       // sizeOfDirectory
   
       public void testSizeOfDirectory() throws Exception {
  -        final File file = new File(getTestDirectory(), getName());
  +        File file = new File(getTestDirectory(), getName());
   
           // Non-existent file
           try {
  @@ -284,7 +284,7 @@
       public void XtestIsFileNewer() {}
   
       // TODO Remove after debugging
  -    private final void log(Object obj) {
  +    private void log(Object obj) {
           System.out.println(
               FileUtilsTestCase.class +" " + getName() + " " + obj);
       }
  @@ -292,14 +292,14 @@
       // copyFile
   
       public void testCopyFile1() throws Exception {
  -        final File destination = new File(getTestDirectory(), "copy1.txt");
  +        File destination = new File(getTestDirectory(), "copy1.txt");
           FileUtils.copyFile(testFile1, destination);
           assertTrue("Check Exist", destination.exists());
           assertTrue("Check Full copy", destination.length() == testFile1Size);
       }
   
       public void testCopyFile2() throws Exception {
  -        final File destination = new File(getTestDirectory(), "copy2.txt");
  +        File destination = new File(getTestDirectory(), "copy2.txt");
           FileUtils.copyFile(testFile1, destination);
           assertTrue("Check Exist", destination.exists());
           assertTrue("Check Full copy", destination.length() == testFile2Size);
  @@ -308,7 +308,7 @@
       // forceDelete
   
       public void testForceDeleteAFile1() throws Exception {
  -        final File destination = new File(getTestDirectory(), "copy1.txt");
  +        File destination = new File(getTestDirectory(), "copy1.txt");
           destination.createNewFile();
           assertTrue("Copy1.txt doesn't exist to delete", destination.exists());
           FileUtils.forceDelete(destination);
  @@ -316,7 +316,7 @@
       }
   
       public void testForceDeleteAFile2() throws Exception {
  -        final File destination = new File(getTestDirectory(), "copy2.txt");
  +        File destination = new File(getTestDirectory(), "copy2.txt");
           destination.createNewFile();
           assertTrue("Copy2.txt doesn't exist to delete", destination.exists());
           FileUtils.forceDelete(destination);
  @@ -326,20 +326,20 @@
       // copyFileToDirectory
   
       public void testCopyFile1ToDir() throws Exception {
  -        final File directory = new File(getTestDirectory(), "subdir");
  +        File directory = new File(getTestDirectory(), "subdir");
           if (!directory.exists())
               directory.mkdirs();
  -        final File destination = new File(directory, testFile1.getName());
  +        File destination = new File(directory, testFile1.getName());
           FileUtils.copyFileToDirectory(testFile1, directory);
           assertTrue("Check Exist", destination.exists());
           assertTrue("Check Full copy", destination.length() == testFile1Size);
       }
   
       public void testCopyFile2ToDir() throws Exception {
  -        final File directory = new File(getTestDirectory(), "subdir");
  +        File directory = new File(getTestDirectory(), "subdir");
           if (!directory.exists())
               directory.mkdirs();
  -        final File destination = new File(directory, testFile1.getName());
  +        File destination = new File(directory, testFile1.getName());
           FileUtils.copyFileToDirectory(testFile1, directory);
           assertTrue("Check Exist", destination.exists());
           assertTrue("Check Full copy", destination.length() == testFile2Size);
  @@ -375,14 +375,14 @@
       // Used to exist as IOTestCase class
       public void testFileUtils() throws Exception {
           // Loads file from classpath
  -        final String path = "/test.txt";
  -        final URL url = this.getClass().getResource(path);
  +        String path = "/test.txt";
  +        URL url = this.getClass().getResource(path);
           assertNotNull(path + " was not found.", url);
   
           String filename = url.getFile();
           //The following line applies a fix for spaces in a path
           filename = replaceAll(filename, "%20", " ");
  -        final String filename2 = "test2.txt";
  +        String filename2 = "test2.txt";
   
           assertTrue(
               "test.txt extension == \"txt\"",
  @@ -399,7 +399,7 @@
           FileUtils.writeStringToFile(new File(filename2), filename, "UTF-8");
           assertTrue("Second file was written", FilenameUtils.fileExists(filename2));
   
  -        final String file2contents = FileUtils.readFileToString(new File(filename2), "UTF-8");
  +        String file2contents = FileUtils.readFileToString(new File(filename2), "UTF-8");
           assertTrue(
               "Second file's contents correct",
               FileUtils.readFileToString(new File(filename2), "UTF-8").equals(file2contents));
  @@ -409,7 +409,7 @@
               "Second test file does not exist",
               !FilenameUtils.fileExists(filename2));
   
  -        final String contents = FileUtils.readFileToString(new File(filename), "UTF-8");
  +        String contents = FileUtils.readFileToString(new File(filename), "UTF-8");
           assertTrue("FileUtils.fileRead()", contents.equals("This is a test"));
   
       }
  
  
  
  1.3       +20 -20    jakarta-commons-sandbox/io/src/test/org/apache/commons/io/FilenameUtilsTestCase.java
  
  Index: FilenameUtilsTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/io/src/test/org/apache/commons/io/FilenameUtilsTestCase.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- FilenameUtilsTestCase.java	27 Nov 2003 20:53:54 -0000	1.2
  +++ FilenameUtilsTestCase.java	30 Dec 2003 07:00:03 -0000	1.3
  @@ -78,17 +78,17 @@
    * @version $Id$
    * @see FilenameUtils
    */
  -public final class FilenameUtilsTestCase extends FileBasedTestCase {
  +public class FilenameUtilsTestCase extends FileBasedTestCase {
   
       // Test data
   
       /**
        * Size of test directory.
        */
  -    private static final int TEST_DIRECTORY_SIZE = 0;
  +    private static int TEST_DIRECTORY_SIZE = 0;
   
  -    private final File testFile1;
  -    private final File testFile2;
  +    private File testFile1;
  +    private File testFile2;
   
       private static int testFile1Size;
       private static int testFile2Size;
  @@ -101,7 +101,7 @@
           return new TestSuite(FilenameUtilsTestCase.class);
       }
   
  -    public FilenameUtilsTestCase(final String name) throws IOException {
  +    public FilenameUtilsTestCase(String name) throws IOException {
           super(name);
   
           testFile1 = new File(getTestDirectory(), "file1-test.txt");
  @@ -130,7 +130,7 @@
       // mkdir
   
       public void testMkdir() {
  -        final File dir = new File(getTestDirectory(), "testdir");
  +        File dir = new File(getTestDirectory(), "testdir");
           FilenameUtils.mkdir(dir.getAbsolutePath());
           dir.deleteOnExit();
       }
  @@ -138,7 +138,7 @@
       // removePath
   
       public void testRemovePath() {
  -        final String fileName =
  +        String fileName =
               FilenameUtils.removePath(
                   new File(getTestDirectory(), getName()).getAbsolutePath());
           assertEquals(getName(), fileName);
  @@ -147,7 +147,7 @@
       // getPath
   
       public void testGetPath() {
  -        final String fileName =
  +        String fileName =
               FilenameUtils.getPath(
                   new File(getTestDirectory(), getName()).getAbsolutePath());
           assertEquals(getTestDirectory().getAbsolutePath(), fileName);
  @@ -167,7 +167,7 @@
       // resolveFile
   
       public void testResolveFileDotDot() throws Exception {
  -        final File file = FilenameUtils.resolveFile(getTestDirectory(), "..");
  +        File file = FilenameUtils.resolveFile(getTestDirectory(), "..");
           assertEquals(
               "Check .. operator",
               file,
  @@ -175,14 +175,14 @@
       }
   
       public void testResolveFileDot() throws Exception {
  -        final File file = FilenameUtils.resolveFile(getTestDirectory(), ".");
  +        File file = FilenameUtils.resolveFile(getTestDirectory(), ".");
           assertEquals("Check . operator", file, getTestDirectory());
       }
   
       // normalize
   
       public void testNormalize() throws Exception {
  -        final String[] src =
  +        String[] src =
               {
                   "",
                   "/",
  @@ -202,7 +202,7 @@
                   "/../",
                   "/foo/../../" };
   
  -        final String[] dest =
  +        String[] dest =
               {
                   "",
                   "/",
  @@ -248,7 +248,7 @@
       }
   
       public void testGetExtension() {
  -        final String[][] tests = { { "filename.ext", "ext" }, {
  +        String[][] tests = { { "filename.ext", "ext" }, {
                   "README", "" }, {
                   "domain.dot.com", "com" }, {
                   "image.jpeg", "jpeg" }
  @@ -261,7 +261,7 @@
   
       /* TODO: Reenable this test */
       public void DISABLED__testGetExtensionWithPaths() {
  -        final String[][] testsWithPaths =
  +        String[][] testsWithPaths =
               { { "/tmp/foo/filename.ext", "ext" }, {
                   "C:\\temp\\foo\\filename.ext", "ext" }, {
                   "/tmp/foo.bar/filename.ext", "ext" }, {
  @@ -279,7 +279,7 @@
       }
   
       public void testRemoveExtension() {
  -        final String[][] tests = { { "filename.ext", "filename" }, {
  +        String[][] tests = { { "filename.ext", "filename" }, {
                   "first.second.third.ext", "first.second.third" }, {
                   "README", "README" }, {
                   "domain.dot.com", "domain.dot" }, {
  @@ -294,7 +294,7 @@
   
       /* TODO: Reenable this test */
       public void DISABLED__testRemoveExtensionWithPaths() {
  -        final String[][] testsWithPaths =
  +        String[][] testsWithPaths =
               { { "/tmp/foo/filename.ext", "filename" }, {
                   "C:\\temp\\foo\\filename.ext", "filename" }, {
                   "/tmp/foo.bar/filename.ext", "filename" }, {
  
  
  
  1.4       +6 -6      jakarta-commons-sandbox/io/src/test/org/apache/commons/io/HexDumpTest.java
  
  Index: HexDumpTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/io/src/test/org/apache/commons/io/HexDumpTest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- HexDumpTest.java	22 Nov 2003 20:18:54 -0000	1.3
  +++ HexDumpTest.java	30 Dec 2003 07:00:03 -0000	1.4
  @@ -85,7 +85,7 @@
           super(name);
       }
   
  -    private char toHex(final int n) {
  +    private char toHex(int n) {
           char[] hexChars =
                   {
                       '0', '1', '2', '3', '4', '5', '6', '7',
  @@ -291,7 +291,7 @@
           }
       }
   
  -    private char toAscii(final int c) {
  +    private char toAscii(int c) {
           char rval = '.';
   
           if ((c >= 32) && (c <= 126)) {
  
  
  
  1.8       +4 -4      jakarta-commons-sandbox/io/src/test/org/apache/commons/io/IOTestSuite.java
  
  Index: IOTestSuite.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/io/src/test/org/apache/commons/io/IOTestSuite.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- IOTestSuite.java	13 Oct 2003 07:06:04 -0000	1.7
  +++ IOTestSuite.java	30 Dec 2003 07:00:03 -0000	1.8
  @@ -82,7 +82,7 @@
       
       public static Test suite()
       {
  -        final TestSuite suite = new TestSuite( "IO Utilities" );
  +        TestSuite suite = new TestSuite( "IO Utilities" );
           suite.addTest( new TestSuite( CopyUtilsTest.class ) );
           suite.addTest( new TestSuite( IOUtilsTestCase.class ) );
           suite.addTest( new TestSuite( FileUtilsTestCase.class ) );
  
  
  
  1.4       +46 -46    jakarta-commons-sandbox/io/src/test/org/apache/commons/io/IOUtilsTestCase.java
  
  Index: IOUtilsTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/io/src/test/org/apache/commons/io/IOUtilsTestCase.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- IOUtilsTestCase.java	13 Oct 2003 07:06:04 -0000	1.3
  +++ IOUtilsTestCase.java	30 Dec 2003 07:00:03 -0000	1.4
  @@ -87,7 +87,7 @@
    *
    * @author <a href="mailto:jefft@apache.org">Jeff Turner</a>
    */
  -public final class IOUtilsTestCase extends FileBasedTestCase {
  +public class IOUtilsTestCase extends FileBasedTestCase {
       /*
        * Note: this is not particularly beautiful code. A better way to check for
        * flush and close status would be to implement "trojan horse" wrapper
  @@ -95,7 +95,7 @@
        * relevant methods are called. (JT)
        */
   
  -    private final int FILE_SIZE = 1024 * 4 + 1;
  +    private int FILE_SIZE = 1024 * 4 + 1;
   
       private File m_testFile;
   
  @@ -133,7 +133,7 @@
       }
   
       /** Assert that the contents of two byte arrays are the same. */
  -    private void assertEqualContent( final byte[] b0, final byte[] b1 )
  +    private void assertEqualContent( byte[] b0, byte[] b1 )
           throws IOException
       {
           assertTrue( "Content not equal according to java.util.Arrays#equals()", Arrays.equals( b0, b1 ) );
  @@ -142,10 +142,10 @@
       public void testInputStreamToOutputStream()
           throws Exception
       {
  -        final File destination = newFile( "copy1.txt" );
  -        final FileInputStream fin = new FileInputStream( m_testFile );
  +        File destination = newFile( "copy1.txt" );
  +        FileInputStream fin = new FileInputStream( m_testFile );
           try {
  -            final FileOutputStream fout = new FileOutputStream( destination );
  +            FileOutputStream fout = new FileOutputStream( destination );
               try {
                   int count = IOUtils.copy( fin, fout );
                   assertTrue( "Not all bytes were read", fin.available() == 0 );
  @@ -166,10 +166,10 @@
       public void testInputStreamToWriter()
           throws Exception
       {
  -        final File destination = newFile( "copy2.txt" );
  -        final FileInputStream fin = new FileInputStream( m_testFile );
  +        File destination = newFile( "copy2.txt" );
  +        FileInputStream fin = new FileInputStream( m_testFile );
           try {
  -            final FileWriter fout = new FileWriter( destination );
  +            FileWriter fout = new FileWriter( destination );
               try {
                   IOUtils.copy( fin, fout );
   
  @@ -190,9 +190,9 @@
       public void testInputStreamToString()
           throws Exception
       {
  -        final FileInputStream fin = new FileInputStream( m_testFile );
  +        FileInputStream fin = new FileInputStream( m_testFile );
           try {
  -            final String out = IOUtils.toString( fin );
  +            String out = IOUtils.toString( fin );
               assertNotNull( out );
               assertTrue( "Not all bytes were read", fin.available() == 0 );
               assertTrue( "Wrong output size: out.length()=" + out.length() +
  @@ -205,14 +205,14 @@
       public void testReaderToOutputStream()
           throws Exception
       {
  -        final File destination = newFile( "copy3.txt" );
  -        final FileReader fin = new FileReader( m_testFile );
  +        File destination = newFile( "copy3.txt" );
  +        FileReader fin = new FileReader( m_testFile );
           try {
  -            final FileOutputStream fout = new FileOutputStream( destination );
  +            FileOutputStream fout = new FileOutputStream( destination );
               try {
                   IOUtils.copy( fin, fout );
                   //Note: this method *does* flush. It is equivalent to:
  -                //  final OutputStreamWriter _out = new OutputStreamWriter(fout);
  +                //  OutputStreamWriter _out = new OutputStreamWriter(fout);
                   //  IOUtils.copy( fin, _out, 4096 ); // copy( Reader, Writer, int );
                   //  _out.flush();
                   //  out = fout;
  @@ -232,10 +232,10 @@
       public void testReaderToWriter()
           throws Exception
       {
  -        final File destination = newFile( "copy4.txt" );
  -        final FileReader fin = new FileReader( m_testFile );
  +        File destination = newFile( "copy4.txt" );
  +        FileReader fin = new FileReader( m_testFile );
           try {
  -            final FileWriter fout = new FileWriter( destination );
  +            FileWriter fout = new FileWriter( destination );
               try {
                   int count = IOUtils.copy( fin, fout );
                   assertEquals( "The number of characters returned by copy is wrong", m_testFile.length(), count);
  @@ -255,9 +255,9 @@
       public void testReaderToString()
           throws Exception
       {
  -        final FileReader fin = new FileReader( m_testFile );
  +        FileReader fin = new FileReader( m_testFile );
           try {
  -            final String out = IOUtils.toString( fin );
  +            String out = IOUtils.toString( fin );
               assertNotNull( out );
               assertTrue( "Wrong output size: out.length()=" +
                           out.length() + "!=" + FILE_SIZE,
  @@ -270,9 +270,9 @@
       public void testStringToOutputStream()
           throws Exception
       {
  -        final File destination = newFile( "copy5.txt" );
  -        final FileReader fin = new FileReader( m_testFile );
  -        final String str;
  +        File destination = newFile( "copy5.txt" );
  +        FileReader fin = new FileReader( m_testFile );
  +        String str;
           try {
               // Create our String. Rely on testReaderToString() to make sure this is valid.
               str = IOUtils.toString( fin );
  @@ -280,11 +280,11 @@
               fin.close();
           }
           
  -        final FileOutputStream fout = new FileOutputStream( destination );
  +        FileOutputStream fout = new FileOutputStream( destination );
           try {
               IOUtils.copy( str, fout );
               //Note: this method *does* flush. It is equivalent to:
  -            //  final OutputStreamWriter _out = new OutputStreamWriter(fout);
  +            //  OutputStreamWriter _out = new OutputStreamWriter(fout);
               //  IOUtils.copy( str, _out, 4096 ); // copy( Reader, Writer, int );
               //  _out.flush();
               //  out = fout;
  @@ -301,9 +301,9 @@
       public void testStringToWriter()
           throws Exception
       {
  -        final File destination = newFile( "copy6.txt" );
  +        File destination = newFile( "copy6.txt" );
           FileReader fin = new FileReader( m_testFile );
  -        final String str;
  +        String str;
           try {
               // Create our String. Rely on testReaderToString() to make sure this is valid.
               str = IOUtils.toString( fin );
  @@ -311,7 +311,7 @@
               fin.close();
           }
           
  -        final FileWriter fout = new FileWriter( destination );
  +        FileWriter fout = new FileWriter( destination );
           try {
               IOUtils.copy( str, fout );
               fout.flush();
  @@ -327,9 +327,9 @@
       public void testInputStreamToByteArray()
           throws Exception
       {
  -        final FileInputStream fin = new FileInputStream( m_testFile );
  +        FileInputStream fin = new FileInputStream( m_testFile );
           try {
  -            final byte[] out = IOUtils.toByteArray( fin );
  +            byte[] out = IOUtils.toByteArray( fin );
               assertNotNull( out );
               assertTrue( "Not all bytes were read", fin.available() == 0 );
               assertTrue( "Wrong output size: out.length=" + out.length +
  @@ -343,12 +343,12 @@
       public void testStringToByteArray()
           throws Exception
       {
  -        final FileReader fin = new FileReader( m_testFile );
  +        FileReader fin = new FileReader( m_testFile );
           try {
               // Create our String. Rely on testReaderToString() to make sure this is valid.
  -            final String str = IOUtils.toString( fin );
  +            String str = IOUtils.toString( fin );
   
  -            final byte[] out = IOUtils.toByteArray( str );
  +            byte[] out = IOUtils.toByteArray( str );
               assertEqualContent( str.getBytes(), out );
           } finally {
               fin.close();
  @@ -358,9 +358,9 @@
       public void testByteArrayToWriter()
           throws Exception
       {
  -        final File destination = newFile( "copy7.txt" );
  -        final FileInputStream fin = new FileInputStream( m_testFile );
  -        final byte[] in;
  +        File destination = newFile( "copy7.txt" );
  +        FileInputStream fin = new FileInputStream( m_testFile );
  +        byte[] in;
           try {
               // Create our byte[]. Rely on testInputStreamToByteArray() to make sure this is valid.
               in = IOUtils.toByteArray( fin );
  @@ -368,7 +368,7 @@
               fin.close();
           }
   
  -        final FileWriter fout = new FileWriter( destination );
  +        FileWriter fout = new FileWriter( destination );
           try {
               IOUtils.copy( in, fout );
               fout.flush();
  @@ -383,9 +383,9 @@
       public void testByteArrayToString()
           throws Exception
       {
  -        final FileInputStream fin = new FileInputStream( m_testFile );
  +        FileInputStream fin = new FileInputStream( m_testFile );
           try {
  -            final byte[] in = IOUtils.toByteArray( fin );
  +            byte[] in = IOUtils.toByteArray( fin );
               // Create our byte[]. Rely on testInputStreamToByteArray() to make sure this is valid.
               String str = IOUtils.toString( in );
               assertEqualContent( in, str.getBytes() );
  @@ -397,9 +397,9 @@
       public void testByteArrayToOutputStream()
           throws Exception
       {
  -        final File destination = newFile( "copy8.txt" );
  -        final FileInputStream fin = new FileInputStream( m_testFile );
  -        final byte[] in;
  +        File destination = newFile( "copy8.txt" );
  +        FileInputStream fin = new FileInputStream( m_testFile );
  +        byte[] in;
           try {
               // Create our byte[]. Rely on testInputStreamToByteArray() to make sure this is valid.
               in = IOUtils.toByteArray( fin );
  @@ -407,7 +407,7 @@
               fin.close();
           }
   
  -        final FileOutputStream fout = new FileOutputStream( destination );
  +        FileOutputStream fout = new FileOutputStream( destination );
           try {
               IOUtils.copy( in, fout );
   
  
  
  
  1.13      +1 -1      jakarta-commons-sandbox/io/src/test/org/apache/commons/io/filefilter/FileFilterTestCase.java
  
  Index: FileFilterTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/io/src/test/org/apache/commons/io/filefilter/FileFilterTestCase.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- FileFilterTestCase.java	23 Nov 2003 08:35:14 -0000	1.12
  +++ FileFilterTestCase.java	30 Dec 2003 07:00:04 -0000	1.13
  @@ -62,7 +62,7 @@
   /**
    * Used to test an unknown FileFilter
    */
  -public final class FileFilterTestCase extends TestCase {
  +public class FileFilterTestCase extends TestCase {
   
       public FileFilterTestCase(String name) {
           super(name);
  
  
  
  1.2       +4 -4      jakarta-commons-sandbox/io/src/test/org/apache/commons/io/input/CountingInputStreamTest.java
  
  Index: CountingInputStreamTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/io/src/test/org/apache/commons/io/input/CountingInputStreamTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CountingInputStreamTest.java	23 Nov 2003 09:20:54 -0000	1.1
  +++ CountingInputStreamTest.java	30 Dec 2003 07:00:04 -0000	1.2
  @@ -72,7 +72,7 @@
    *
    * @author <a href="mailto:bayard@apache.org">Henri Yandell</a>
    */
  -public final class CountingInputStreamTest extends TestCase {
  +public class CountingInputStreamTest extends TestCase {
   
       public CountingInputStreamTest(String name) {
           super(name);
  
  
  
  1.4       +6 -6      jakarta-commons-sandbox/io/src/test/org/apache/commons/io/output/ByteArrayOutputStreamTestCase.java
  
  Index: ByteArrayOutputStreamTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/io/src/test/org/apache/commons/io/output/ByteArrayOutputStreamTestCase.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ByteArrayOutputStreamTestCase.java	13 Oct 2003 07:05:50 -0000	1.3
  +++ ByteArrayOutputStreamTestCase.java	30 Dec 2003 07:00:04 -0000	1.4
  @@ -70,9 +70,9 @@
    *
    * @author <a href="mailto:jeremias@apache.org">Jeremias Maerki</a>
    */
  -public final class ByteArrayOutputStreamTestCase extends TestCase {
  +public class ByteArrayOutputStreamTestCase extends TestCase {
   
  -    private static final byte[] DATA;
  +    private static byte[] DATA;
       
       static {
           DATA = new byte[64];
  @@ -112,7 +112,7 @@
           return written;
       }
   
  -    private static final boolean byteCmp(byte[] src, byte[] cmp) {
  +    private static boolean byteCmp(byte[] src, byte[] cmp) {
           for (int i = 0; i < cmp.length; i++) {
               if (src[i] != cmp[i]) {
                   return false;
  
  
  
  1.5       +21 -21    jakarta-commons-sandbox/io/src/test/org/apache/commons/io/testtools/FileBasedTestCase.java
  
  Index: FileBasedTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/io/src/test/org/apache/commons/io/testtools/FileBasedTestCase.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- FileBasedTestCase.java	29 Dec 2003 03:28:53 -0000	1.4
  +++ FileBasedTestCase.java	30 Dec 2003 07:00:04 -0000	1.5
  @@ -93,13 +93,13 @@
           return testDir;
       }
       
  -    protected void createFile(final File file, final long size)
  +    protected void createFile(File file, long size)
               throws IOException {
           if (!file.getParentFile().exists()) {
               throw new IOException("Cannot create file " + file 
                   + " as the parent directory does not exist");
           }
  -        final BufferedOutputStream output =
  +        BufferedOutputStream output =
               new BufferedOutputStream(new java.io.FileOutputStream(file));
           try {
               generateTestData(output, size);
  @@ -108,7 +108,7 @@
           }
       }
       
  -    protected byte[] generateTestData(final long size) {
  +    protected byte[] generateTestData(long size) {
           try {
               ByteArrayOutputStream baout = new ByteArrayOutputStream();
               generateTestData(baout, size);
  @@ -118,7 +118,7 @@
           }
       }
       
  -    protected void generateTestData(final OutputStream out, final long size) 
  +    protected void generateTestData(OutputStream out, long size) 
                   throws IOException {
           for (int i = 0; i < size; i++) {
               //output.write((byte)'X');
  @@ -129,7 +129,7 @@
       }
   
       protected File newFile(String filename) throws IOException {
  -        final File destination = new File( getTestDirectory(), filename );
  +        File destination = new File( getTestDirectory(), filename );
           /*
           assertTrue( filename + "Test output data file shouldn't previously exist",
                       !destination.exists() );
  @@ -140,14 +140,14 @@
           return destination;
       }
   
  -    protected void checkFile( final File file, final File referenceFile )
  +    protected void checkFile( File file, File referenceFile )
                   throws Exception {
           assertTrue( "Check existence of output file", file.exists() );
           assertEqualContent( referenceFile, file );
       }
   
       /** Assert that the content of two files is the same. */
  -    private void assertEqualContent( final File f0, final File f1 )
  +    private void assertEqualContent( File f0, File f1 )
           throws IOException
       {
           /* This doesn't work because the filesize isn't updated until the file
  @@ -156,12 +156,12 @@
                       " have differing file sizes (" + f0.length() +
                       " vs " + f1.length() + ")", ( f0.length() == f1.length() ) );
           */
  -        final InputStream is0 = new java.io.FileInputStream( f0 );
  +        InputStream is0 = new java.io.FileInputStream( f0 );
           try {
  -            final InputStream is1 = new java.io.FileInputStream( f1 );
  +            InputStream is1 = new java.io.FileInputStream( f1 );
               try {
  -                final byte[] buf0 = new byte[ 1024 ];
  -                final byte[] buf1 = new byte[ 1024 ];
  +                byte[] buf0 = new byte[ 1024 ];
  +                byte[] buf1 = new byte[ 1024 ];
                   int n0 = 0;
                   int n1 = 0;
   
  @@ -185,10 +185,10 @@
       }
   
       /** Assert that the content of a file is equal to that in a byte[]. */
  -    protected void assertEqualContent( final byte[] b0, final File file )
  +    protected void assertEqualContent( byte[] b0, File file )
           throws IOException
       {
  -        final InputStream is = new java.io.FileInputStream( file );
  +        InputStream is = new java.io.FileInputStream( file );
           try {
               byte[] b1 = new byte[ b0.length ];
               int numRead = is.read( b1 );
  @@ -203,10 +203,10 @@
           }
       }
   
  -    protected void checkWrite(final OutputStream output) throws Exception {
  +    protected void checkWrite(OutputStream output) throws Exception {
           try {
               new java.io.PrintStream(output).write(0);
  -        } catch (final Throwable t) {
  +        } catch (Throwable t) {
               throw new AssertionFailedError(
                   "The copy() method closed the stream "
                       + "when it shouldn't have. "
  @@ -214,10 +214,10 @@
           }
       }
   
  -    protected void checkWrite(final Writer output) throws Exception {
  +    protected void checkWrite(Writer output) throws Exception {
           try {
               new java.io.PrintWriter(output).write('a');
  -        } catch (final Throwable t) {
  +        } catch (Throwable t) {
               throw new AssertionFailedError(
                   "The copy() method closed the stream "
                       + "when it shouldn't have. "
  @@ -225,7 +225,7 @@
           }
       }
   
  -    protected void deleteFile( final File file )
  +    protected void deleteFile( File file )
           throws Exception {
           if (file.exists()) {
               assertTrue("Couldn't delete file: " + file, file.delete());
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message