{"action":"opened","issue":{"url":"https://api.github.com/repos/jayway/powermock/issues/259","labels_url":"https://api.github.com/repos/jayway/powermock/issues/259/labels{/name}","comments_url":"https://api.github.com/repos/jayway/powermock/issues/259/comments","events_url":"https://api.github.com/repos/jayway/powermock/issues/259/events","html_url":"https://github.com/jayway/powermock/issues/259","id":96974741,"number":259,"title":"Set mock name in Mockito","user":{"login":"johanhaleby","id":187029,"avatar_url":"https://avatars.githubusercontent.com/u/187029?v=3","gravatar_id":"","url":"https://api.github.com/users/johanhaleby","html_url":"https://github.com/johanhaleby","followers_url":"https://api.github.com/users/johanhaleby/followers","following_url":"https://api.github.com/users/johanhaleby/following{/other_user}","gists_url":"https://api.github.com/users/johanhaleby/gists{/gist_id}","starred_url":"https://api.github.com/users/johanhaleby/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johanhaleby/subscriptions","organizations_url":"https://api.github.com/users/johanhaleby/orgs","repos_url":"https://api.github.com/users/johanhaleby/repos","events_url":"https://api.github.com/users/johanhaleby/events{/privacy}","received_events_url":"https://api.github.com/users/johanhaleby/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/jayway/powermock/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/jayway/powermock/labels/imported","name":"imported","color":"FFFFFF"},{"url":"https://api.github.com/repos/jayway/powermock/labels/Milestone-Release1.4","name":"Milestone-Release1.4","color":"FFFFFF"},{"url":"https://api.github.com/repos/jayway/powermock/labels/Priority-Medium","name":"Priority-Medium","color":"FFFFFF"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-07-24T06:22:38Z","updated_at":"2015-07-24T06:22:39Z","closed_at":null,"body":"_From [johan.ha...@gmail.com](https://code.google.com/u/105676376875942041029/) on March 15, 2010 13:24:33_\n\nI find that I get NullPointerExceptions when invoking toString() on\r\nany mock objects generated by PowerMock. The following simple code\r\nwill re-create the problem:\r\n\r\nimport javax.crypto.Cipher;\r\n\r\nimport org.junit.Test;\r\nimport org.junit.runner.RunWith;\r\nimport org.powermock.api.mockito.PowerMockito;\r\nimport org.powermock.core.classloader.annotations.PrepareForTest;\r\nimport org.powermock.modules.junit4.PowerMockRunner;\r\n\r\n@RunWith(PowerMockRunner.class)\r\n@PrepareForTest(Cipher.class)\r\npublic class MyTest {\r\n   private Cipher cipher;\r\n\r\n   @Test\r\n   public void test1() throws Exception {\r\n       cipher = PowerMockito.mock(Cipher.class);\r\n\r\n       System.out.println(cipher);\r\n   }\r\n}\r\n\r\nWe use Log4j quite heavily to log method parameters and using injected\r\nPowerMock objects makes this a big issue for us.\n\n_Original issue: http://code.google.com/p/powermock/issues/detail?id=239_"}}