[hg] main-silver: Use assertGC() to assure correct test for rele...

  • From:
  • To:
  • Subject: [hg] main-silver: Use assertGC() to assure correct test for rele...
  • Date: Tue, 20 Nov 2012 15:00:23 -0800

changeset 6ecb271f33e5 in main-silver ((none))
details: http://hg.netbeans.org/main-silver/rev/6ecb271f33e5
description:
        Use assertGC() to assure correct test for release of objects.

diffstat:

 
debugger.jpda.projects/test/unit/src/org/netbeans/modules/debugger/jpda/projects/WeakHashMapActiveTest.java
 |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (30 lines):

diff --git 
a/debugger.jpda.projects/test/unit/src/org/netbeans/modules/debugger/jpda/projects/WeakHashMapActiveTest.java
 
b/debugger.jpda.projects/test/unit/src/org/netbeans/modules/debugger/jpda/projects/WeakHashMapActiveTest.java
--- 
a/debugger.jpda.projects/test/unit/src/org/netbeans/modules/debugger/jpda/projects/WeakHashMapActiveTest.java
+++ 
b/debugger.jpda.projects/test/unit/src/org/netbeans/modules/debugger/jpda/projects/WeakHashMapActiveTest.java
@@ -68,12 +68,16 @@
         assertEquals("Size", 2, whma.size());
         assertEquals(v1, whma.get(k1));
         assertEquals(v2, whma.get(k2));
+        Reference rk1 = new WeakReference(k1);
+        Reference rk2 = new WeakReference(k2);
         k1 = k2 = null;
         System.gc();
         int[] arr = new int[10000000];
         arr[1000000] = 10;
         arr = null;
         System.gc();
+        assertGC("WeakHashMapActive's key is not released from memory", rk1);
+        assertGC("WeakHashMapActive's key is not released from memory", rk2);
         assertEquals("Size", 0, whma.size());
         v1 = v2 = null;
         System.gc();
@@ -81,7 +85,7 @@
         arr[1000000] = 10;
         arr = null;
         System.gc();
-        assertNull(rv1.get());
-        assertNull(rv2.get());
+        assertGC("WeakHashMapActive's value is not released from memory", 
rv1);
+        assertGC("WeakHashMapActive's value is not released from memory", 
rv2);
     }
 }

[hg] main-silver: Use assertGC() to assure correct test for rele...

mentlicher 11/20/2012

Project Features

About this Project

Debugger was started in November 2009, is owned by tpavek, and has 29 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20140418.2d69abc). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close