wood burning stoves*
The moose likes EJB and other Java EE Technologies and the fly likes tsstng and PersistenceContext Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "tsstng and PersistenceContext" Watch "tsstng and PersistenceContext" New topic
Author

tsstng and PersistenceContext

nimo frey
Ranch Hand

Joined: Jun 28, 2008
Posts: 580
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

Joined: Jul 01, 2009
Posts: 14
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


Thanks and Best Regards
Subin Sugunan
nimo frey
Ranch Hand

Joined: Jun 28, 2008
Posts: 580
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.
 
subject: tsstng and PersistenceContext
 
Similar Threads
Maven Project Running Problem
how do i add a jar file externally as a maven dependency in eclipse?
Junit test: cannot find test Method although that it is already defined in the test class
Could not find artifact org.apache.maven.plugins:maven-war-plugin:pom:2.1.0 in central
How to change jetty binding port number in maven.