[jboss-dev-forums] [Design of Messaging on JBoss (Messaging/JBoss)] - Re: Lots of largemessages
timfox
do-not-reply at jboss.com
Wed Aug 12 05:01:54 EDT 2009
I just did a test, both in eclipse and junit via ant gave the same results.
The following test class
| public class MyTest extends TestCase
| {
| private static final Logger log = Logger.getLogger(MyTest.class);
|
| public MyTest()
| {
| log.info("Constructor");
| }
|
| protected void setUp()
| {
| log.info("Setup");
| }
|
| protected void tearDown()
| {
| log.info("TearDown");
| }
|
| public void test1()
| {
| log.info("test1");
| }
|
| public void test2()
| {
| log.info("test2");
| }
|
| public void test3()
| {
| log.info("test3");
| }
|
|
| }
|
Produces the following output:
| [main] 09:54:20,814 INFO [org.jboss.messaging.tests.integration.MyTest] Constructor
| [main] 09:54:21,185 INFO [org.jboss.messaging.tests.integration.MyTest] Constructor
| [main] 09:54:21,186 INFO [org.jboss.messaging.tests.integration.MyTest] Constructor
| [main] 09:54:21,231 INFO [org.jboss.messaging.tests.integration.MyTest] Setup
| [main] 09:54:21,232 INFO [org.jboss.messaging.tests.integration.MyTest] test1
| [main] 09:54:21,233 INFO [org.jboss.messaging.tests.integration.MyTest] TearDown
| [main] 09:54:21,233 INFO [org.jboss.messaging.tests.integration.MyTest] Setup
| [main] 09:54:21,234 INFO [org.jboss.messaging.tests.integration.MyTest] test2
| [main] 09:54:21,234 INFO [org.jboss.messaging.tests.integration.MyTest] TearDown
| [main] 09:54:21,235 INFO [org.jboss.messaging.tests.integration.MyTest] Setup
| [main] 09:54:21,235 INFO [org.jboss.messaging.tests.integration.MyTest] test3
| [main] 09:54:21,235 INFO [org.jboss.messaging.tests.integration.MyTest] TearDown
|
So JUnit instantiates a new instance of the test class for running each test (I didn't know that), but it does that at the beginning.
Not sure if that was the point you were trying to make.
But if so, then yes we need to set objects to null in teardown.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4249160#4249160
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4249160
More information about the jboss-dev-forums
mailing list