easymock/easymock — pull request #5 by tdrhq (2013-11-26 00:54:31+00:00)
Title: Add support for running with Robolectric.

In robolectric, the tests are compiled against an android.jar file
with all the android API present (but they all throw an
UnsupportedOperationException), and Robolectric hacks the ClassLoader
to load a different version of the class when actually loaded. This
makes the existing test pass even though we're running in a JVM.

To fix this, the strategy I took was to not attempt to use dexmaker if
it's not available, ideally the robolectric tests shouldn't be
compiled against dexmaker anyway.

I also fixed the instrumentation tests, so that I could test these
changes. Bundle was a final class, and the test was failing saying it
couldn't mock it. I also had to add the "dexmaker.dexcache" system
property for the test to run, it's unclear to me under what situations
this is actually needed, but it was needed for me.

We have robolectric, robolectric2 and instrumentation tests, and all
seem to pass with this change.