* <p/>
* Two read threads should block on an empty buffer until a singleton collection is added then one thread should
* complete. The remaining thread should complete after the addition of a second singleton.
*/
public void testBlockedRemoveWithAddAll1() {
Buffer blockingBuffer = BlockingBuffer.decorate( new MyBuffer() );
Object obj = new Object();
// run methods will remove and compare -- must wait for addAll
Thread thread1 = new ReadThread( blockingBuffer, obj, null, "remove" );
Thread thread2 = new ReadThread( blockingBuffer, obj, null, "remove" );
thread1.start();
thread2.start();
// give hungry read threads ample time to hang
delay();
blockingBuffer.addAll( Collections.singleton( obj ) );
// allow notified threads to complete
delay();
// There should be one thread waiting.
assertTrue( "There is one thread waiting", thread1.isAlive() ^ thread2.isAlive() );
blockingBuffer.addAll( Collections.singleton( obj ) );
// allow notified thread to complete
delay();
// There should not be any threads waiting.