[jboss-dev-forums] [Design of Messaging on JBoss (Messaging/JBoss)] - JUnit holds the test references until the end of the suite c
clebert.suconic@jboss.com
do-not-reply at jboss.com
Tue Aug 11 19:55:56 EDT 2009
This is to confirm what I suspected here:
http://www.jboss.org/index.html?module=bb&op=viewtopic&t=159702
Say that you have this test:
public class SomeTest extends TestCase
| {
|
| // Constants -----------------------------------------------------
|
| // Attributes ----------------------------------------------------
|
| Server server;
|
| // Static --------------------------------------------------------
|
| // Constructors --------------------------------------------------
|
| // Public --------------------------------------------------------
|
| public void setUp()
| {
| ts = new SomeClass();
| }
|
| public void testOne() throws Exception
| {
| System.gc();
| Thread.sleep(1000);
| }
|
| public void testOneA() throws Exception
| {
| System.gc();
| Thread.sleep(1000);
| }
|
JUnit will hold one reference of the Server for each method on the test. Those referencess will be released only at the end of the class.
So it would be great if as a best practice, we set any big object to null on tearDown. (Things like servers, connections... etc).
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4249094#4249094
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4249094
More information about the jboss-dev-forums
mailing list