File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Testing and the fly likes Spring Junit testing using JMock Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Testing
Bookmark "Spring Junit testing using JMock" Watch "Spring Junit testing using JMock" New topic

Spring Junit testing using JMock

Anand Jain

Joined: Jul 27, 2009
Posts: 18
I have a Spring maven project and we are going to use JMock to test service/business/DAO layers of my project as suggested by client.
Can somebody please provide me the good link going through which I can understand and implement it?

I am not clear with the term mock objects. What is the need of mock objects? Why should I use it?Also I have heard of other mocking frameworks like Mockito or EasyMock. Is JMock better than those? or Which one is better to use even? This is just for knowledge sake as I will be using JMock only since it is suggested by the client
Jeanne Boyarsky
internet detective

Joined: May 26, 2003
Posts: 30123

The official getting started guide and cookbook are good.

All three mock frameworks are good. At the moment, Mockito is somewhat more advanced. All three frameworks are still enhancing though. The next version of jMock catches up.

[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
Jeanne Boyarsky
internet detective

Joined: May 26, 2003
Posts: 30123

This question was also posted on stack overflow.

Please read BeForthrightWhenCrossPostingToOtherSites for why you should disclose when you post to more than one site.
I agree. Here's the link:
subject: Spring Junit testing using JMock
Similar Threads
jmock query
Testing the code
Help: problem with EasyMock
Automatic Mocking with Spring framework
testing with mock objects