Search in sources :

Example 41 with ReferenceQueue

use of java.lang.ref.ReferenceQueue in project openj9 by eclipse.

the class Test_Reference method test_get.

/**
 * @tests java.lang.ref.Reference#get()
 */
@Test
public void test_get() {
    // SM.
    obj = new Object();
    Reference ref = new WeakReference(obj, new ReferenceQueue());
    AssertJUnit.assertTrue("Get succeeded.", ref.get() == obj);
}
Also used : ReferenceQueue(java.lang.ref.ReferenceQueue) Reference(java.lang.ref.Reference) SoftReference(java.lang.ref.SoftReference) WeakReference(java.lang.ref.WeakReference) WeakReference(java.lang.ref.WeakReference) Test(org.testng.annotations.Test)

Aggregations

ReferenceQueue (java.lang.ref.ReferenceQueue)41 WeakReference (java.lang.ref.WeakReference)20 PhantomReference (java.lang.ref.PhantomReference)14 SoftReference (java.lang.ref.SoftReference)14 Reference (java.lang.ref.Reference)13 Test (org.testng.annotations.Test)8 ArrayList (java.util.ArrayList)4 Test (org.junit.Test)4 URLClassLoader (java.net.URLClassLoader)3 ClassLoaders.inMemoryClassLoader (org.mockitoutil.ClassLoaders.inMemoryClassLoader)2 FinalizationPredicate (com.google.common.testing.GcFinalization.FinalizationPredicate)1 SideEffect (dalvik.annotation.SideEffect)1 ManagedChannel (io.grpc.ManagedChannel)1 ManagedChannelReference (io.grpc.internal.ManagedChannelOrphanWrapper.ManagedChannelReference)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 File (java.io.File)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 Field (java.lang.reflect.Field)1 SocketPermission (java.net.SocketPermission)1