wood burning stoves 2.0*
The moose likes Testing and the fly likes JUnit integration with EJB and Spring Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » Testing
Bookmark "JUnit integration with EJB and Spring" Watch "JUnit integration with EJB and Spring" New topic

JUnit integration with EJB and Spring

Arun Vasu

Joined: Oct 05, 2010
Posts: 24


I am new to JUnit and need to write JUnit test cases involving Spring and EJB in one functionality.

Please read below the exact scenario.

1. Fetching a list of employees using Spring jdbcTemplate.
2. Disable these employees using an EJB service.

Currently I am using org.springframework.test.AbstractDependencyInjectionSpringContextTests for creating unit test for employee fetching using Spring.
After this I need to call the EJB service for this employee list to disable them.

Please help me whether I can integrate these Sring and EJB in same JUnit test case or I need to write separate test cases ?

Your help is greatly appreciated
Rob Spoor

Joined: Oct 27, 2005
Posts: 19674

Moving to our test forum.

How To Ask Questions How To Answer Questions
Jeanne Boyarsky
internet detective

Joined: May 26, 2003
Posts: 30353

Yes, you can use the same integration test case if the EJB is a remote call.

[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
I agree. Here's the link: http://aspose.com/file-tools
subject: JUnit integration with EJB and Spring