Home arrow Blog

New tutorial! Mocking static methods with PowerMock

“Static methods are the death to testability”. I’m sure you’ve all heard someone say something along those lines. Heck, even Google has blogged about it (http://bit.ly/4mk3fP). And yet, it just doesn’t make sense to me. Static methods were added to the Java language for a reason. Just because most toolsets do not support testing of them doesn’t mean that static methods are bad. I think it means we need new toolsets. With that in mind, I want to introduce you to PowerMock. In this tutorial, you can read about how to mock static methods with an EasyMock like API using this great open source framework. Read more about it here.

One Response to “New tutorial! Mocking static methods with PowerMock”

Add your own comment...

Tweets

    Twitter Button from twitbuttons.com