Code example for PhantomReference

Methods: clear, enqueue, get

0
    protected void doneSuite() { 
        bool = null;
    } 
 
    /** 
     * @tests java.lang.ref.PhantomReference#get() 
     */ 
    @TestTargetNew( 
        level = TestLevel.COMPLETE, 
        notes = "", 
        method = "get", 
        args = {} 
    ) 
    public void test_get() { 
        ReferenceQueue rq = new ReferenceQueue();
        bool = new Boolean(false);
        PhantomReference pr = new PhantomReference(bool, rq);
        assertNull("get() should return null.", pr.get());
        pr.enqueue();
        assertNull("get() should return null.", pr.get());
        pr.clear();