Using an anti-corruption-layer is most often a good thing. I think
there are a few cases where it might not be or perhaps cases where you
want to be able to test your anti-corruption-layer. For instance, the
Java ME API contains lots of static method calls. To minimize your
code there might be reasons not to use an anti-corruption-layer or
perhaps test your low level byte-fiddling API calls actually works.
This is a good usecase for PowerMock.
Another usecase is for legacy code. I have often seen untestable
legacy code that the organization is too afraid to modify. Using
PowerMock you can actually start writing testcases without modifying
the code and start building your confidence.
As Johan writes, PowerMock is not intended as a general purpose mock
framework. It is intended for the tricky cases where you are not able
to write unit tests simply for technical limitations. We want to
support different mock framework API's so people can still be able to
use their favorite mock framework and get around those limitations.
Mockito is opinionated, PowerMock is not. So using PowerMock you can
write crappy code and still be able to test. This is obviously not our
aim! Don't run with scissors! Don't write crappy code with
PowerMock! :-)
/Jan
> 2008/11/26 Gili Tzabari <
gili.tzab...@gmail.com>