ClassCastException exception when running Robolectric test with Power Mock on multiple files
- 阅读更多 关于 ClassCastException exception when running Robolectric test with Power Mock on multiple files
So I set up the power mock based on the reference guide here . It all seems to run perfectly fine with a single test class. But when executing multiple JUnit tests I am getting the following error on the second test class. As you can see from the stacktrace below I am trying to mock a otto Bus instance. It seemed to mock properly on the first test class but on the the second class I am getting this class cast exception. On the stacktrace I am getting suggestion to disable Objenisis cache but I am not sure how to accomplish that and if that is actually the root cause as I am using classloading