You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by je...@apache.org on 2003/07/03 16:43:27 UTC
cvs commit: jakarta-commons-sandbox/io/src/test/org/apache/commons/io IOUtilTestCase.java
jeremias 2003/07/03 07:43:27
Modified: io/src/test/org/apache/commons/io IOUtilTestCase.java
Log:
Test number of bytes returned by copy() methods.
Revision Changes Path
1.4 +7 -5 jakarta-commons-sandbox/io/src/test/org/apache/commons/io/IOUtilTestCase.java
Index: IOUtilTestCase.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/io/src/test/org/apache/commons/io/IOUtilTestCase.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- IOUtilTestCase.java 26 Oct 2002 06:24:15 -0000 1.3
+++ IOUtilTestCase.java 3 Jul 2003 14:43:27 -0000 1.4
@@ -211,8 +211,9 @@
final FileInputStream fin = new FileInputStream( m_testFile );
final FileOutputStream fout = new FileOutputStream( destination );
- IOUtil.copy( fin, fout );
+ int count = IOUtil.copy( fin, fout );
assertTrue( "Not all bytes were read", fin.available() == 0 );
+ assertEquals( "Number of bytes read should equal file size", m_testFile.length(), count );
fout.flush();
checkFile( destination );
@@ -280,7 +281,8 @@
final File destination = newFile( "copy4.txt" );
final FileReader fin = new FileReader( m_testFile );
final FileWriter fout = new FileWriter( destination );
- IOUtil.copy( fin, fout );
+ int count = IOUtil.copy( fin, fout );
+ assertEquals( "The number of characters returned by copy is wrong", m_testFile.length(), count);
fout.flush();
checkFile( destination );
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org