idea can't distinguish a test case is junit4

     My english is poor. I hope the problem is clearly and properly presented.
     I use idea 10.5.1, when i run a test case, it throw exceptions:
     2011-11-17 17:01:13,724 [] INFO  adboard.AdboardBOTest - ApplicationContext has not been configured for test []: dependency           injection will NOT be performed.
     2011-11-17 17:01:13,724 [] INFO  adboard.AdboardBOTest - No transaction manager set: test will NOT run within a transaction
     The spring contextConfiguration files are not loaded.
     In the BaseTestCase, i use annotation @ContextConfiguration to load contextConfiguration files.
     // "classpath:/ehcache.xml",

     but, when i delete a import statement "import static org.mockito.Matchers.any;" Everything is OK!!!!!!
     then i occuer the same problem when i add some other import...
     Last, I find when the test case is ok, in consle idea print"com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 -junit4  XXX"; when test case isn't ok, in consle idea print"com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 -junit4 XXX"; so i doubt idea can't  distinguish a test case is junit4 in some case. I can't find the place to set idea alway use junit4.
     I need help!!!!

Comment actions Permalink

IDEA detects that you use junit4 when you have junit annotations thought when your test extends TestCase it would be run inside junit as junit3 test case. That is not IDEA's specific but junit itself (we must follow the command line; junit ant, etc).
So if you don't need to extend TestCase - please do not extend it or use additional setUp/tearDown methods to correctly inject everything.
Thank you

Comment actions Permalink

I want to know why i delete the import statement "import static org.mockito.Matchers.any;" everything is ok:|
And i can't confirm which import can cause that problem.......

Comment actions Permalink

Sorry, I do not understand. The runner is chosen by junit itself anyway. IDEA chooses in both cases junit4 (from parameter in the command line). If it possible please attach your whole test (with superclass dependencies) otherwise it is impossible to detect whats wrong.
Thank you


Please sign in to leave a comment.