You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2019/11/01 15:32:52 UTC
[commons-collections] branch master updated: Add three test cases
in UnmodifiableQueueTest (#105)
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-collections.git
The following commit(s) were added to refs/heads/master by this push:
new 210e3f9 Add three test cases in UnmodifiableQueueTest (#105)
210e3f9 is described below
commit 210e3f907612c2e4c9566b7a9d14789c394217cf
Author: dota17 <50...@users.noreply.github.com>
AuthorDate: Fri Nov 1 23:32:45 2019 +0800
Add three test cases in UnmodifiableQueueTest (#105)
---
.../collections4/queue/CircularFifoQueueTest.java | 47 +++++++++++++++++++++-
1 file changed, 46 insertions(+), 1 deletion(-)
diff --git a/src/test/java/org/apache/commons/collections4/queue/CircularFifoQueueTest.java b/src/test/java/org/apache/commons/collections4/queue/CircularFifoQueueTest.java
index e38ade4..79cefea 100644
--- a/src/test/java/org/apache/commons/collections4/queue/CircularFifoQueueTest.java
+++ b/src/test/java/org/apache/commons/collections4/queue/CircularFifoQueueTest.java
@@ -422,7 +422,52 @@ public class CircularFifoQueueTest<E> extends AbstractQueueTest<E> {
}
}
- @Override
+ public void testAddNull() {
+ final CircularFifoQueue<E> b = new CircularFifoQueue<>(2);
+ try {
+ b.add(null);
+ fail();
+ } catch (final NullPointerException ex) {
+ 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) {
+ return;
+ }
+ fail();
+ }
+
+ public void testDefaultSizeAndGetError2() {
+ 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(-2);
+ } catch (final NoSuchElementException ex) {
+ return;
+ }
+ fail();
+ }
+
+ @Override
public String getCompatibilityVersion() {
return "4";
}