Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JUnit : How to Mock Static Method

807601Mar 28 2008 — edited Jun 21 2010
Hi,

I was using EasyMock to write Junit for the methods of the class.
The Limitation of this library is that only Interfaces can be mocked without any much effort and behavior can be set according to our needs.

Since, now we need to mock even normal classes, I got mocuer library from net and this too is easy to implement. The problem / limitation is that, I cant mock static methods of a class.

Is there is any workaround / library so that even static methods can be mocked??.

Advance thanks.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 19 2010
Added on Mar 28 2008
7 comments
1,516 views