### Question:
SinkQueue { synchronized void clear() { checkConsumer(); for (int i = data.length; i-- > 0; ) { data[i] = null; } size = 0; } @SuppressWarnings("unchecked")  SinkQueue(int capacity);   }### Answer:
@Test public void testClear() { final SinkQueue<Integer> q = new SinkQueue<Integer>(128); for (int i = 0; i < q.capacity() + 97; ++i) { q.enqueue(i); } assertEquals("queue size", q.capacity(), q.size()); q.clear(); assertEquals("queue size", 0, q.size()); }