/** * Tests max size */ public void testMaxSize() { resetFull(); assertEquals(getFullElements().length, ((BoundedCollection) collection).maxSize()); ((BoundedFifoBuffer) collection).remove(); assertEquals(getFullElements().length, ((BoundedCollection) collection).maxSize()); ((BoundedFifoBuffer) collection).add("jj"); assertEquals(getFullElements().length, ((BoundedCollection) collection).maxSize()); }
/** * Tests to make sure the add operations raise BufferOverflowException. */ public void testBufferOverflow() { resetFull(); try { collection.add(getOtherElements()[0]); fail("add should raise BufferOverflow."); } catch (BufferOverflowException e) { // expected } verify(); try { collection.addAll(Arrays.asList(getOtherElements())); fail("addAll should raise BufferOverflow."); } catch (BufferOverflowException e) { // expected } verify(); }
/** * Tests is full */ public void testIsFull() { resetFull(); assertEquals(true, ((BoundedCollection) collection).isFull()); ((BoundedFifoBuffer) collection).remove(); assertEquals(false, ((BoundedCollection) collection).isFull()); ((BoundedFifoBuffer) collection).add("jj"); assertEquals(true, ((BoundedCollection) collection).isFull()); }
/** * Returns a BoundedFifoBuffer that's filled to capacity. * Any attempt to add to the returned buffer will result in a * BufferOverflowException. * * @return a full BoundedFifoBuffer */ public Collection makeFullCollection() { return new BoundedFifoBuffer(Arrays.asList(getFullElements())); }
suite.addTest(TestBinaryHeap.suite()); suite.addTest(TestBoundedFifoBuffer.suite()); suite.addTest(TestBoundedFifoBuffer2.suite()); suite.addTest(TestCursorableLinkedList.suite()); suite.addTest(TestDoubleOrderedMap.suite());