### Question:
RingBuffer extends AbstractQueue<T> { @Override public boolean offer(T value) { if (size == capacity) { return false; } items[tail] = value; tail = (tail + 1) % items.length; size++; return true; } @SuppressWarnings("unchecked")  RingBuffer(int capacity); @Override Iterator<T> iterator(); @Override boolean offer(T value); @Override T peek(); @Override T poll(); @Override int size(); @Override String toString();  }### Answer:
@Test public void testOffer() { RingBuffer<String> test = new RingBuffer<String>(1000); for (int i = 0; i < 1000; i++) { assertEquals("Invalid size", i, test.size()); assertTrue(test.offer(String.format("Offer: %s", i))); } assertEquals("Invalid size", 1000, test.size()); assertFalse((test.offer(String.format("Offer: %s", 1001)))); }