Skip to content

Commit 0b9195f

Browse files
committed
removed finals from test code
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/io/trunk@140459 13f79535-47bb-0310-9956-ffa450edef68
1 parent 025fb9c commit 0b9195f

13 files changed

Lines changed: 214 additions & 214 deletions

src/test/org/apache/commons/io/CopyUtilsTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
* @author Jeff Turner
7676
* @author Matthew Hawthorne
7777
* @author <a href="mailto:jeremias@apache.org">Jeremias Maerki</a>
78-
* @version $Id: CopyUtilsTest.java,v 1.3 2003/11/22 20:18:55 jeremias Exp $
78+
* @version $Id: CopyUtilsTest.java,v 1.4 2003/12/30 07:00:03 bayard Exp $
7979
* @see CopyUtils
8080
*/
8181
public class CopyUtilsTest extends FileBasedTestCase {
@@ -87,7 +87,7 @@ public class CopyUtilsTest extends FileBasedTestCase {
8787
* relevant methods are called. (JT)
8888
*/
8989

90-
private final int FILE_SIZE = 1024 * 4 + 1;
90+
private int FILE_SIZE = 1024 * 4 + 1;
9191

9292

9393
private byte[] inData = generateTestData(FILE_SIZE);
@@ -180,7 +180,7 @@ public void testCopy_readerToOutputStream() throws Exception {
180180

181181
CopyUtils.copy(reader, out);
182182
//Note: this method *does* flush. It is equivalent to:
183-
// final OutputStreamWriter _out = new OutputStreamWriter(fout);
183+
// OutputStreamWriter _out = new OutputStreamWriter(fout);
184184
// IOUtils.copy( fin, _out, 4096 ); // copy( Reader, Writer, int );
185185
// _out.flush();
186186
// out = fout;
@@ -210,14 +210,14 @@ public void testCopy_readerToWriter() throws Exception {
210210
}
211211

212212
public void testCopy_stringToOutputStream() throws Exception {
213-
final String str = new String(inData, "US-ASCII");
213+
String str = new String(inData, "US-ASCII");
214214

215215
ByteArrayOutputStream baout = new ByteArrayOutputStream();
216216
OutputStream out = new YellOnFlushAndCloseOutputStream(baout, false, true);
217217

218218
CopyUtils.copy(str, out);
219219
//Note: this method *does* flush. It is equivalent to:
220-
// final OutputStreamWriter _out = new OutputStreamWriter(fout);
220+
// OutputStreamWriter _out = new OutputStreamWriter(fout);
221221
// IOUtils.copy( str, _out, 4096 ); // copy( Reader, Writer, int );
222222
// _out.flush();
223223
// out = fout;
@@ -228,7 +228,7 @@ public void testCopy_stringToOutputStream() throws Exception {
228228
}
229229

230230
public void testCopy_stringToWriter() throws Exception {
231-
final String str = new String(inData, "US-ASCII");
231+
String str = new String(inData, "US-ASCII");
232232

233233
ByteArrayOutputStream baout = new ByteArrayOutputStream();
234234
OutputStream out = new YellOnFlushAndCloseOutputStream(baout, false, true);

src/test/org/apache/commons/io/DemuxTestCase.java

Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
2-
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//io/src/test/org/apache/commons/io/DemuxTestCase.java,v 1.7 2003/11/22 20:18:54 jeremias Exp $
3-
* $Revision: 1.7 $
4-
* $Date: 2003/11/22 20:18:54 $
2+
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//io/src/test/org/apache/commons/io/DemuxTestCase.java,v 1.8 2003/12/30 07:00:03 bayard Exp $
3+
* $Revision: 1.8 $
4+
* $Date: 2003/12/30 07:00:03 $
55
*
66
* ====================================================================
77
*
@@ -79,42 +79,42 @@
7979
*
8080
* @author <a href="mailto:peter@apache.org">Peter Donald</a>
8181
*/
82-
public final class DemuxTestCase
82+
public class DemuxTestCase
8383
extends TestCase
8484
{
85-
private static final String T1 = "Thread1";
86-
private static final String T2 = "Thread2";
87-
private static final String T3 = "Thread3";
88-
private static final String T4 = "Thread4";
85+
private static String T1 = "Thread1";
86+
private static String T2 = "Thread2";
87+
private static String T3 = "Thread3";
88+
private static String T4 = "Thread4";
8989

90-
private static final String DATA1 = "Data for thread1";
91-
private static final String DATA2 = "Data for thread2";
92-
private static final String DATA3 = "Data for thread3";
93-
private static final String DATA4 = "Data for thread4";
90+
private static String DATA1 = "Data for thread1";
91+
private static String DATA2 = "Data for thread2";
92+
private static String DATA3 = "Data for thread3";
93+
private static String DATA4 = "Data for thread4";
9494

95-
private static final Random c_random = new Random();
96-
private final HashMap m_outputMap = new HashMap();
97-
private final HashMap m_threadMap = new HashMap();
95+
private static Random c_random = new Random();
96+
private HashMap m_outputMap = new HashMap();
97+
private HashMap m_threadMap = new HashMap();
9898

99-
public DemuxTestCase( final String name )
99+
public DemuxTestCase( String name )
100100
{
101101
super( name );
102102
}
103103

104-
private String getOutput( final String threadName )
104+
private String getOutput( String threadName )
105105
throws IOException
106106
{
107-
final ByteArrayOutputStream output =
107+
ByteArrayOutputStream output =
108108
(ByteArrayOutputStream)m_outputMap.get( threadName );
109109
assertNotNull( "getOutput()", output );
110110

111111
return output.toString();
112112
}
113113

114-
private String getInput( final String threadName )
114+
private String getInput( String threadName )
115115
throws IOException
116116
{
117-
final ReaderThread thread = (ReaderThread)m_threadMap.get( threadName );
117+
ReaderThread thread = (ReaderThread)m_threadMap.get( threadName );
118118
assertNotNull( "getInput()", thread );
119119

120120
return thread.getData();
@@ -123,53 +123,53 @@ private String getInput( final String threadName )
123123
private void doStart()
124124
throws Exception
125125
{
126-
final Iterator iterator = m_threadMap.keySet().iterator();
126+
Iterator iterator = m_threadMap.keySet().iterator();
127127
while( iterator.hasNext() )
128128
{
129-
final String name = (String)iterator.next();
130-
final Thread thread = (Thread)m_threadMap.get( name );
129+
String name = (String)iterator.next();
130+
Thread thread = (Thread)m_threadMap.get( name );
131131
thread.start();
132132
}
133133
}
134134

135135
private void doJoin()
136136
throws Exception
137137
{
138-
final Iterator iterator = m_threadMap.keySet().iterator();
138+
Iterator iterator = m_threadMap.keySet().iterator();
139139
while( iterator.hasNext() )
140140
{
141-
final String name = (String)iterator.next();
142-
final Thread thread = (Thread)m_threadMap.get( name );
141+
String name = (String)iterator.next();
142+
Thread thread = (Thread)m_threadMap.get( name );
143143
thread.join();
144144
}
145145
}
146146

147-
private void startWriter( final String name,
148-
final String data,
149-
final DemuxOutputStream demux )
147+
private void startWriter( String name,
148+
String data,
149+
DemuxOutputStream demux )
150150
throws Exception
151151
{
152-
final ByteArrayOutputStream output = new ByteArrayOutputStream();
152+
ByteArrayOutputStream output = new ByteArrayOutputStream();
153153
m_outputMap.put( name, output );
154-
final WriterThread thread =
154+
WriterThread thread =
155155
new WriterThread( name, data, output, demux );
156156
m_threadMap.put( name, thread );
157157
}
158158

159-
private void startReader( final String name,
160-
final String data,
161-
final DemuxInputStream demux )
159+
private void startReader( String name,
160+
String data,
161+
DemuxInputStream demux )
162162
throws Exception
163163
{
164-
final ByteArrayInputStream input = new ByteArrayInputStream( data.getBytes() );
165-
final ReaderThread thread = new ReaderThread( name, input, demux );
164+
ByteArrayInputStream input = new ByteArrayInputStream( data.getBytes() );
165+
ReaderThread thread = new ReaderThread( name, input, demux );
166166
m_threadMap.put( name, thread );
167167
}
168168

169169
public void testOutputStream()
170170
throws Exception
171171
{
172-
final DemuxOutputStream output = new DemuxOutputStream();
172+
DemuxOutputStream output = new DemuxOutputStream();
173173
startWriter( T1, DATA1, output );
174174
startWriter( T2, DATA2, output );
175175
startWriter( T3, DATA3, output );
@@ -187,7 +187,7 @@ public void testOutputStream()
187187
public void testInputStream()
188188
throws Exception
189189
{
190-
final DemuxInputStream input = new DemuxInputStream();
190+
DemuxInputStream input = new DemuxInputStream();
191191
startReader( T1, DATA1, input );
192192
startReader( T2, DATA2, input );
193193
startReader( T3, DATA3, input );
@@ -205,13 +205,13 @@ public void testInputStream()
205205
private static class ReaderThread
206206
extends Thread
207207
{
208-
private final StringBuffer m_buffer = new StringBuffer();
209-
private final InputStream m_input;
210-
private final DemuxInputStream m_demux;
208+
private StringBuffer m_buffer = new StringBuffer();
209+
private InputStream m_input;
210+
private DemuxInputStream m_demux;
211211

212-
ReaderThread( final String name,
213-
final InputStream input,
214-
final DemuxInputStream demux )
212+
ReaderThread( String name,
213+
InputStream input,
214+
DemuxInputStream demux )
215215
{
216216
super( name );
217217
m_input = input;
@@ -235,12 +235,12 @@ public void run()
235235
//System.out.println( "Reading: " + (char)ch );
236236
m_buffer.append( (char)ch );
237237

238-
final int sleepTime = Math.abs( c_random.nextInt() % 10 );
238+
int sleepTime = Math.abs( c_random.nextInt() % 10 );
239239
Thread.sleep( sleepTime );
240240
ch = m_demux.read();
241241
}
242242
}
243-
catch( final Exception e )
243+
catch( Exception e )
244244
{
245245
e.printStackTrace();
246246
}
@@ -250,14 +250,14 @@ public void run()
250250
private static class WriterThread
251251
extends Thread
252252
{
253-
private final byte[] m_data;
254-
private final OutputStream m_output;
255-
private final DemuxOutputStream m_demux;
253+
private byte[] m_data;
254+
private OutputStream m_output;
255+
private DemuxOutputStream m_demux;
256256

257-
WriterThread( final String name,
258-
final String data,
259-
final OutputStream output,
260-
final DemuxOutputStream demux )
257+
WriterThread( String name,
258+
String data,
259+
OutputStream output,
260+
DemuxOutputStream demux )
261261
{
262262
super( name );
263263
m_output = output;
@@ -274,10 +274,10 @@ public void run()
274274
{
275275
//System.out.println( "Writing: " + (char)m_data[ i ] );
276276
m_demux.write( m_data[ i ] );
277-
final int sleepTime = Math.abs( c_random.nextInt() % 10 );
277+
int sleepTime = Math.abs( c_random.nextInt() % 10 );
278278
Thread.sleep( sleepTime );
279279
}
280-
catch( final Exception e )
280+
catch( Exception e )
281281
{
282282
e.printStackTrace();
283283
}

src/test/org/apache/commons/io/FileUtilsFileNewerTestCase.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
2-
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//io/src/test/org/apache/commons/io/FileUtilsFileNewerTestCase.java,v 1.2 2003/10/13 07:06:04 rdonkin Exp $
3-
* $Revision: 1.2 $
4-
* $Date: 2003/10/13 07:06:04 $
2+
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//io/src/test/org/apache/commons/io/FileUtilsFileNewerTestCase.java,v 1.3 2003/12/30 07:00:03 bayard Exp $
3+
* $Revision: 1.3 $
4+
* $Date: 2003/12/30 07:00:03 $
55
*
66
* ====================================================================
77
*
@@ -70,16 +70,16 @@
7070
*
7171
* @author <a href="mailto:alban.peignier@free.fr">Alban Peignier</a>
7272
*/
73-
public final class FileUtilsFileNewerTestCase extends FileBasedTestCase {
73+
public class FileUtilsFileNewerTestCase extends FileBasedTestCase {
7474

7575
// Test data
76-
private static final int FILE1_SIZE = 1;
77-
private static final int FILE2_SIZE = 1024 * 4 + 1;
76+
private static int FILE1_SIZE = 1;
77+
private static int FILE2_SIZE = 1024 * 4 + 1;
7878

79-
private final File m_testFile1;
80-
private final File m_testFile2;
79+
private File m_testFile1;
80+
private File m_testFile2;
8181

82-
public FileUtilsFileNewerTestCase(final String name) {
82+
public FileUtilsFileNewerTestCase(String name) {
8383
super(name);
8484

8585
m_testFile1 = new File(getTestDirectory(), "file1-test.txt");
@@ -111,7 +111,7 @@ public void testIsFileNewer() {
111111
throw new IllegalStateException("The m_testFile1 should exist");
112112

113113
long fileLastModified = m_testFile1.lastModified();
114-
final long ONE_SECOND = 1000;
114+
long ONE_SECOND = 1000;
115115

116116
testIsFileNewer("one second earlier is not newer" , m_testFile1, fileLastModified + ONE_SECOND, false);
117117
testIsFileNewer("same time is not newer" , m_testFile1, fileLastModified, false);
@@ -159,7 +159,7 @@ protected void testIsFileNewer(String description, File file, long time, boolean
159159
assertEquals(description + " - time", wantedResult, FileUtils.isFileNewer(file, time));
160160
assertEquals(description + " - date", wantedResult, FileUtils.isFileNewer(file, new Date(time)));
161161

162-
final File temporaryFile = m_testFile2;
162+
File temporaryFile = m_testFile2;
163163

164164
temporaryFile.setLastModified(time);
165165
if (temporaryFile.lastModified() != time)

src/test/org/apache/commons/io/FileUtilsListFilesTestCase.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ private Collection filesToFilenames(Collection files) {
7676
}
7777

7878
public void testListFilesByExtension() throws Exception {
79-
final String[] extensions = {"xml", "txt"};
79+
String[] extensions = {"xml", "txt"};
8080

8181
Collection files = FileUtils.listFiles(getLocalTestDirectory(), extensions, false);
8282
assertEquals(1, files.size());

0 commit comments

Comments
 (0)