/** * Gets the number of items on the queue. * <p> * @return size of the queue. */ public int getQueueSize() { return queue.size(); }
/** * Verify that the queue returns the number of elements and the it does not exceed the max. */ public void testSize() { // SETUP int maxSize = 10; BoundedQueue<String> queue = new BoundedQueue<String>( maxSize ); // DO WORK for ( int i = 0; i < maxSize * 2; i++ ) { queue.add( "adfadsf sad " + i ); } int result = queue.size(); // VERIFY assertEquals( "Result size not as expected", maxSize, result ); }