From 76fb648c5cd28ac54805c532654f5db9f668aed8 Mon Sep 17 00:00:00 2001 From: Stephen Colebourne Date: Sat, 26 Apr 2003 15:12:28 +0000 Subject: [PATCH] Add additional test for null passed to constructor git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@131032 13f79535-47bb-0310-9956-ffa450edef68 --- .../collections/TestBoundedFifoBuffer.java | 30 +++++++++++-------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/src/test/org/apache/commons/collections/TestBoundedFifoBuffer.java b/src/test/org/apache/commons/collections/TestBoundedFifoBuffer.java index 6c5c45aa8..6be316161 100644 --- a/src/test/org/apache/commons/collections/TestBoundedFifoBuffer.java +++ b/src/test/org/apache/commons/collections/TestBoundedFifoBuffer.java @@ -1,13 +1,10 @@ /* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestBoundedFifoBuffer.java,v 1.4 2003/02/19 20:33:11 scolebourne Exp $ - * $Revision: 1.4 $ - * $Date: 2003/02/19 20:33:11 $ - * + * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestBoundedFifoBuffer.java,v 1.5 2003/04/26 15:12:28 scolebourne Exp $ * ==================================================================== * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999-2002 The Apache Software Foundation. All rights + * Copyright (c) 1999-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -65,8 +62,11 @@ import java.util.Collection; import java.util.Iterator; import junit.framework.Test; + /** - * Test cases for BoundedFifoBuffer. + * Test cases for BoundedFifoBuffer. + * + * @author Paul Jack */ public class TestBoundedFifoBuffer extends TestCollection { @@ -87,8 +87,6 @@ public class TestBoundedFifoBuffer extends TestCollection { return new BoundedFifoBuffer(100); } - - /** * Returns an empty ArrayList. * @@ -98,7 +96,6 @@ public class TestBoundedFifoBuffer extends TestCollection { return new ArrayList(); } - /** * Returns a full ArrayList. * @@ -110,7 +107,6 @@ public class TestBoundedFifoBuffer extends TestCollection { return c; } - /** * Overridden because BoundedFifoBuffer doesn't support null elements. * @@ -120,14 +116,12 @@ public class TestBoundedFifoBuffer extends TestCollection { return getFullNonNullElements(); } - /** * Overridden, because BoundedFifoBuffer's iterators aren't fail-fast. */ public void testCollectionIteratorFailFast() { } - /** * Runs through the regular verifications, but also verifies that * the buffer contains the same elements in the same sequence as the @@ -189,4 +183,16 @@ public class TestBoundedFifoBuffer extends TestCollection { } fail(); } + + /** + * Tests that the constructor correctly throws an exception. + */ + public void testConstructorException3() { + try { + new BoundedFifoBuffer(null); + } catch (NullPointerException ex) { + return; + } + fail(); + } }