This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Groovy and the fly likes Mocking/Stubbing Class with Static Factory Method and Regular Methods 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 » Languages » Groovy
Bookmark "Mocking/Stubbing Class with Static Factory Method and Regular Methods" Watch "Mocking/Stubbing Class with Static Factory Method and Regular Methods" New topic
Author

Mocking/Stubbing Class with Static Factory Method and Regular Methods

Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
Another question, again regarding testing using MockFor or StubFor:
If I want to mock/stub a class like Calendar that has a static factory method to create instances of the class and also regular methods, I don't know how to return the mock/stub from the factory method.
Here is my code so far:

Many thanks in advance!
 
jQuery in Action, 2nd edition
 
subject: Mocking/Stubbing Class with Static Factory Method and Regular Methods
 
Similar Threads
How to redirect an OutputStream
Instance of an abstract class
what are singleton classes ?
What are static factory methods
Factory Method/Abstract Factory