commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1022317 - /commons/proper/io/trunk/src/test/java/org/apache/commons/io/LineIteratorTestCase.java
Date Wed, 13 Oct 2010 22:48:04 GMT
Author: ggregory
Date: Wed Oct 13 22:48:04 2010
New Revision: 1022317

URL: http://svn.apache.org/viewvc?rev=1022317&view=rev
Log:
Improve code coverage.

Modified:
    commons/proper/io/trunk/src/test/java/org/apache/commons/io/LineIteratorTestCase.java

Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/LineIteratorTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/LineIteratorTestCase.java?rev=1022317&r1=1022316&r2=1022317&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/LineIteratorTestCase.java
(original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/LineIteratorTestCase.java
Wed Oct 13 22:48:04 2010
@@ -16,10 +16,12 @@
  */
 package org.apache.commons.io;
 
+import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.FileReader;
 import java.io.Reader;
+import java.io.StringReader;
 import java.io.UnsupportedEncodingException;
 import java.util.ArrayList;
 import java.util.List;
@@ -311,14 +313,29 @@ public class LineIteratorTestCase extend
     }
 
     //-----------------------------------------------------------------------
-    public void testFiltering() throws Exception {
+    public void testFilteringFileReader() throws Exception {
         String encoding = "UTF-8";
-        
+
         String fileName = "LineIterator-Filter-test.txt";
         File testFile = new File(getTestDirectory(), fileName);
         List<String> lines = createFile(testFile, encoding, 9);
-        
+
         Reader reader = new FileReader(testFile);
+        this.testFiltering(lines, reader);
+    }
+
+    public void testFilteringBufferedReader() throws Exception {
+        String encoding = "UTF-8";
+
+        String fileName = "LineIterator-Filter-test.txt";
+        File testFile = new File(getTestDirectory(), fileName);
+        List<String> lines = createFile(testFile, encoding, 9);
+
+        Reader reader = new BufferedReader(new FileReader(testFile));
+        this.testFiltering(lines, reader);
+    }
+
+    private void testFiltering(List<String> lines, Reader reader) {
         LineIterator iterator = new LineIterator(reader) {
             @Override
             protected boolean isValidLine(String line) {



Mime
View raw message