Author
Spring TestCase Exception
Joe Harry
Ranch Hand
Joined: Sep 26, 2006
Posts: 8795
Hallo All,
I'm trying to execute a simple JUnit test using Spring applicationContext: Below is my TestCase:
This is what I get when I run testCreateNewUser()???
SCJP 1.4, SCWCD 1.4 - Hints for you , SCBCD Hints - Demnachst , SCDJWS - Auch Demnachst
Did a rm -R / to find out that I lost my entire Linux installation!
Lino Larios
Greenhorn
Joined: Jun 27, 2008
Posts: 28
I think in Junit4 you must extneds from AbstractTransactionalJUnit4SpringContextTests
bye
Mark Spritzler
ranger
Sheriff
Joined: Feb 05, 2001
Posts: 17233
posted Dec 17, 2010 21:24:12
0
Lino Larios wrote: I think in Junit4 you must extneds from AbstractTransactionalJUnit4SpringContextTests
bye
Nope, that is for JUnit 3. With JUnit4 you use the @ContextConfiguration and @RunWith annotations.
Mark
Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Joe Harry
Ranch Hand
Joined: Sep 26, 2006
Posts: 8795
Exactly like Mark pointed out I'm now using @RunWith and @ContextConfigLocation annotations. But I have some problems with running it. I have the context files in my src/main/resources/ folder and I'm running my tests from src/test folder and it complains that it cannot find the context file. I do not want to duplicate the context file again in the src/test/resources folder. Is there a way to get this out?
Joe Harry
Ranch Hand
Joined: Sep 26, 2006
Posts: 8795
Ok it worked now. Changed to classpath:config/common/applicationContext-velocity-email.xml.
kri shan
Ranch Hand
Joined: Apr 08, 2004
Posts: 1300
Changed to classpath:config/common/applicationContext-velocity-email.xml.
What was the context path before ?
Joe Harry
Ranch Hand
Joined: Sep 26, 2006
Posts: 8795
I did not have the classpath:.
subject: Spring TestCase Exception