{"action":"created","issue":{"url":"https://api.github.com/repos/robolectric/robolectric/issues/1058","labels_url":"https://api.github.com/repos/robolectric/robolectric/issues/1058/labels{/name}","comments_url":"https://api.github.com/repos/robolectric/robolectric/issues/1058/comments","events_url":"https://api.github.com/repos/robolectric/robolectric/issues/1058/events","html_url":"https://github.com/robolectric/robolectric/issues/1058","id":32767192,"number":1058,"title":"Cannot use with PowerMock because of different ClassLoader","user":{"login":"WonderCsabo","id":480485,"avatar_url":"https://avatars.githubusercontent.com/u/480485?v=3","gravatar_id":"","url":"https://api.github.com/users/WonderCsabo","html_url":"https://github.com/WonderCsabo","followers_url":"https://api.github.com/users/WonderCsabo/followers","following_url":"https://api.github.com/users/WonderCsabo/following{/other_user}","gists_url":"https://api.github.com/users/WonderCsabo/gists{/gist_id}","starred_url":"https://api.github.com/users/WonderCsabo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WonderCsabo/subscriptions","organizations_url":"https://api.github.com/users/WonderCsabo/orgs","repos_url":"https://api.github.com/users/WonderCsabo/repos","events_url":"https://api.github.com/users/WonderCsabo/events{/privacy}","received_events_url":"https://api.github.com/users/WonderCsabo/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":34,"created_at":"2014-05-04T12:01:14Z","updated_at":"2015-05-31T19:36:34Z","closed_at":"2014-07-29T14:42:02Z","body":"This is my simple test:\r\n```java\r\n@RunWith(RobolectricTestRunner.class)\r\n@PrepareForTest(ServerPointPackage.class)\r\npublic class PowerMockRobolectricTestCase {\r\n\r\n\t@Rule\r\n    public PowerMockRule rule = new PowerMockRule();\r\n\t\r\n\tstatic {\r\n\t\tPowerMockAgent.initializeIfNeeded();\r\n\t}\r\n\t\r\n\t@Test\r\n\tpublic void test() {\r\n\t\tmockStatic(ServerPointPackage.class);\r\n\t\t\r\n\t\twhen(ServerPointPackage.getCount()).thenReturn(2);\r\n\t}\r\n}\r\n```\r\n\r\nUnfortunetaly i get the following error when i run the test:\r\n\r\n`PowerMockRule can only be used with the system classloader but was loaded by org.robolectric.bytecode.AsmInstrumentingClassLoader`\r\n\r\nAre there any workarounds for this?"},"comment":{"url":"https://api.github.com/repos/robolectric/robolectric/issues/comments/107239270","html_url":"https://github.com/robolectric/robolectric/issues/1058#issuecomment-107239270","issue_url":"https://api.github.com/repos/robolectric/robolectric/issues/1058","id":107239270,"user":{"login":"jaredsburrows","id":1739848,"avatar_url":"https://avatars.githubusercontent.com/u/1739848?v=3","gravatar_id":"","url":"https://api.github.com/users/jaredsburrows","html_url":"https://github.com/jaredsburrows","followers_url":"https://api.github.com/users/jaredsburrows/followers","following_url":"https://api.github.com/users/jaredsburrows/following{/other_user}","gists_url":"https://api.github.com/users/jaredsburrows/gists{/gist_id}","starred_url":"https://api.github.com/users/jaredsburrows/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaredsburrows/subscriptions","organizations_url":"https://api.github.com/users/jaredsburrows/orgs","repos_url":"https://api.github.com/users/jaredsburrows/repos","events_url":"https://api.github.com/users/jaredsburrows/events{/privacy}","received_events_url":"https://api.github.com/users/jaredsburrows/received_events","type":"User","site_admin":false},"created_at":"2015-05-31T19:36:34Z","updated_at":"2015-05-31T19:36:34Z","body":"@WonderCsabo \r\nI just ran your branch, everything works with the `Rule`. \r\n\r\nWhen I change the sdk to `21`, they fail like this:\r\n\r\n    burrows.apps.math.data.DataFetcherTest > testGetEquationsNullData FAILED\r\n        java.lang.NoSuchMethodError: java.lang.System.arraycopy([II[III)V\r\n\r\n    burrows.apps.math.data.DataFetcherTest > testGetVersionNullData FAILED\r\n        java.lang.NoSuchMethodError: java.lang.System.arraycopy([II[III)V\r\n\r\n    burrows.apps.math.data.DataFetcherTest > testGetVersion FAILED\r\n        java.lang.NoSuchMethodError: java.lang.System.arraycopy([II[III)V\r\n\r\n    burrows.apps.math.data.DataFetcherTest > testGetEquations FAILED\r\n        java.lang.NoSuchMethodError: java.lang.System.arraycopy([II[III)V\r\n\r\nThank you for your help thus far."}}