{"action":"created","comment":{"url":"https://api.github.com/repos/java-course-au/assignments-2/pulls/comments/56977476","id":56977476,"diff_hunk":"@@ -0,0 +1,57 @@\n+package ru.spbau.mit;\n+\n+import org.junit.rules.TestRule;\n+import org.junit.runner.Description;\n+import org.junit.runners.model.Statement;\n+\n+import java.util.ArrayList;\n+import java.util.List;\n+\n+import static org.junit.Assert.*;\n+\n+public class ThreadExpectedException implements TestRule {\n+    private Class<? extends Throwable> expectedException = null;\n+    private final List<Thread> threads = new ArrayList<>();\n+    private final List<Throwable> thrown = new ArrayList<>();\n+\n+    public ThreadExpectedException() {\n+    }\n+\n+    public void expect(Class<? extends Throwable> e) {\n+        expectedException = e;\n+    }\n+\n+    public void registerThread(Thread t) {\n+        threads.add(t);\n+        thrown.add(null);\n+        final int id = thrown.size() - 1;\n+        t.setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {\n+            @Override\n+            public void uncaughtException(Thread t, Throwable e) {\n+                thrown.set(id, e);\n+            }\n+        });\n+    }\n+\n+    @Override\n+    public Statement apply(Statement statement, Description description) {\n+        return new Statement() {\n+            @Override\n+            public void evaluate() throws Throwable {\n+                try {\n+                    statement.evaluate();\n+                } catch (Exception e) {\n+                    // ignore\n+                }\n+                for (Thread t : threads) {\n+                    assertEquals(Thread.State.TERMINATED, t.getState());\n+                }\n+                if (expectedException != null) {\n+                    for (Throwable t : thrown) {","path":"src/main/java/ru/spbau/mit/ThreadExpectedException.java","position":50,"original_position":50,"commit_id":"ee0cd9eda3f0aea55d2bd12dd5100965bc5373cd","original_commit_id":"ee0cd9eda3f0aea55d2bd12dd5100965bc5373cd","user":{"login":"dzharkov","id":863207,"avatar_url":"https://avatars.githubusercontent.com/u/863207?v=3","gravatar_id":"","url":"https://api.github.com/users/dzharkov","html_url":"https://github.com/dzharkov","followers_url":"https://api.github.com/users/dzharkov/followers","following_url":"https://api.github.com/users/dzharkov/following{/other_user}","gists_url":"https://api.github.com/users/dzharkov/gists{/gist_id}","starred_url":"https://api.github.com/users/dzharkov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dzharkov/subscriptions","organizations_url":"https://api.github.com/users/dzharkov/orgs","repos_url":"https://api.github.com/users/dzharkov/repos","events_url":"https://api.github.com/users/dzharkov/events{/privacy}","received_events_url":"https://api.github.com/users/dzharkov/received_events","type":"User","site_admin":false},"body":"**Все** потоки должны завершиться с таким исключением","created_at":"2016-03-22T12:29:02Z","updated_at":"2016-03-22T12:29:02Z","html_url":"https://github.com/java-course-au/assignments-2/pull/47#discussion_r56977476","pull_request_url":"https://api.github.com/repos/java-course-au/assignments-2/pulls/47","_links":{"self":{"href":"https://api.github.com/repos/java-course-au/assignments-2/pulls/comments/56977476"},"html":{"href":"https://github.com/java-course-au/assignments-2/pull/47#discussion_r56977476"},"pull_request":{"href":"https://api.github.com/repos/java-course-au/assignments-2/pulls/47"}}},"pull_request":{"url":"https://api.github.com/repos/java-course-au/assignments-2/pulls/47","id":63493882,"html_url":"https://github.com/java-course-au/assignments-2/pull/47","diff_url":"https://github.com/java-course-au/assignments-2/pull/47.diff","patch_url":"https://github.com/java-course-au/assignments-2/pull/47.patch","issue_url":"https://api.github.com/repos/java-course-au/assignments-2/issues/47","number":47,"state":"open","locked":false,"title":"Java02. ДЗ 04, Суворов Егор, подгруппа 1","user":{"login":"yeputons","id":1297325,"avatar_url":"https://avatars.githubusercontent.com/u/1297325?v=3","gravatar_id":"","url":"https://api.github.com/users/yeputons","html_url":"https://github.com/yeputons","followers_url":"https://api.github.com/users/yeputons/followers","following_url":"https://api.github.com/users/yeputons/following{/other_user}","gists_url":"https://api.github.com/users/yeputons/gists{/gist_id}","starred_url":"https://api.github.com/users/yeputons/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yeputons/subscriptions","organizations_url":"https://api.github.com/users/yeputons/orgs","repos_url":"https://api.github.com/users/yeputons/repos","events_url":"https://api.github.com/users/yeputons/events{/privacy}","received_events_url":"https://api.github.com/users/yeputons/received_events","type":"User","site_admin":false},"body":"@dzharkov ","created_at":"2016-03-20T12:14:29Z","updated_at":"2016-03-22T12:29:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c9d6d76535f6722dab2144553e35d3ef3620769e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/java-course-au/assignments-2/pulls/47/commits","review_comments_url":"https://api.github.com/repos/java-course-au/assignments-2/pulls/47/comments","review_comment_url":"https://api.github.com/repos/java-course-au/assignments-2/pulls/comments{/number}","comments_url":"https://api.github.com/repos/java-course-au/assignments-2/issues/47/comments","statuses_url":"https://api.github.com/repos/java-course-au/assignments-2/statuses/ee0cd9eda3f0aea55d2bd12dd5100965bc5373cd","head":{"label":"yeputons:04-test-rule","ref":"04-test-rule","sha":"ee0cd9eda3f0aea55d2bd12dd5100965bc5373cd","user":{"login":"yeputons","id":1297325,"avatar_url":"https://avatars.githubusercontent.com/u/1297325?v=3","gravatar_id":"","url":"https://api.github.com/users/yeputons","html_url":"https://github.com/yeputons","followers_url":"https://api.github.com/users/yeputons/followers","following_url":"https://api.github.com/users/yeputons/following{/other_user}","gists_url":"https://api.github.com/users/yeputons/gists{/gist_id}","starred_url":"https://api.github.com/users/yeputons/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yeputons/subscriptions","organizations_url":"https://api.github.com/users/yeputons/orgs","repos_url":"https://api.github.com/users/yeputons/repos","events_url":"https://api.github.com/users/yeputons/events{/privacy}","received_events_url":"https://api.github.com/users/yeputons/received_events","type":"User","site_admin":false},"repo":{"id":51993999,"name":"spbau-java-course-assignments-term4","full_name":"yeputons/spbau-java-course-assignments-term4","owner":{"login":"yeputons","id":1297325,"avatar_url":"https://avatars.githubusercontent.com/u/1297325?v=3","gravatar_id":"","url":"https://api.github.com/users/yeputons","html_url":"https://github.com/yeputons","followers_url":"https://api.github.com/users/yeputons/followers","following_url":"https://api.github.com/users/yeputons/following{/other_user}","gists_url":"https://api.github.com/users/yeputons/gists{/gist_id}","starred_url":"https://api.github.com/users/yeputons/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yeputons/subscriptions","organizations_url":"https://api.github.com/users/yeputons/orgs","repos_url":"https://api.github.com/users/yeputons/repos","events_url":"https://api.github.com/users/yeputons/events{/privacy}","received_events_url":"https://api.github.com/users/yeputons/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/yeputons/spbau-java-course-assignments-term4","description":"","fork":true,"url":"https://api.github.com/repos/yeputons/spbau-java-course-assignments-term4","forks_url":"https://api.github.com/repos/yeputons/spbau-java-course-assignments-term4/forks","keys_url":"https://api.github.com/repos/yeputons/spbau-java-course-assignments-term4/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yeputons/spbau-java-course-assignments-term4/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yeputons/spbau-java-course-assignments-term4/teams","hooks_url":"https://api.github.com/repos/yeputons/spbau-java-course-assignments-term4/hooks","issue_events_url":"https://api.github.com/repos/yeputons/spbau-java-course-assignments-term4/issues/events{/number}","events_url":"https://api.github.com/repos/yeputons/spbau-java-course-assignments-term4/events","assignees_url":"https://api.github.com/repos/yeputons/spbau-java-course-assignments-term4/assignees{/user}","branches_url":"https://api.github.com/repos/yeputons/spbau-java-course-assignments-term4/branches{/branch}","tags_url":"https://api.github.com/repos/yeputons/spbau-java-course-assignments-term4/tags","blobs_url":"https://api.github.com/repos/yeputons/spbau-java-course-assignments-term4/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yeputons/spbau-java-course-assignments-term4/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yeputons/spbau-java-course-assignments-term4/git/refs{/sha}","trees_url":"https://api.github.com/repos/yeputons/spbau-java-course-assignments-term4/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yeputons/spbau-java-course-assignments-term4/statuses/{sha}","languages_url":"https://api.github.com/repos/yeputons/spbau-java-course-assignments-term4/languages","stargazers_url":"https://api.github.com/repos/yeputons/spbau-java-course-assignments-term4/stargazers","contributors_url":"https://api.github.com/repos/yeputons/spbau-java-course-assignments-term4/contributors","subscribers_url":"https://api.github.com/repos/yeputons/spbau-java-course-assignments-term4/subscribers","subscription_url":"https://api.github.com/repos/yeputons/spbau-java-course-assignments-term4/subscription","commits_url":"https://api.github.com/repos/yeputons/spbau-java-course-assignments-term4/commits{/sha}","git_commits_url":"https://api.github.com/repos/yeputons/spbau-java-course-assignments-term4/git/commits{/sha}","comments_url":"https://api.github.com/repos/yeputons/spbau-java-course-assignments-term4/comments{/number}","issue_comment_url":"https://api.github.com/repos/yeputons/spbau-java-course-assignments-term4/issues/comments{/number}","contents_url":"https://api.github.com/repos/yeputons/spbau-java-course-assignments-term4/contents/{+path}","compare_url":"https://api.github.com/repos/yeputons/spbau-java-course-assignments-term4/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yeputons/spbau-java-course-assignments-term4/merges","archive_url":"https://api.github.com/repos/yeputons/spbau-java-course-assignments-term4/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yeputons/spbau-java-course-assignments-term4/downloads","issues_url":"https://api.github.com/repos/yeputons/spbau-java-course-assignments-term4/issues{/number}","pulls_url":"https://api.github.com/repos/yeputons/spbau-java-course-assignments-term4/pulls{/number}","milestones_url":"https://api.github.com/repos/yeputons/spbau-java-course-assignments-term4/milestones{/number}","notifications_url":"https://api.github.com/repos/yeputons/spbau-java-course-assignments-term4/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yeputons/spbau-java-course-assignments-term4/labels{/name}","releases_url":"https://api.github.com/repos/yeputons/spbau-java-course-assignments-term4/releases{/id}","deployments_url":"https://api.github.com/repos/yeputons/spbau-java-course-assignments-term4/deployments","created_at":"2016-02-18T08:59:44Z","updated_at":"2016-02-18T08:59:51Z","pushed_at":"2016-03-20T12:13:43Z","git_url":"git://github.com/yeputons/spbau-java-course-assignments-term4.git","ssh_url":"git@github.com:yeputons/spbau-java-course-assignments-term4.git","clone_url":"https://github.com/yeputons/spbau-java-course-assignments-term4.git","svn_url":"https://github.com/yeputons/spbau-java-course-assignments-term4","homepage":null,"size":87,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"java-course-au:master","ref":"master","sha":"a343da032205961726de4f3c67c9c43b3436ebb9","user":{"login":"java-course-au","id":14248092,"avatar_url":"https://avatars.githubusercontent.com/u/14248092?v=3","gravatar_id":"","url":"https://api.github.com/users/java-course-au","html_url":"https://github.com/java-course-au","followers_url":"https://api.github.com/users/java-course-au/followers","following_url":"https://api.github.com/users/java-course-au/following{/other_user}","gists_url":"https://api.github.com/users/java-course-au/gists{/gist_id}","starred_url":"https://api.github.com/users/java-course-au/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/java-course-au/subscriptions","organizations_url":"https://api.github.com/users/java-course-au/orgs","repos_url":"https://api.github.com/users/java-course-au/repos","events_url":"https://api.github.com/users/java-course-au/events{/privacy}","received_events_url":"https://api.github.com/users/java-course-au/received_events","type":"Organization","site_admin":false},"repo":{"id":51697606,"name":"assignments-2","full_name":"java-course-au/assignments-2","owner":{"login":"java-course-au","id":14248092,"avatar_url":"https://avatars.githubusercontent.com/u/14248092?v=3","gravatar_id":"","url":"https://api.github.com/users/java-course-au","html_url":"https://github.com/java-course-au","followers_url":"https://api.github.com/users/java-course-au/followers","following_url":"https://api.github.com/users/java-course-au/following{/other_user}","gists_url":"https://api.github.com/users/java-course-au/gists{/gist_id}","starred_url":"https://api.github.com/users/java-course-au/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/java-course-au/subscriptions","organizations_url":"https://api.github.com/users/java-course-au/orgs","repos_url":"https://api.github.com/users/java-course-au/repos","events_url":"https://api.github.com/users/java-course-au/events{/privacy}","received_events_url":"https://api.github.com/users/java-course-au/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/java-course-au/assignments-2","description":"","fork":false,"url":"https://api.github.com/repos/java-course-au/assignments-2","forks_url":"https://api.github.com/repos/java-course-au/assignments-2/forks","keys_url":"https://api.github.com/repos/java-course-au/assignments-2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/java-course-au/assignments-2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/java-course-au/assignments-2/teams","hooks_url":"https://api.github.com/repos/java-course-au/assignments-2/hooks","issue_events_url":"https://api.github.com/repos/java-course-au/assignments-2/issues/events{/number}","events_url":"https://api.github.com/repos/java-course-au/assignments-2/events","assignees_url":"https://api.github.com/repos/java-course-au/assignments-2/assignees{/user}","branches_url":"https://api.github.com/repos/java-course-au/assignments-2/branches{/branch}","tags_url":"https://api.github.com/repos/java-course-au/assignments-2/tags","blobs_url":"https://api.github.com/repos/java-course-au/assignments-2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/java-course-au/assignments-2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/java-course-au/assignments-2/git/refs{/sha}","trees_url":"https://api.github.com/repos/java-course-au/assignments-2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/java-course-au/assignments-2/statuses/{sha}","languages_url":"https://api.github.com/repos/java-course-au/assignments-2/languages","stargazers_url":"https://api.github.com/repos/java-course-au/assignments-2/stargazers","contributors_url":"https://api.github.com/repos/java-course-au/assignments-2/contributors","subscribers_url":"https://api.github.com/repos/java-course-au/assignments-2/subscribers","subscription_url":"https://api.github.com/repos/java-course-au/assignments-2/subscription","commits_url":"https://api.github.com/repos/java-course-au/assignments-2/commits{/sha}","git_commits_url":"https://api.github.com/repos/java-course-au/assignments-2/git/commits{/sha}","comments_url":"https://api.github.com/repos/java-course-au/assignments-2/comments{/number}","issue_comment_url":"https://api.github.com/repos/java-course-au/assignments-2/issues/comments{/number}","contents_url":"https://api.github.com/repos/java-course-au/assignments-2/contents/{+path}","compare_url":"https://api.github.com/repos/java-course-au/assignments-2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/java-course-au/assignments-2/merges","archive_url":"https://api.github.com/repos/java-course-au/assignments-2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/java-course-au/assignments-2/downloads","issues_url":"https://api.github.com/repos/java-course-au/assignments-2/issues{/number}","pulls_url":"https://api.github.com/repos/java-course-au/assignments-2/pulls{/number}","milestones_url":"https://api.github.com/repos/java-course-au/assignments-2/milestones{/number}","notifications_url":"https://api.github.com/repos/java-course-au/assignments-2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/java-course-au/assignments-2/labels{/name}","releases_url":"https://api.github.com/repos/java-course-au/assignments-2/releases{/id}","deployments_url":"https://api.github.com/repos/java-course-au/assignments-2/deployments","created_at":"2016-02-14T14:22:46Z","updated_at":"2016-02-14T14:52:34Z","pushed_at":"2016-03-22T12:15:55Z","git_url":"git://github.com/java-course-au/assignments-2.git","ssh_url":"git@github.com:java-course-au/assignments-2.git","clone_url":"https://github.com/java-course-au/assignments-2.git","svn_url":"https://github.com/java-course-au/assignments-2","homepage":null,"size":397,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":15,"mirror_url":null,"open_issues_count":16,"forks":15,"open_issues":16,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/java-course-au/assignments-2/pulls/47"},"html":{"href":"https://github.com/java-course-au/assignments-2/pull/47"},"issue":{"href":"https://api.github.com/repos/java-course-au/assignments-2/issues/47"},"comments":{"href":"https://api.github.com/repos/java-course-au/assignments-2/issues/47/comments"},"review_comments":{"href":"https://api.github.com/repos/java-course-au/assignments-2/pulls/47/comments"},"review_comment":{"href":"https://api.github.com/repos/java-course-au/assignments-2/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/java-course-au/assignments-2/pulls/47/commits"},"statuses":{"href":"https://api.github.com/repos/java-course-au/assignments-2/statuses/ee0cd9eda3f0aea55d2bd12dd5100965bc5373cd"}}}}