{"action":"created","issue":{"url":"https://api.github.com/repos/jmockit/jmockit1/issues/401","repository_url":"https://api.github.com/repos/jmockit/jmockit1","labels_url":"https://api.github.com/repos/jmockit/jmockit1/issues/401/labels{/name}","comments_url":"https://api.github.com/repos/jmockit/jmockit1/issues/401/comments","events_url":"https://api.github.com/repos/jmockit/jmockit1/issues/401/events","html_url":"https://github.com/jmockit/jmockit1/issues/401","id":214328265,"number":401,"title":"Possible to mock a static method in an interface","user":{"login":"brucetrask","id":10885119,"avatar_url":"https://avatars0.githubusercontent.com/u/10885119?v=3","gravatar_id":"","url":"https://api.github.com/users/brucetrask","html_url":"https://github.com/brucetrask","followers_url":"https://api.github.com/users/brucetrask/followers","following_url":"https://api.github.com/users/brucetrask/following{/other_user}","gists_url":"https://api.github.com/users/brucetrask/gists{/gist_id}","starred_url":"https://api.github.com/users/brucetrask/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brucetrask/subscriptions","organizations_url":"https://api.github.com/users/brucetrask/orgs","repos_url":"https://api.github.com/users/brucetrask/repos","events_url":"https://api.github.com/users/brucetrask/events{/privacy}","received_events_url":"https://api.github.com/users/brucetrask/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-03-15T09:21:48Z","updated_at":"2017-03-16T21:07:02Z","closed_at":null,"body":"* Version of JMockit that was used: \r\n1.29\r\n* Description of the problem:\r\n\r\nI am looking at an interface that has a static method with a body. Something like this contrived example. \r\n\r\npublic interface TestJMockitWithStatic {\r\n\r\n\tpublic static int getInt(String str)\r\n\t{\r\n\t\treturn 1;\r\n\t}\r\n}\r\nIs it possible to mock this? I tried using a MockuUp as follows:\r\npublic class MockTestJMockitWithStatic extends MockUp<TestJMockitWithStatic>{\r\n\r\n\t@Mock\r\n\tint getInt(String str)\r\n\t{\r\n\t\treturn 0;\r\n\t}\r\n}\r\n\r\nbut at runtime I get \r\n\r\njava.lang.IllegalArgumentException: Matching real methods not found for the following mocks:\r\n.test.MockTestJMockitWithStatic#getInt(String)\r\n\r\nThanks,\r\nBruce\r\n\r\n* Please avoid reporting a problem that cannot be reproduced by project members.\r\n  Instead, include enough information (typically, an example test or more, perhaps accompanied by a\r\n  Maven/Ant/Gradle build script) so that other developers can verify the problem in their own environments.\r\n  Otherwise, there is a good chance the issue will be immediately closed with the \"could not reproduce\" tag.\r\n"},"comment":{"url":"https://api.github.com/repos/jmockit/jmockit1/issues/comments/287191152","html_url":"https://github.com/jmockit/jmockit1/issues/401#issuecomment-287191152","issue_url":"https://api.github.com/repos/jmockit/jmockit1/issues/401","id":287191152,"user":{"login":"brucetrask","id":10885119,"avatar_url":"https://avatars0.githubusercontent.com/u/10885119?v=3","gravatar_id":"","url":"https://api.github.com/users/brucetrask","html_url":"https://github.com/brucetrask","followers_url":"https://api.github.com/users/brucetrask/followers","following_url":"https://api.github.com/users/brucetrask/following{/other_user}","gists_url":"https://api.github.com/users/brucetrask/gists{/gist_id}","starred_url":"https://api.github.com/users/brucetrask/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brucetrask/subscriptions","organizations_url":"https://api.github.com/users/brucetrask/orgs","repos_url":"https://api.github.com/users/brucetrask/repos","events_url":"https://api.github.com/users/brucetrask/events{/privacy}","received_events_url":"https://api.github.com/users/brucetrask/received_events","type":"User","site_admin":false},"created_at":"2017-03-16T21:07:02Z","updated_at":"2017-03-16T21:07:02Z","body":"@jbotuck . Thanks but the static function in my interface has an implementation (see my example code above) and therefore should be able to be mocked, correct?"}}
{"actor":{"display_login":"brucetrask"}}