{"action":"created","comment":{"url":"https://api.github.com/repos/zalando/riptide/pulls/comments/75315250","id":75315250,"diff_hunk":"@@ -0,0 +1,128 @@\n+package org.zalando.riptide.tryit;\n+\n+/*\n+ * ⁣​\n+ * Riptide: Core\n+ * ⁣⁣\n+ * Copyright (C) 2015 - 2016 Zalando SE\n+ * ⁣⁣\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ * \n+ *      http://www.apache.org/licenses/LICENSE-2.0\n+ * \n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ * ​⁣\n+ */\n+\n+import static org.hamcrest.Matchers.equalTo;\n+import static org.hamcrest.Matchers.instanceOf;\n+import static org.hamcrest.Matchers.is;\n+import static org.junit.Assert.assertThat;\n+import static org.mockito.Mockito.doNothing;\n+import static org.mockito.Mockito.doReturn;\n+import static org.mockito.Mockito.doThrow;\n+import static org.mockito.Mockito.mock;\n+import static org.mockito.Mockito.verify;\n+import static org.zalando.riptide.tryit.TryEnsure.ensureIOException;\n+\n+import java.io.IOException;\n+import java.nio.charset.CharacterCodingException;\n+\n+import org.junit.Rule;\n+import org.junit.Test;\n+import org.junit.rules.ExpectedException;\n+import org.zalando.riptide.ThrowingRunnable;\n+import org.zalando.riptide.ThrowingSupplier;\n+\n+public class TryEnsureTest {\n+\n+    private static final Object VALUE = new Object();\n+    @Rule\n+    public final ExpectedException exception = ExpectedException.none();\n+\n+    @Test\n+    public void runnableShouldRun() throws Exception {\n+        ThrowingRunnable runnable = mock(ThrowingRunnable.class);\n+\n+        doNothing().when(runnable).run();\n+\n+        ensureIOException(runnable);\n+\n+        verify(runnable).run();\n+    }\n+\n+    @Test\n+    public void runnableShouldCastException() throws Exception {\n+        this.exception.expect(IOException.class);\n+        this.exception.expectCause(instanceOf(Exception.class));\n+\n+        ThrowingRunnable runnable = mock(ThrowingRunnable.class);\n+\n+        doThrow(new Exception()).when(runnable).run();\n+        try {\n+            ensureIOException(runnable);\n+        } finally {\n+            verify(runnable).run();","path":"riptide-core/src/test/java/org/zalando/riptide/tryit/TryEnsureTest.java","position":71,"original_position":71,"commit_id":"cae975bfc891f808d0a44fd932dfdb92314ee48b","original_commit_id":"cae975bfc891f808d0a44fd932dfdb92314ee48b","user":{"login":"whiskeysierra","id":429981,"avatar_url":"https://avatars.githubusercontent.com/u/429981?v=3","gravatar_id":"","url":"https://api.github.com/users/whiskeysierra","html_url":"https://github.com/whiskeysierra","followers_url":"https://api.github.com/users/whiskeysierra/followers","following_url":"https://api.github.com/users/whiskeysierra/following{/other_user}","gists_url":"https://api.github.com/users/whiskeysierra/gists{/gist_id}","starred_url":"https://api.github.com/users/whiskeysierra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/whiskeysierra/subscriptions","organizations_url":"https://api.github.com/users/whiskeysierra/orgs","repos_url":"https://api.github.com/users/whiskeysierra/repos","events_url":"https://api.github.com/users/whiskeysierra/events{/privacy}","received_events_url":"https://api.github.com/users/whiskeysierra/received_events","type":"User","site_admin":false},"body":"If nobody would call it there would be no exception. And since we're checking for the exception already... ","created_at":"2016-08-18T14:15:01Z","updated_at":"2016-08-18T14:15:01Z","html_url":"https://github.com/zalando/riptide/pull/148#discussion_r75315250","pull_request_url":"https://api.github.com/repos/zalando/riptide/pulls/148","_links":{"self":{"href":"https://api.github.com/repos/zalando/riptide/pulls/comments/75315250"},"html":{"href":"https://github.com/zalando/riptide/pull/148#discussion_r75315250"},"pull_request":{"href":"https://api.github.com/repos/zalando/riptide/pulls/148"}}},"pull_request":{"url":"https://api.github.com/repos/zalando/riptide/pulls/148","id":81778762,"html_url":"https://github.com/zalando/riptide/pull/148","diff_url":"https://github.com/zalando/riptide/pull/148.diff","patch_url":"https://github.com/zalando/riptide/pull/148.patch","issue_url":"https://api.github.com/repos/zalando/riptide/issues/148","number":148,"state":"open","locked":false,"title":"Core improvements and bug-fixes for nakadi stream support","user":{"login":"tkrop","id":18184975,"avatar_url":"https://avatars.githubusercontent.com/u/18184975?v=3","gravatar_id":"","url":"https://api.github.com/users/tkrop","html_url":"https://github.com/tkrop","followers_url":"https://api.github.com/users/tkrop/followers","following_url":"https://api.github.com/users/tkrop/following{/other_user}","gists_url":"https://api.github.com/users/tkrop/gists{/gist_id}","starred_url":"https://api.github.com/users/tkrop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tkrop/subscriptions","organizations_url":"https://api.github.com/users/tkrop/orgs","repos_url":"https://api.github.com/users/tkrop/repos","events_url":"https://api.github.com/users/tkrop/events{/privacy}","received_events_url":"https://api.github.com/users/tkrop/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-08-18T08:51:20Z","updated_at":"2016-08-18T14:15:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7fae417204eaf12d9eb2326e0c32b238cd80fc9e","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/zalando/riptide/pulls/148/commits","review_comments_url":"https://api.github.com/repos/zalando/riptide/pulls/148/comments","review_comment_url":"https://api.github.com/repos/zalando/riptide/pulls/comments{/number}","comments_url":"https://api.github.com/repos/zalando/riptide/issues/148/comments","statuses_url":"https://api.github.com/repos/zalando/riptide/statuses/cae975bfc891f808d0a44fd932dfdb92314ee48b","head":{"label":"zalando:feature/improvements-for-nakadi-stream-support","ref":"feature/improvements-for-nakadi-stream-support","sha":"cae975bfc891f808d0a44fd932dfdb92314ee48b","user":{"login":"zalando","id":1564818,"avatar_url":"https://avatars.githubusercontent.com/u/1564818?v=3","gravatar_id":"","url":"https://api.github.com/users/zalando","html_url":"https://github.com/zalando","followers_url":"https://api.github.com/users/zalando/followers","following_url":"https://api.github.com/users/zalando/following{/other_user}","gists_url":"https://api.github.com/users/zalando/gists{/gist_id}","starred_url":"https://api.github.com/users/zalando/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zalando/subscriptions","organizations_url":"https://api.github.com/users/zalando/orgs","repos_url":"https://api.github.com/users/zalando/repos","events_url":"https://api.github.com/users/zalando/events{/privacy}","received_events_url":"https://api.github.com/users/zalando/received_events","type":"Organization","site_admin":false},"repo":{"id":33559545,"name":"riptide","full_name":"zalando/riptide","owner":{"login":"zalando","id":1564818,"avatar_url":"https://avatars.githubusercontent.com/u/1564818?v=3","gravatar_id":"","url":"https://api.github.com/users/zalando","html_url":"https://github.com/zalando","followers_url":"https://api.github.com/users/zalando/followers","following_url":"https://api.github.com/users/zalando/following{/other_user}","gists_url":"https://api.github.com/users/zalando/gists{/gist_id}","starred_url":"https://api.github.com/users/zalando/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zalando/subscriptions","organizations_url":"https://api.github.com/users/zalando/orgs","repos_url":"https://api.github.com/users/zalando/repos","events_url":"https://api.github.com/users/zalando/events{/privacy}","received_events_url":"https://api.github.com/users/zalando/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/zalando/riptide","description":"Client-side response routing for Spring's RestTemplate","fork":false,"url":"https://api.github.com/repos/zalando/riptide","forks_url":"https://api.github.com/repos/zalando/riptide/forks","keys_url":"https://api.github.com/repos/zalando/riptide/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zalando/riptide/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zalando/riptide/teams","hooks_url":"https://api.github.com/repos/zalando/riptide/hooks","issue_events_url":"https://api.github.com/repos/zalando/riptide/issues/events{/number}","events_url":"https://api.github.com/repos/zalando/riptide/events","assignees_url":"https://api.github.com/repos/zalando/riptide/assignees{/user}","branches_url":"https://api.github.com/repos/zalando/riptide/branches{/branch}","tags_url":"https://api.github.com/repos/zalando/riptide/tags","blobs_url":"https://api.github.com/repos/zalando/riptide/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zalando/riptide/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zalando/riptide/git/refs{/sha}","trees_url":"https://api.github.com/repos/zalando/riptide/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zalando/riptide/statuses/{sha}","languages_url":"https://api.github.com/repos/zalando/riptide/languages","stargazers_url":"https://api.github.com/repos/zalando/riptide/stargazers","contributors_url":"https://api.github.com/repos/zalando/riptide/contributors","subscribers_url":"https://api.github.com/repos/zalando/riptide/subscribers","subscription_url":"https://api.github.com/repos/zalando/riptide/subscription","commits_url":"https://api.github.com/repos/zalando/riptide/commits{/sha}","git_commits_url":"https://api.github.com/repos/zalando/riptide/git/commits{/sha}","comments_url":"https://api.github.com/repos/zalando/riptide/comments{/number}","issue_comment_url":"https://api.github.com/repos/zalando/riptide/issues/comments{/number}","contents_url":"https://api.github.com/repos/zalando/riptide/contents/{+path}","compare_url":"https://api.github.com/repos/zalando/riptide/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zalando/riptide/merges","archive_url":"https://api.github.com/repos/zalando/riptide/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zalando/riptide/downloads","issues_url":"https://api.github.com/repos/zalando/riptide/issues{/number}","pulls_url":"https://api.github.com/repos/zalando/riptide/pulls{/number}","milestones_url":"https://api.github.com/repos/zalando/riptide/milestones{/number}","notifications_url":"https://api.github.com/repos/zalando/riptide/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zalando/riptide/labels{/name}","releases_url":"https://api.github.com/repos/zalando/riptide/releases{/id}","deployments_url":"https://api.github.com/repos/zalando/riptide/deployments","created_at":"2015-04-07T18:03:31Z","updated_at":"2016-08-09T17:48:45Z","pushed_at":"2016-08-18T12:25:46Z","git_url":"git://github.com/zalando/riptide.git","ssh_url":"git@github.com:zalando/riptide.git","clone_url":"https://github.com/zalando/riptide.git","svn_url":"https://github.com/zalando/riptide","homepage":"","size":1371,"stargazers_count":18,"watchers_count":18,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":14,"forks":3,"open_issues":14,"watchers":18,"default_branch":"release/2.0.0"}},"base":{"label":"zalando:release/2.0.0","ref":"release/2.0.0","sha":"a9831f846d1c3d43ad3257231c3d2e5adcd92a65","user":{"login":"zalando","id":1564818,"avatar_url":"https://avatars.githubusercontent.com/u/1564818?v=3","gravatar_id":"","url":"https://api.github.com/users/zalando","html_url":"https://github.com/zalando","followers_url":"https://api.github.com/users/zalando/followers","following_url":"https://api.github.com/users/zalando/following{/other_user}","gists_url":"https://api.github.com/users/zalando/gists{/gist_id}","starred_url":"https://api.github.com/users/zalando/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zalando/subscriptions","organizations_url":"https://api.github.com/users/zalando/orgs","repos_url":"https://api.github.com/users/zalando/repos","events_url":"https://api.github.com/users/zalando/events{/privacy}","received_events_url":"https://api.github.com/users/zalando/received_events","type":"Organization","site_admin":false},"repo":{"id":33559545,"name":"riptide","full_name":"zalando/riptide","owner":{"login":"zalando","id":1564818,"avatar_url":"https://avatars.githubusercontent.com/u/1564818?v=3","gravatar_id":"","url":"https://api.github.com/users/zalando","html_url":"https://github.com/zalando","followers_url":"https://api.github.com/users/zalando/followers","following_url":"https://api.github.com/users/zalando/following{/other_user}","gists_url":"https://api.github.com/users/zalando/gists{/gist_id}","starred_url":"https://api.github.com/users/zalando/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zalando/subscriptions","organizations_url":"https://api.github.com/users/zalando/orgs","repos_url":"https://api.github.com/users/zalando/repos","events_url":"https://api.github.com/users/zalando/events{/privacy}","received_events_url":"https://api.github.com/users/zalando/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/zalando/riptide","description":"Client-side response routing for Spring's RestTemplate","fork":false,"url":"https://api.github.com/repos/zalando/riptide","forks_url":"https://api.github.com/repos/zalando/riptide/forks","keys_url":"https://api.github.com/repos/zalando/riptide/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zalando/riptide/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zalando/riptide/teams","hooks_url":"https://api.github.com/repos/zalando/riptide/hooks","issue_events_url":"https://api.github.com/repos/zalando/riptide/issues/events{/number}","events_url":"https://api.github.com/repos/zalando/riptide/events","assignees_url":"https://api.github.com/repos/zalando/riptide/assignees{/user}","branches_url":"https://api.github.com/repos/zalando/riptide/branches{/branch}","tags_url":"https://api.github.com/repos/zalando/riptide/tags","blobs_url":"https://api.github.com/repos/zalando/riptide/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zalando/riptide/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zalando/riptide/git/refs{/sha}","trees_url":"https://api.github.com/repos/zalando/riptide/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zalando/riptide/statuses/{sha}","languages_url":"https://api.github.com/repos/zalando/riptide/languages","stargazers_url":"https://api.github.com/repos/zalando/riptide/stargazers","contributors_url":"https://api.github.com/repos/zalando/riptide/contributors","subscribers_url":"https://api.github.com/repos/zalando/riptide/subscribers","subscription_url":"https://api.github.com/repos/zalando/riptide/subscription","commits_url":"https://api.github.com/repos/zalando/riptide/commits{/sha}","git_commits_url":"https://api.github.com/repos/zalando/riptide/git/commits{/sha}","comments_url":"https://api.github.com/repos/zalando/riptide/comments{/number}","issue_comment_url":"https://api.github.com/repos/zalando/riptide/issues/comments{/number}","contents_url":"https://api.github.com/repos/zalando/riptide/contents/{+path}","compare_url":"https://api.github.com/repos/zalando/riptide/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zalando/riptide/merges","archive_url":"https://api.github.com/repos/zalando/riptide/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zalando/riptide/downloads","issues_url":"https://api.github.com/repos/zalando/riptide/issues{/number}","pulls_url":"https://api.github.com/repos/zalando/riptide/pulls{/number}","milestones_url":"https://api.github.com/repos/zalando/riptide/milestones{/number}","notifications_url":"https://api.github.com/repos/zalando/riptide/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zalando/riptide/labels{/name}","releases_url":"https://api.github.com/repos/zalando/riptide/releases{/id}","deployments_url":"https://api.github.com/repos/zalando/riptide/deployments","created_at":"2015-04-07T18:03:31Z","updated_at":"2016-08-09T17:48:45Z","pushed_at":"2016-08-18T12:25:46Z","git_url":"git://github.com/zalando/riptide.git","ssh_url":"git@github.com:zalando/riptide.git","clone_url":"https://github.com/zalando/riptide.git","svn_url":"https://github.com/zalando/riptide","homepage":"","size":1371,"stargazers_count":18,"watchers_count":18,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":14,"forks":3,"open_issues":14,"watchers":18,"default_branch":"release/2.0.0"}},"_links":{"self":{"href":"https://api.github.com/repos/zalando/riptide/pulls/148"},"html":{"href":"https://github.com/zalando/riptide/pull/148"},"issue":{"href":"https://api.github.com/repos/zalando/riptide/issues/148"},"comments":{"href":"https://api.github.com/repos/zalando/riptide/issues/148/comments"},"review_comments":{"href":"https://api.github.com/repos/zalando/riptide/pulls/148/comments"},"review_comment":{"href":"https://api.github.com/repos/zalando/riptide/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/zalando/riptide/pulls/148/commits"},"statuses":{"href":"https://api.github.com/repos/zalando/riptide/statuses/cae975bfc891f808d0a44fd932dfdb92314ee48b"}}}}
{"actor":{"display_login":"whiskeysierra"}}