dota17 commented on a change in pull request #101: Add three test cases in 
CircularFifoQueueTest
URL: 
https://github.com/apache/commons-collections/pull/101#discussion_r341419854
 
 

 ##########
 File path: 
src/test/java/org/apache/commons/collections4/queue/CircularFifoQueueTest.java
 ##########
 @@ -421,6 +421,54 @@ public void testGetIndex() {
             assertEquals(confirmed.get(i + 2), queue.get(i));
         }
     }
+       
+       public void testAddNull() {
+        final CircularFifoQueue<E> b = new CircularFifoQueue<>(2);
+        try {
+            b.add(null);
+            fail();
+        } catch (final NullPointerException ex) {
+            assertEquals("Attempted to add null object to 
queue",ex.getMessage());
+            return;
+        }
+        fail();
+    }
+
+    public void testDefaultSizeAndGetError1() {
+        final CircularFifoQueue<E> fifo = new CircularFifoQueue<>();
+        assertEquals(32,fifo.maxSize());
+        fifo.add((E) "1");
+        fifo.add((E) "2");
+        fifo.add((E) "3");
+        fifo.add((E) "4");
+        fifo.add((E) "5");
+        assertEquals(5,fifo.size());
+        try {
+            fifo.get(5);
+        } catch (final NoSuchElementException ex) {
+            assertEquals("The specified index (5) is outside the available 
range [0, 5)",ex.getMessage());
 
 Review comment:
   Ok, I got it, thanks !

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to