views:

989

answers:

3

Is it possible? How do I do it?

+4  A: 

See the EasyMock Class Extension documentation and download it from the SourceForge project. You can't mock final methods though.

Jon Skeet
+2  A: 

Powermock extends EasyMock and allows you to mock concrete types, even final and static methods.

PowerMock is a framework that extend other mock libraries such as EasyMock with more powerful capabilities. PowerMock uses a custom classloader and bytecode manipulation to enable mocking of static methods, constructors, final classes and methods, private methods, removal of static initializers and more.

Rich Seller