commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1022219 - /commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestCursorableLinkedList.java
Date Wed, 13 Oct 2010 18:10:03 GMT
Author: sebb
Date: Wed Oct 13 18:10:01 2010
New Revision: 1022219

URL: http://svn.apache.org/viewvc?rev=1022219&view=rev
Log:
Fix test to use JUnit4 style expects

Modified:
    commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestCursorableLinkedList.java

Modified: commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestCursorableLinkedList.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestCursorableLinkedList.java?rev=1022219&r1=1022218&r2=1022219&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestCursorableLinkedList.java
(original)
+++ commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestCursorableLinkedList.java
Wed Oct 13 18:10:01 2010
@@ -198,19 +198,20 @@ public class TestCursorableLinkedList {
         assertEquals(10,ia.length);
         assertNotNull(ia[0]);
         assertNull(ia[cll.size()]);
-        try {
-            cll.toArray(new String[0]);
-            fail("Should have generated ArrayStoreException");
-        } catch (ArrayStoreException expected){
-            // expected
-        }
         cll.toArray(new Number[0]);
-        try {
-            cll.toArray(null);
-            fail("Should have generated NullPointerException");
-        } catch (NullPointerException expected){
-            // expected
-        }
+    }
+
+    @Test(expected = ArrayStoreException.class)
+    public void toArrayOfIncompatibleTypeShouldThrowASE() throws Exception {
+        CursorableLinkedList<Integer> cll = new CursorableLinkedList<Integer>();
+        cll.add(Integer.valueOf(1)); // Needs at least one entry
+        cll.toArray(new String[0]);
+    }
+
+    @Test(expected = NullPointerException.class)
+    public void toArrayOfNullShouldThrowNPE() throws Exception {
+        CursorableLinkedList<Integer> cll = new CursorableLinkedList<Integer>();
+        cll.toArray(null);
     }
 
 //    @Test



Mime
View raw message