You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by GitBox <gi...@apache.org> on 2019/10/31 13:52:20 UTC

[GitHub] [commons-collections] garydgregory commented on a change in pull request #101: Add three test cases in CircularFifoQueueTest

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

 ##########
 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());
 
 Review comment:
   -1: I do not think we should test the actual text of the message, it is too brittle IMO. We should not break test when we are improving or updating exception messages later on. Testing that the exception message is not empty is OK though. Also there is a space missing after the comma.

----------------------------------------------------------------
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