You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by sc...@apache.org on 2006/10/11 18:44:07 UTC

svn commit: r462847 - in /jakarta/commons/proper/io/trunk/src: java/org/apache/commons/io/input/ test/org/apache/commons/io/input/

Author: scolebourne
Date: Wed Oct 11 09:44:06 2006
New Revision: 462847

URL: http://svn.apache.org/viewvc?view=rev&rev=462847
Log:
IO-94 - MockInputStream/MockReader

Modified:
    jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/input/MockInputStream.java
    jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/input/MockReader.java
    jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/input/MockInputStreamTestCase.java
    jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/input/MockReaderTestCase.java
    jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/input/PackageTestSuite.java

Modified: jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/input/MockInputStream.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/input/MockInputStream.java?view=diff&rev=462847&r1=462846&r2=462847
==============================================================================
--- jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/input/MockInputStream.java (original)
+++ jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/input/MockInputStream.java Wed Oct 11 09:44:06 2006
@@ -38,7 +38,6 @@
  * <code>processBytes()</code> methods can be implemented to generate
  * test data.
  *
- *
  * @since Commons IO 1.3
  * @version $Revision$
  */
@@ -53,7 +52,8 @@
     private boolean markSupported;
 
     /**
-     * Create a mock {@link InputStream} of the specified size.
+     * Create a mock {@link InputStream} of the specified size
+     * which supports marking and does not throw EOFException.
      *
      * @param size The size of the mock input stream.
      */
@@ -113,7 +113,7 @@
     }
 
     /**
-     * Close this inputstream - resets the internal state to
+     * Close this input stream - resets the internal state to
      * the initial values.
      *
      * @throws IOException If an error occurs.
@@ -268,12 +268,12 @@
     /**
      * Return a byte value for the  <code>read()</code> method.
      * <p>
-     * <strong>N.B.</strong> This implementation returns
-     * zero.
+     * This implementation returns zero.
      *
      * @return This implementation always returns zero.
      */
     protected int processByte() {
+        // do nothing - overridable by subclass
         return 0;
     }
 
@@ -281,14 +281,14 @@
      * Process the bytes for the <code>read(byte[], offset, length)</code>
      * method.
      * <p>
-     * <strong>N.B.</strong> This implementation leaves the byte
-     * array unchanged.
+     * This implementation leaves the byte array unchanged.
      *
      * @param bytes The byte array
      * @param offset The offset to start at.
      * @param length The number of bytes.
      */
     protected void processBytes(byte[] bytes, int offset, int length) {
+        // do nothing - overridable by subclass
     }
 
     /**
@@ -306,4 +306,5 @@
         }
         return -1;
     }
+
 }

Modified: jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/input/MockReader.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/input/MockReader.java?view=diff&rev=462847&r1=462846&r2=462847
==============================================================================
--- jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/input/MockReader.java (original)
+++ jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/input/MockReader.java Wed Oct 11 09:44:06 2006
@@ -38,7 +38,6 @@
  * <code>processChars()</code> methods can be implemented to generate
  * test data.
  *
- *
  * @since Commons IO 1.3
  * @version $Revision$
  */
@@ -53,7 +52,8 @@
     private boolean markSupported;
 
     /**
-     * Create a mock {@link Reader} of the specified size.
+     * Create a mock {@link Reader} of the specified size
+     * which supports marking and does not throw EOFException.
      *
      * @param size The size of the mock Reader.
      */
@@ -252,12 +252,12 @@
     /**
      * Return a character value for the  <code>read()</code> method.
      * <p>
-     * <strong>N.B.</strong> This implementation returns
-     * zero.
+     * This implementation returns zero.
      *
      * @return This implementation always returns zero.
      */
     protected int processChar() {
+        // do nothing - overridable by subclass
         return 0;
     }
 
@@ -265,14 +265,14 @@
      * Process the characters for the <code>read(char[], offset, length)</code>
      * method.
      * <p>
-     * <strong>N.B.</strong> This implementation leaves the character
-     * array unchanged.
+     * This implementation leaves the character array unchanged.
      *
      * @param chars The character array
      * @param offset The offset to start at.
      * @param length The number of characters.
      */
     protected void processChars(char[] chars, int offset, int length) {
+        // do nothing - overridable by subclass
     }
 
     /**
@@ -290,4 +290,5 @@
         }
         return -1;
     }
+
 }

Modified: jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/input/MockInputStreamTestCase.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/input/MockInputStreamTestCase.java?view=diff&rev=462847&r1=462846&r2=462847
==============================================================================
--- jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/input/MockInputStreamTestCase.java (original)
+++ jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/input/MockInputStreamTestCase.java Wed Oct 11 09:44:06 2006
@@ -214,7 +214,6 @@
      * Test <code>skip()</code> method.
      */
    public void testSkip() throws Exception {
-        int skip = 20;
         InputStream input = new TestMockInputStream(10, true, false);
         assertEquals("Read 1", 0, input.read());
         assertEquals("Read 2", 1, input.read());

Modified: jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/input/MockReaderTestCase.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/input/MockReaderTestCase.java?view=diff&rev=462847&r1=462846&r2=462847
==============================================================================
--- jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/input/MockReaderTestCase.java (original)
+++ jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/input/MockReaderTestCase.java Wed Oct 11 09:44:06 2006
@@ -211,7 +211,6 @@
      * Test <code>skip()</code> method.
      */
    public void testSkip() throws Exception {
-        int skip = 20;
         Reader reader = new TestMockReader(10, true, false);
         assertEquals("Read 1", 0, reader.read());
         assertEquals("Read 2", 1, reader.read());

Modified: jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/input/PackageTestSuite.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/input/PackageTestSuite.java?view=diff&rev=462847&r1=462846&r2=462847
==============================================================================
--- jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/input/PackageTestSuite.java (original)
+++ jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/input/PackageTestSuite.java Wed Oct 11 09:44:06 2006
@@ -35,6 +35,8 @@
         TestSuite suite = new TestSuite("IO Utilities - input");
         suite.addTest(new TestSuite(ClassLoaderObjectInputStreamTest.class));
         suite.addTest(new TestSuite(CountingInputStreamTest.class));
+        suite.addTest(new TestSuite(MockInputStreamTestCase.class));
+        suite.addTest(new TestSuite(MockReaderTestCase.class));
         suite.addTest(new TestSuite(SwappedDataInputStreamTest.class));
         return suite;
     }



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