wood burning stoves 2.0*
The moose likes Testing and the fly likes Mocking out the parent class method using Easymock Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » Testing
Bookmark "Mocking out the parent class method using Easymock" Watch "Mocking out the parent class method using Easymock" New topic
Author

Mocking out the parent class method using Easymock

ragi singh
Ranch Hand

Joined: Mar 10, 2010
Posts: 198

hi ,

I am writing a test case using easy mock but the method i want to test gives a call to the super class method which is also overridden in my subclass . I thought about to approaches one taking out the call to super class method in another method and then mocking this method other being partial mocking . Can anyone suggest whether the approach is correct or is there a way out which is better or there is already something existing in the api to deal with such scenario .


Thanks ,
ragi
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29275
    
140

Ragi,
I think your refactoring is the best choice.


[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: Mocking out the parent class method using Easymock
 
Similar Threads
Help need to write a test junit test case
overriding methods
Using Reflection to call super class method
jstestdriver and javascript testing
Struts2: How to Test Actions by passing Interceptors