commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwaldh...@apache.org
Subject cvs commit: jakarta-commons/collections/src/test/org/apache/commons/collections/primitives/adapters/io TestInputStreamByteIterator.java
Date Tue, 15 Apr 2003 16:26:17 GMT
rwaldhoff    2003/04/15 09:26:16

  Modified:    collections/src/test/org/apache/commons/collections/primitives/adapters/io
                        TestInputStreamByteIterator.java
  Log:
  additional tests
  
  Revision  Changes    Path
  1.2       +33 -2     jakarta-commons/collections/src/test/org/apache/commons/collections/primitives/adapters/io/TestInputStreamByteIterator.java
  
  Index: TestInputStreamByteIterator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/primitives/adapters/io/TestInputStreamByteIterator.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestInputStreamByteIterator.java	15 Apr 2003 03:07:49 -0000	1.1
  +++ TestInputStreamByteIterator.java	15 Apr 2003 16:26:15 -0000	1.2
  @@ -58,6 +58,8 @@
   package org.apache.commons.collections.primitives.adapters.io;
   
   import java.io.ByteArrayInputStream;
  +import java.io.IOException;
  +import java.io.InputStream;
   
   import junit.framework.Test;
   import junit.framework.TestSuite;
  @@ -107,4 +109,33 @@
   
       // ------------------------------------------------------------------------
       
  +    public void testErrorThrowingStream() {
  +        InputStream errStream = new InputStream() {
  +            public int read() throws IOException {
  +                throw new IOException();
  +            }
  +        };
  +        
  +        ByteIterator iter = new InputStreamByteIterator(errStream);
  +        try {
  +            iter.hasNext();
  +            fail("Expected RuntimeException");
  +        } catch(RuntimeException e) {
  +            // expected
  +        } 
  +        try {
  +            iter.next();
  +            fail("Expected RuntimeException");
  +        } catch(RuntimeException e) {
  +            // expected
  +        } 
  +    }
  +    
  +    public void testAdaptNull() {
  +        assertNull(InputStreamByteIterator.adapt(null));
  +    }
  +
  +    public void testAdaptNonNull() {
  +        assertNotNull(InputStreamByteIterator.adapt(new ByteArrayInputStream(new byte[0])));
  +    }
   }
  
  
  

---------------------------------------------------------------------
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