@Test public void testConstructorLimitsSize() throws IndexOutOfBoundsException { thrown.expect(IndexOutOfBoundsException.class); queue = new Queue(10); for (int i = 0; i < 11; i++) { queue.enqueue(new Object()); } }
public void enqueue(Object obj) throws IndexOutOfBoundsException { synchronized (mutex) { if ((maxQueueSize > 0) && (size() >= maxQueueSize)) { throw new IndexOutOfBoundsException("Queue is full. Element not added."); } queueData.add(obj); } }
Queue extends SmppObject { public void enqueue(Object obj) throws IndexOutOfBoundsException { synchronized (mutex) { if ((maxQueueSize > 0) && (size() >= maxQueueSize)) { throw new IndexOutOfBoundsException("Queue is full. Element not added."); } queueData.add(obj); } } }
Queue extends SmppObject { public void enqueue(Object obj) throws IndexOutOfBoundsException { synchronized (mutex) { if ((maxQueueSize > 0) && (size() >= maxQueueSize)) { throw new IndexOutOfBoundsException("Queue is full. Element not added."); } queueData.add(obj); } } Queue();  Queue(int maxSize); }
Queue extends SmppObject { public void enqueue(Object obj) throws IndexOutOfBoundsException { synchronized (mutex) { if ((maxQueueSize > 0) && (size() >= maxQueueSize)) { throw new IndexOutOfBoundsException("Queue is full. Element not added."); } queueData.add(obj); } } Queue();  Queue(int maxSize); int size(); boolean isEmpty(); Object dequeue(); Object dequeue(Object obj); void enqueue(Object obj); Object find(Object obj); }
Queue extends SmppObject { public void enqueue(Object obj) throws IndexOutOfBoundsException { synchronized (mutex) { if ((maxQueueSize > 0) && (size() >= maxQueueSize)) { throw new IndexOutOfBoundsException("Queue is full. Element not added."); } queueData.add(obj); } } Queue();  Queue(int maxSize); int size(); boolean isEmpty(); Object dequeue(); Object dequeue(Object obj); void enqueue(Object obj); Object find(Object obj);  }