• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Spring TestCase Exception

 
Joe Harry
Ranch Hand
Posts: 10124
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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()???

 
Lino Larios
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think in Junit4 you must extneds from AbstractTransactionalJUnit4SpringContextTests

bye
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Joe Harry
Ranch Hand
Posts: 10124
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10124
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok it worked now. Changed to classpath:config/common/applicationContext-velocity-email.xml.
 
kri shan
Ranch Hand
Posts: 1467
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Changed to classpath:config/common/applicationContext-velocity-email.xml.
What was the context path before ?
 
Joe Harry
Ranch Hand
Posts: 10124
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I did not have the classpath:.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic