{"action":"created","comment":{"url":"https://api.github.com/repos/mockito/mockito/pulls/comments/74778599","id":74778599,"diff_hunk":"@@ -6,26 +6,73 @@\n \n import org.junit.runner.notification.Failure;\n import org.mockito.internal.exceptions.ExceptionIncludingMockitoWarnings;\n-import org.mockito.internal.util.reflection.Whitebox;\n \n+import java.lang.reflect.Field;\n+\n+@Deprecated\n public class JUnitFailureHacker {\n \n     public void appendWarnings(Failure failure, String warnings) {\n         if (isEmpty(warnings)) {\n             return;\n         }\n         //TODO: this has to protect the use in case jUnit changes and this internal state logic fails\n-        Throwable throwable = (Throwable) Whitebox.getInternalState(failure, \"fThrownException\");\n+        Throwable throwable = (Throwable) getInternalState(failure, \"fThrownException\");\n \n         String newMessage = \"contains both: actual test failure *and* Mockito warnings.\\n\" +\n                 warnings + \"\\n *** The actual failure is because of: ***\\n\";\n \n         ExceptionIncludingMockitoWarnings e = new ExceptionIncludingMockitoWarnings(newMessage, throwable);\n         e.setStackTrace(throwable.getStackTrace());\n-        Whitebox.setInternalState(failure, \"fThrownException\", e);\n+        setInternalState(failure, \"fThrownException\", e);\n     }\n \n     private boolean isEmpty(String warnings) {\n         return warnings == null || \"\".equals(warnings); // isEmpty() is in JDK 6+ \n-    }   \n+    }\n+\n+    private static Object getInternalState(Object target, String field) {\n+        Class<?> c = target.getClass();\n+        try {\n+            Field f = getFieldFromHierarchy(c, field);\n+            f.setAccessible(true);\n+            return f.get(target);\n+        } catch (Exception e) {\n+            throw new RuntimeException(\"Unable to get internal state on a private field. Please report to mockito mailing list.\", e);\n+        }\n+    }\n+\n+    private static void setInternalState(Object target, String field, Object value) {\n+        Class<?> c = target.getClass();\n+        try {\n+            Field f = getFieldFromHierarchy(c, field);\n+            f.setAccessible(true);","path":"src/main/java/org/mockito/internal/util/junit/JUnitFailureHacker.java","position":48,"original_position":48,"commit_id":"0b1b5fee5542002c6489224bc39cba36a2c04544","original_commit_id":"0b1b5fee5542002c6489224bc39cba36a2c04544","user":{"login":"ChristianSchwarz","id":1437411,"avatar_url":"https://avatars.githubusercontent.com/u/1437411?v=3","gravatar_id":"","url":"https://api.github.com/users/ChristianSchwarz","html_url":"https://github.com/ChristianSchwarz","followers_url":"https://api.github.com/users/ChristianSchwarz/followers","following_url":"https://api.github.com/users/ChristianSchwarz/following{/other_user}","gists_url":"https://api.github.com/users/ChristianSchwarz/gists{/gist_id}","starred_url":"https://api.github.com/users/ChristianSchwarz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ChristianSchwarz/subscriptions","organizations_url":"https://api.github.com/users/ChristianSchwarz/orgs","repos_url":"https://api.github.com/users/ChristianSchwarz/repos","events_url":"https://api.github.com/users/ChristianSchwarz/events{/privacy}","received_events_url":"https://api.github.com/users/ChristianSchwarz/received_events","type":"User","site_admin":false},"body":"@TimvdLippe Does it make sense to uses the AccessabilityChanger here?","created_at":"2016-08-15T15:23:21Z","updated_at":"2016-08-15T15:23:21Z","html_url":"https://github.com/mockito/mockito/pull/491#discussion_r74778599","pull_request_url":"https://api.github.com/repos/mockito/mockito/pulls/491","_links":{"self":{"href":"https://api.github.com/repos/mockito/mockito/pulls/comments/74778599"},"html":{"href":"https://github.com/mockito/mockito/pull/491#discussion_r74778599"},"pull_request":{"href":"https://api.github.com/repos/mockito/mockito/pulls/491"}}},"pull_request":{"url":"https://api.github.com/repos/mockito/mockito/pulls/491","id":76882988,"html_url":"https://github.com/mockito/mockito/pull/491","diff_url":"https://github.com/mockito/mockito/pull/491.diff","patch_url":"https://github.com/mockito/mockito/pull/491.patch","issue_url":"https://api.github.com/repos/mockito/mockito/issues/491","number":491,"state":"open","locked":false,"title":"Deprecate whitebox and corresponding verboserunner and junitfailureha…","user":{"login":"TimvdLippe","id":5948271,"avatar_url":"https://avatars.githubusercontent.com/u/5948271?v=3","gravatar_id":"","url":"https://api.github.com/users/TimvdLippe","html_url":"https://github.com/TimvdLippe","followers_url":"https://api.github.com/users/TimvdLippe/followers","following_url":"https://api.github.com/users/TimvdLippe/following{/other_user}","gists_url":"https://api.github.com/users/TimvdLippe/gists{/gist_id}","starred_url":"https://api.github.com/users/TimvdLippe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TimvdLippe/subscriptions","organizations_url":"https://api.github.com/users/TimvdLippe/orgs","repos_url":"https://api.github.com/users/TimvdLippe/repos","events_url":"https://api.github.com/users/TimvdLippe/events{/privacy}","received_events_url":"https://api.github.com/users/TimvdLippe/received_events","type":"User","site_admin":false},"body":"We can't yet remove `Whitebox` as required for #489 , since the public `VerboseMockitoJUnitRunner` is relying on its behavior. A quick google showed that there are almost zero usages of this runner. Moreover it was relying on a very hackish implementation. I think we can do a better job by creating a new runner with JUnit 5 as part of #390. Therefore the intent is to deprecate these classes and remove them in Mockito 3.0.","created_at":"2016-07-10T20:40:22Z","updated_at":"2016-08-15T15:23:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"279199b28f76a96aea5b0a96d6a7915757019664","assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/mockito/mockito/milestones/1","html_url":"https://github.com/mockito/mockito/milestones/2.0","labels_url":"https://api.github.com/repos/mockito/mockito/milestones/1/labels","id":945543,"number":1,"title":"2.0","description":"","creator":{"login":"bric3","id":803621,"avatar_url":"https://avatars.githubusercontent.com/u/803621?v=3","gravatar_id":"","url":"https://api.github.com/users/bric3","html_url":"https://github.com/bric3","followers_url":"https://api.github.com/users/bric3/followers","following_url":"https://api.github.com/users/bric3/following{/other_user}","gists_url":"https://api.github.com/users/bric3/gists{/gist_id}","starred_url":"https://api.github.com/users/bric3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bric3/subscriptions","organizations_url":"https://api.github.com/users/bric3/orgs","repos_url":"https://api.github.com/users/bric3/repos","events_url":"https://api.github.com/users/bric3/events{/privacy}","received_events_url":"https://api.github.com/users/bric3/received_events","type":"User","site_admin":false},"open_issues":10,"closed_issues":29,"state":"open","created_at":"2015-01-21T16:53:47Z","updated_at":"2016-08-14T18:47:11Z","due_on":"2016-08-09T22:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/mockito/mockito/pulls/491/commits","review_comments_url":"https://api.github.com/repos/mockito/mockito/pulls/491/comments","review_comment_url":"https://api.github.com/repos/mockito/mockito/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mockito/mockito/issues/491/comments","statuses_url":"https://api.github.com/repos/mockito/mockito/statuses/0b1b5fee5542002c6489224bc39cba36a2c04544","head":{"label":"mockito:deprecate-whitebox","ref":"deprecate-whitebox","sha":"0b1b5fee5542002c6489224bc39cba36a2c04544","user":{"login":"mockito","id":2054056,"avatar_url":"https://avatars.githubusercontent.com/u/2054056?v=3","gravatar_id":"","url":"https://api.github.com/users/mockito","html_url":"https://github.com/mockito","followers_url":"https://api.github.com/users/mockito/followers","following_url":"https://api.github.com/users/mockito/following{/other_user}","gists_url":"https://api.github.com/users/mockito/gists{/gist_id}","starred_url":"https://api.github.com/users/mockito/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mockito/subscriptions","organizations_url":"https://api.github.com/users/mockito/orgs","repos_url":"https://api.github.com/users/mockito/repos","events_url":"https://api.github.com/users/mockito/events{/privacy}","received_events_url":"https://api.github.com/users/mockito/received_events","type":"Organization","site_admin":false},"repo":{"id":6207167,"name":"mockito","full_name":"mockito/mockito","owner":{"login":"mockito","id":2054056,"avatar_url":"https://avatars.githubusercontent.com/u/2054056?v=3","gravatar_id":"","url":"https://api.github.com/users/mockito","html_url":"https://github.com/mockito","followers_url":"https://api.github.com/users/mockito/followers","following_url":"https://api.github.com/users/mockito/following{/other_user}","gists_url":"https://api.github.com/users/mockito/gists{/gist_id}","starred_url":"https://api.github.com/users/mockito/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mockito/subscriptions","organizations_url":"https://api.github.com/users/mockito/orgs","repos_url":"https://api.github.com/users/mockito/repos","events_url":"https://api.github.com/users/mockito/events{/privacy}","received_events_url":"https://api.github.com/users/mockito/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mockito/mockito","description":"Mocking framework for unit tests written in Java","fork":false,"url":"https://api.github.com/repos/mockito/mockito","forks_url":"https://api.github.com/repos/mockito/mockito/forks","keys_url":"https://api.github.com/repos/mockito/mockito/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mockito/mockito/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mockito/mockito/teams","hooks_url":"https://api.github.com/repos/mockito/mockito/hooks","issue_events_url":"https://api.github.com/repos/mockito/mockito/issues/events{/number}","events_url":"https://api.github.com/repos/mockito/mockito/events","assignees_url":"https://api.github.com/repos/mockito/mockito/assignees{/user}","branches_url":"https://api.github.com/repos/mockito/mockito/branches{/branch}","tags_url":"https://api.github.com/repos/mockito/mockito/tags","blobs_url":"https://api.github.com/repos/mockito/mockito/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mockito/mockito/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mockito/mockito/git/refs{/sha}","trees_url":"https://api.github.com/repos/mockito/mockito/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mockito/mockito/statuses/{sha}","languages_url":"https://api.github.com/repos/mockito/mockito/languages","stargazers_url":"https://api.github.com/repos/mockito/mockito/stargazers","contributors_url":"https://api.github.com/repos/mockito/mockito/contributors","subscribers_url":"https://api.github.com/repos/mockito/mockito/subscribers","subscription_url":"https://api.github.com/repos/mockito/mockito/subscription","commits_url":"https://api.github.com/repos/mockito/mockito/commits{/sha}","git_commits_url":"https://api.github.com/repos/mockito/mockito/git/commits{/sha}","comments_url":"https://api.github.com/repos/mockito/mockito/comments{/number}","issue_comment_url":"https://api.github.com/repos/mockito/mockito/issues/comments{/number}","contents_url":"https://api.github.com/repos/mockito/mockito/contents/{+path}","compare_url":"https://api.github.com/repos/mockito/mockito/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mockito/mockito/merges","archive_url":"https://api.github.com/repos/mockito/mockito/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mockito/mockito/downloads","issues_url":"https://api.github.com/repos/mockito/mockito/issues{/number}","pulls_url":"https://api.github.com/repos/mockito/mockito/pulls{/number}","milestones_url":"https://api.github.com/repos/mockito/mockito/milestones{/number}","notifications_url":"https://api.github.com/repos/mockito/mockito/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mockito/mockito/labels{/name}","releases_url":"https://api.github.com/repos/mockito/mockito/releases{/id}","deployments_url":"https://api.github.com/repos/mockito/mockito/deployments","created_at":"2012-10-13T20:27:12Z","updated_at":"2016-08-15T13:56:46Z","pushed_at":"2016-08-15T14:42:46Z","git_url":"git://github.com/mockito/mockito.git","ssh_url":"git@github.com:mockito/mockito.git","clone_url":"https://github.com/mockito/mockito.git","svn_url":"https://github.com/mockito/mockito","homepage":"http://mockito.org","size":114711,"stargazers_count":2949,"watchers_count":2949,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":604,"mirror_url":null,"open_issues_count":76,"forks":604,"open_issues":76,"watchers":2949,"default_branch":"master"}},"base":{"label":"mockito:master","ref":"master","sha":"4ce9ac2ea38153f4f0c7e272d52fdf9a494ccb14","user":{"login":"mockito","id":2054056,"avatar_url":"https://avatars.githubusercontent.com/u/2054056?v=3","gravatar_id":"","url":"https://api.github.com/users/mockito","html_url":"https://github.com/mockito","followers_url":"https://api.github.com/users/mockito/followers","following_url":"https://api.github.com/users/mockito/following{/other_user}","gists_url":"https://api.github.com/users/mockito/gists{/gist_id}","starred_url":"https://api.github.com/users/mockito/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mockito/subscriptions","organizations_url":"https://api.github.com/users/mockito/orgs","repos_url":"https://api.github.com/users/mockito/repos","events_url":"https://api.github.com/users/mockito/events{/privacy}","received_events_url":"https://api.github.com/users/mockito/received_events","type":"Organization","site_admin":false},"repo":{"id":6207167,"name":"mockito","full_name":"mockito/mockito","owner":{"login":"mockito","id":2054056,"avatar_url":"https://avatars.githubusercontent.com/u/2054056?v=3","gravatar_id":"","url":"https://api.github.com/users/mockito","html_url":"https://github.com/mockito","followers_url":"https://api.github.com/users/mockito/followers","following_url":"https://api.github.com/users/mockito/following{/other_user}","gists_url":"https://api.github.com/users/mockito/gists{/gist_id}","starred_url":"https://api.github.com/users/mockito/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mockito/subscriptions","organizations_url":"https://api.github.com/users/mockito/orgs","repos_url":"https://api.github.com/users/mockito/repos","events_url":"https://api.github.com/users/mockito/events{/privacy}","received_events_url":"https://api.github.com/users/mockito/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mockito/mockito","description":"Mocking framework for unit tests written in Java","fork":false,"url":"https://api.github.com/repos/mockito/mockito","forks_url":"https://api.github.com/repos/mockito/mockito/forks","keys_url":"https://api.github.com/repos/mockito/mockito/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mockito/mockito/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mockito/mockito/teams","hooks_url":"https://api.github.com/repos/mockito/mockito/hooks","issue_events_url":"https://api.github.com/repos/mockito/mockito/issues/events{/number}","events_url":"https://api.github.com/repos/mockito/mockito/events","assignees_url":"https://api.github.com/repos/mockito/mockito/assignees{/user}","branches_url":"https://api.github.com/repos/mockito/mockito/branches{/branch}","tags_url":"https://api.github.com/repos/mockito/mockito/tags","blobs_url":"https://api.github.com/repos/mockito/mockito/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mockito/mockito/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mockito/mockito/git/refs{/sha}","trees_url":"https://api.github.com/repos/mockito/mockito/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mockito/mockito/statuses/{sha}","languages_url":"https://api.github.com/repos/mockito/mockito/languages","stargazers_url":"https://api.github.com/repos/mockito/mockito/stargazers","contributors_url":"https://api.github.com/repos/mockito/mockito/contributors","subscribers_url":"https://api.github.com/repos/mockito/mockito/subscribers","subscription_url":"https://api.github.com/repos/mockito/mockito/subscription","commits_url":"https://api.github.com/repos/mockito/mockito/commits{/sha}","git_commits_url":"https://api.github.com/repos/mockito/mockito/git/commits{/sha}","comments_url":"https://api.github.com/repos/mockito/mockito/comments{/number}","issue_comment_url":"https://api.github.com/repos/mockito/mockito/issues/comments{/number}","contents_url":"https://api.github.com/repos/mockito/mockito/contents/{+path}","compare_url":"https://api.github.com/repos/mockito/mockito/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mockito/mockito/merges","archive_url":"https://api.github.com/repos/mockito/mockito/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mockito/mockito/downloads","issues_url":"https://api.github.com/repos/mockito/mockito/issues{/number}","pulls_url":"https://api.github.com/repos/mockito/mockito/pulls{/number}","milestones_url":"https://api.github.com/repos/mockito/mockito/milestones{/number}","notifications_url":"https://api.github.com/repos/mockito/mockito/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mockito/mockito/labels{/name}","releases_url":"https://api.github.com/repos/mockito/mockito/releases{/id}","deployments_url":"https://api.github.com/repos/mockito/mockito/deployments","created_at":"2012-10-13T20:27:12Z","updated_at":"2016-08-15T13:56:46Z","pushed_at":"2016-08-15T14:42:46Z","git_url":"git://github.com/mockito/mockito.git","ssh_url":"git@github.com:mockito/mockito.git","clone_url":"https://github.com/mockito/mockito.git","svn_url":"https://github.com/mockito/mockito","homepage":"http://mockito.org","size":114711,"stargazers_count":2949,"watchers_count":2949,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":604,"mirror_url":null,"open_issues_count":76,"forks":604,"open_issues":76,"watchers":2949,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mockito/mockito/pulls/491"},"html":{"href":"https://github.com/mockito/mockito/pull/491"},"issue":{"href":"https://api.github.com/repos/mockito/mockito/issues/491"},"comments":{"href":"https://api.github.com/repos/mockito/mockito/issues/491/comments"},"review_comments":{"href":"https://api.github.com/repos/mockito/mockito/pulls/491/comments"},"review_comment":{"href":"https://api.github.com/repos/mockito/mockito/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mockito/mockito/pulls/491/commits"},"statuses":{"href":"https://api.github.com/repos/mockito/mockito/statuses/0b1b5fee5542002c6489224bc39cba36a2c04544"}}}}
{"actor":{"display_login":"ChristianSchwarz"}}