scolebourne 2002/10/13 06:00:23 Modified: collections/src/test/org/apache/commons/collections TestBoundedFifoBuffer.java TestUnboundedFifoBuffer.java Log: Add tests for negative size constructors Revision Changes Path 1.3 +26 -6 jakarta-commons/collections/src/test/org/apache/commons/collections/TestBoundedFifoBuffer.java Index: TestBoundedFifoBuffer.java =================================================================== RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestBoundedFifoBuffer.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- TestBoundedFifoBuffer.java 3 Jul 2002 01:59:50 -0000 1.2 +++ TestBoundedFifoBuffer.java 13 Oct 2002 13:00:23 -0000 1.3 @@ -60,13 +60,10 @@ */ package org.apache.commons.collections; - import junit.framework.Test; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; - - /** * Test cases for BoundedFifoBuffer. */ @@ -168,4 +165,27 @@ } } + /** + * Tests that the constructor correctly throws an exception. + */ + public void testConstructorException1() { + try { + new BoundedFifoBuffer(0); + } catch (IllegalArgumentException ex) { + return; + } + fail(); + } + + /** + * Tests that the constructor correctly throws an exception. + */ + public void testConstructorException2() { + try { + new BoundedFifoBuffer(-20); + } catch (IllegalArgumentException ex) { + return; + } + fail(); + } } 1.3 +27 -7 jakarta-commons/collections/src/test/org/apache/commons/collections/TestUnboundedFifoBuffer.java Index: TestUnboundedFifoBuffer.java =================================================================== RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestUnboundedFifoBuffer.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- TestUnboundedFifoBuffer.java 3 Jul 2002 01:59:50 -0000 1.2 +++ TestUnboundedFifoBuffer.java 13 Oct 2002 13:00:23 -0000 1.3 @@ -60,15 +60,12 @@ */ package org.apache.commons.collections; - import junit.framework.Test; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; - - /** - * Test cases for UnboundedFifoBuffer. + * Test cases for UnboundedFifoBuffer. */ public class TestUnboundedFifoBuffer extends TestCollection { @@ -160,5 +157,28 @@ } } + /** + * Tests that the constructor correctly throws an exception. + */ + public void testConstructorException1() { + try { + new UnboundedFifoBuffer(0); + } catch (IllegalArgumentException ex) { + return; + } + fail(); + } + + /** + * Tests that the constructor correctly throws an exception. + */ + public void testConstructorException2() { + try { + new UnboundedFifoBuffer(-20); + } catch (IllegalArgumentException ex) { + return; + } + fail(); + } }
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>