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#...
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&a...