This week's book giveaway is in the Agile forum.
We're giving away four copies of Head First Agile and have Andrew Stellman & Jennifer Greene on-line!
See this thread for details.
Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

tsstng and PersistenceContext  RSS feed

 
nimo frey
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I use testng and want to inject a persistenceContext. But it does not work:

(I have thought, I do not need a mock-object as text-ng is a integration framework and not a unit-test-framework.)


Injecting PersistenceContext in other than TestNG-classes works.


I get this stacktrace (I use maven):




How can I use a JPA-PersistenceContext in TestNG ?
 
Subin Sugunan
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
nimo frey wrote:

How can I use a JPA-PersistenceContext in TestNG ?


Just like how you use in JUnit


Please re-run Maven with the -e switch and paste the stack trace here
 
nimo frey
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found that

http://www.sizovpoint.com/2010/01/step-by-step-guide-to-jpa-enabled-unit.html

and will try to do it as described - however, it is tedious...I have thought, that injecting the PersistenceContext into the TestNg-Class would be sufficient!!

I must admit, I am a newbie to testng/junit.

I am using Jboss 6, JSF 2, EJB 3.1, Weld 1.


This is my stacktrace:

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!