commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [commons-collections] dota17 commented on a change in pull request #101: Add three test cases in CircularFifoQueueTest
Date Fri, 01 Nov 2019 00:59:46 GMT
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:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message