File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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: 19543

Moving to our test forum.

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

Joined: May 26, 2003
Posts: 29253

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
It is sorta covered in the JavaRanch Style Guide.
subject: JUnit integration with EJB and Spring
Similar Threads
Hibernate- why my query results are caching?
How to use the Junit with Struts and Springs
Need an help to write Struts2+ Spring + Junit testcases with anotations.
Repopulating the JSP with the newly selected value from a drop down list.
Spring security with JUnit