Does Junit shut down all the thread?
I have a Junit class with 6 tests in them. When the first test runs, it
calls one of the methods in my other class which starts a new Thread().
Let's call it MyThread.
The idea is for MyThread to keep running for a bit longer after the JUnit
tests are done.
For example, for all the JUnit tests to be done, it would take 1 secs, and
so I would set MyThread to run for 3 secs:
new Thread(new Runable(){
System.out.println("start");
public void run(){
Thread.sleep(3000);
}
System.out.println("end");
}).start();
The start would be shown on the standard output, but the end is never shown.
It seems to me that whenever the JUnit tests are done, MyThread is shut
down as well.
So I am wondering, does JUnit shut down all the threads it initiates?
Thanks a lot.
No comments:
Post a Comment