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:
[email protected]
With regards,
Apache Git Services