PowerMockito: NotAMockException on a mock
问题 Bit of a complicated setup. Robolectric, PowerMockito rule-based config. @RunWith(RobolectricGradleTestRunner.class) @Config(constants = BuildConfig.class, sdk = 21) @PowerMockIgnore({"org.mockito.*", "org.robolectric.*", "android.*"}) // Using "PrepareOnlyThis" prevents powermock from trying to instrument the whole hierarchy, // part of which we've ignored (android.os.* in this case) @PrepareOnlyThisForTest({ServiceCallbackBase.class}) // this class extends Handler, // so we need