Code example for ReferenceQueue

Methods: remove

0
import junit.framework.TestCase; 
 
public final class ReferenceQueueTest extends TestCase {
 
    public void testRemoveWithInvalidTimeout() throws Exception { 
        ReferenceQueue<Object> referenceQueue = new ReferenceQueue<Object>();
        try { 
            referenceQueue.remove(-1);
            fail();
        } catch (IllegalArgumentException expected) {
        } 
    } 
 
    public void testRemoveWithVeryLargeTimeout() throws Exception { 
        ReferenceQueue<Object> referenceQueue = new ReferenceQueue<Object>();
        enqueueLater(referenceQueue, 500);
        referenceQueue.remove(Long.MAX_VALUE);
    } 
 
    public void testRemoveWithSpuriousNotify() throws Exception { 
        final ReferenceQueue<Object> referenceQueue = new ReferenceQueue<Object>();