{"action":"created","comment":{"url":"https://api.github.com/repos/yegor256/takes/pulls/comments/54979488","id":54979488,"diff_hunk":"@@ -0,0 +1,82 @@\n+/**\n+ * The MIT License (MIT)\n+ *\n+ * Copyright (c) 2015 Yegor Bugayenko\n+ *\n+ * Permission is hereby granted, free of charge, to any person obtaining a copy\n+ * of this software and associated documentation files (the \"Software\"), to deal\n+ * in the Software without restriction, including without limitation the rights\n+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n+ * copies of the Software, and to permit persons to whom the Software is\n+ * furnished to do so, subject to the following conditions:\n+ *\n+ * The above copyright notice and this permission notice shall be included\n+ * in all copies or substantial portions of the Software.\n+ *\n+ * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE\n+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n+ * SOFTWARE.\n+ */\n+package org.takes.facets.fork;\n+\n+import com.google.common.base.Joiner;\n+import org.hamcrest.MatcherAssert;\n+import org.hamcrest.Matchers;\n+import org.junit.Test;\n+import org.takes.rq.RqFake;\n+import org.takes.rs.RsPrint;\n+\n+/**\n+ * Test case for {@link FkChain}.\n+ * @author Carlos Gines (efrel.v2@gmail.com)\n+ * @version $Id$\n+ * @since 0.33\n+ */\n+public final class FkChainTest {\n+\n+    /**\n+     * FkChain can gracefully work when no fork matches the request.\n+     * @throws Exception If some problem inside\n+     */\n+    @Test\n+    public void gracefullyHandlesNoForkMatching() throws Exception {\n+        MatcherAssert.assertThat(\n+            new FkChain(\n+                new FkRegex(\"/doyoumatch?\", \"Hello. It's me.\"),\n+                new FkRegex(\"/plzmatch!\", \"I am your father\")\n+            ).route(new RqFake(\"POST\", \"/idontmatch\")).has(),\n+            Matchers.equalTo(false)\n+        );\n+    }\n+\n+    /**\n+     * FkChain can dispatch by regular expression.\n+     * @throws Exception If some problem inside\n+     */\n+    @Test\n+    public void dispatchesByRegularExpression() throws Exception {\n+        final String body = \"hello test!\";\n+        MatcherAssert.assertThat(\n+            new RsPrint(\n+                new FkChain(\n+                    new FkRegex(\"/g[a-z]{2}\", \"\"),\n+                    new FkRegex(\"/h[a-z]{2}\", body),\n+                    new FkRegex(\"/i[a-z]{2}\", \"\")\n+                ).route(new RqFake(\"GET\", \"/hey?yu\")).get()","path":"src/test/java/org/takes/facets/fork/FkChainTest.java","position":69,"original_position":69,"commit_id":"d77cf5c78460c7db339b44dcebc36a2cc9c79561","original_commit_id":"d77cf5c78460c7db339b44dcebc36a2cc9c79561","user":{"login":"CarlosGines","id":16798121,"avatar_url":"https://avatars.githubusercontent.com/u/16798121?v=3","gravatar_id":"","url":"https://api.github.com/users/CarlosGines","html_url":"https://github.com/CarlosGines","followers_url":"https://api.github.com/users/CarlosGines/followers","following_url":"https://api.github.com/users/CarlosGines/following{/other_user}","gists_url":"https://api.github.com/users/CarlosGines/gists{/gist_id}","starred_url":"https://api.github.com/users/CarlosGines/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CarlosGines/subscriptions","organizations_url":"https://api.github.com/users/CarlosGines/orgs","repos_url":"https://api.github.com/users/CarlosGines/repos","events_url":"https://api.github.com/users/CarlosGines/events{/privacy}","received_events_url":"https://api.github.com/users/CarlosGines/received_events","type":"User","site_admin":false},"body":"Well, it does match. Check here for example to get more info: https://regex101.com","created_at":"2016-03-04T01:37:48Z","updated_at":"2016-03-04T01:37:48Z","html_url":"https://github.com/yegor256/takes/pull/636#discussion_r54979488","pull_request_url":"https://api.github.com/repos/yegor256/takes/pulls/636","_links":{"self":{"href":"https://api.github.com/repos/yegor256/takes/pulls/comments/54979488"},"html":{"href":"https://github.com/yegor256/takes/pull/636#discussion_r54979488"},"pull_request":{"href":"https://api.github.com/repos/yegor256/takes/pulls/636"}}},"pull_request":{"url":"https://api.github.com/repos/yegor256/takes/pulls/636","id":61303135,"html_url":"https://github.com/yegor256/takes/pull/636","diff_url":"https://github.com/yegor256/takes/pull/636.diff","patch_url":"https://github.com/yegor256/takes/pull/636.patch","issue_url":"https://api.github.com/repos/yegor256/takes/issues/636","number":636,"state":"open","locked":false,"title":"#590 Added Fork chain implementation and tests","user":{"login":"CarlosGines","id":16798121,"avatar_url":"https://avatars.githubusercontent.com/u/16798121?v=3","gravatar_id":"","url":"https://api.github.com/users/CarlosGines","html_url":"https://github.com/CarlosGines","followers_url":"https://api.github.com/users/CarlosGines/followers","following_url":"https://api.github.com/users/CarlosGines/following{/other_user}","gists_url":"https://api.github.com/users/CarlosGines/gists{/gist_id}","starred_url":"https://api.github.com/users/CarlosGines/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CarlosGines/subscriptions","organizations_url":"https://api.github.com/users/CarlosGines/orgs","repos_url":"https://api.github.com/users/CarlosGines/repos","events_url":"https://api.github.com/users/CarlosGines/events{/privacy}","received_events_url":"https://api.github.com/users/CarlosGines/received_events","type":"User","site_admin":false},"body":"Fixes for #590:\r\n- Added `FkChain` class.\r\n- Added corresponding unit tests.\r\n- Simplified `TkFork` implementation by the use of `FkChain`.","created_at":"2016-03-01T20:29:01Z","updated_at":"2016-03-04T01:37:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bb1eed5dfafb433430c1fa9a1636f2e29c5da850","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/yegor256/takes/pulls/636/commits","review_comments_url":"https://api.github.com/repos/yegor256/takes/pulls/636/comments","review_comment_url":"https://api.github.com/repos/yegor256/takes/pulls/comments{/number}","comments_url":"https://api.github.com/repos/yegor256/takes/issues/636/comments","statuses_url":"https://api.github.com/repos/yegor256/takes/statuses/d77cf5c78460c7db339b44dcebc36a2cc9c79561","head":{"label":"CarlosGines:#590","ref":"#590","sha":"d77cf5c78460c7db339b44dcebc36a2cc9c79561","user":{"login":"CarlosGines","id":16798121,"avatar_url":"https://avatars.githubusercontent.com/u/16798121?v=3","gravatar_id":"","url":"https://api.github.com/users/CarlosGines","html_url":"https://github.com/CarlosGines","followers_url":"https://api.github.com/users/CarlosGines/followers","following_url":"https://api.github.com/users/CarlosGines/following{/other_user}","gists_url":"https://api.github.com/users/CarlosGines/gists{/gist_id}","starred_url":"https://api.github.com/users/CarlosGines/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CarlosGines/subscriptions","organizations_url":"https://api.github.com/users/CarlosGines/orgs","repos_url":"https://api.github.com/users/CarlosGines/repos","events_url":"https://api.github.com/users/CarlosGines/events{/privacy}","received_events_url":"https://api.github.com/users/CarlosGines/received_events","type":"User","site_admin":false},"repo":{"id":52871704,"name":"takes","full_name":"CarlosGines/takes","owner":{"login":"CarlosGines","id":16798121,"avatar_url":"https://avatars.githubusercontent.com/u/16798121?v=3","gravatar_id":"","url":"https://api.github.com/users/CarlosGines","html_url":"https://github.com/CarlosGines","followers_url":"https://api.github.com/users/CarlosGines/followers","following_url":"https://api.github.com/users/CarlosGines/following{/other_user}","gists_url":"https://api.github.com/users/CarlosGines/gists{/gist_id}","starred_url":"https://api.github.com/users/CarlosGines/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CarlosGines/subscriptions","organizations_url":"https://api.github.com/users/CarlosGines/orgs","repos_url":"https://api.github.com/users/CarlosGines/repos","events_url":"https://api.github.com/users/CarlosGines/events{/privacy}","received_events_url":"https://api.github.com/users/CarlosGines/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/CarlosGines/takes","description":"True Object-Oriented and Immutable Java Web Framework","fork":true,"url":"https://api.github.com/repos/CarlosGines/takes","forks_url":"https://api.github.com/repos/CarlosGines/takes/forks","keys_url":"https://api.github.com/repos/CarlosGines/takes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CarlosGines/takes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CarlosGines/takes/teams","hooks_url":"https://api.github.com/repos/CarlosGines/takes/hooks","issue_events_url":"https://api.github.com/repos/CarlosGines/takes/issues/events{/number}","events_url":"https://api.github.com/repos/CarlosGines/takes/events","assignees_url":"https://api.github.com/repos/CarlosGines/takes/assignees{/user}","branches_url":"https://api.github.com/repos/CarlosGines/takes/branches{/branch}","tags_url":"https://api.github.com/repos/CarlosGines/takes/tags","blobs_url":"https://api.github.com/repos/CarlosGines/takes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CarlosGines/takes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CarlosGines/takes/git/refs{/sha}","trees_url":"https://api.github.com/repos/CarlosGines/takes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CarlosGines/takes/statuses/{sha}","languages_url":"https://api.github.com/repos/CarlosGines/takes/languages","stargazers_url":"https://api.github.com/repos/CarlosGines/takes/stargazers","contributors_url":"https://api.github.com/repos/CarlosGines/takes/contributors","subscribers_url":"https://api.github.com/repos/CarlosGines/takes/subscribers","subscription_url":"https://api.github.com/repos/CarlosGines/takes/subscription","commits_url":"https://api.github.com/repos/CarlosGines/takes/commits{/sha}","git_commits_url":"https://api.github.com/repos/CarlosGines/takes/git/commits{/sha}","comments_url":"https://api.github.com/repos/CarlosGines/takes/comments{/number}","issue_comment_url":"https://api.github.com/repos/CarlosGines/takes/issues/comments{/number}","contents_url":"https://api.github.com/repos/CarlosGines/takes/contents/{+path}","compare_url":"https://api.github.com/repos/CarlosGines/takes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CarlosGines/takes/merges","archive_url":"https://api.github.com/repos/CarlosGines/takes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CarlosGines/takes/downloads","issues_url":"https://api.github.com/repos/CarlosGines/takes/issues{/number}","pulls_url":"https://api.github.com/repos/CarlosGines/takes/pulls{/number}","milestones_url":"https://api.github.com/repos/CarlosGines/takes/milestones{/number}","notifications_url":"https://api.github.com/repos/CarlosGines/takes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CarlosGines/takes/labels{/name}","releases_url":"https://api.github.com/repos/CarlosGines/takes/releases{/id}","deployments_url":"https://api.github.com/repos/CarlosGines/takes/deployments","created_at":"2016-03-01T11:25:11Z","updated_at":"2016-03-01T11:25:13Z","pushed_at":"2016-03-03T16:19:11Z","git_url":"git://github.com/CarlosGines/takes.git","ssh_url":"git@github.com:CarlosGines/takes.git","clone_url":"https://github.com/CarlosGines/takes.git","svn_url":"https://github.com/CarlosGines/takes","homepage":"http://www.takes.org","size":29147,"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":"yegor256:master","ref":"master","sha":"b2ee751ab18b8b7130b0603de888c75e8eae9240","user":{"login":"yegor256","id":526301,"avatar_url":"https://avatars.githubusercontent.com/u/526301?v=3","gravatar_id":"","url":"https://api.github.com/users/yegor256","html_url":"https://github.com/yegor256","followers_url":"https://api.github.com/users/yegor256/followers","following_url":"https://api.github.com/users/yegor256/following{/other_user}","gists_url":"https://api.github.com/users/yegor256/gists{/gist_id}","starred_url":"https://api.github.com/users/yegor256/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yegor256/subscriptions","organizations_url":"https://api.github.com/users/yegor256/orgs","repos_url":"https://api.github.com/users/yegor256/repos","events_url":"https://api.github.com/users/yegor256/events{/privacy}","received_events_url":"https://api.github.com/users/yegor256/received_events","type":"User","site_admin":false},"repo":{"id":28924109,"name":"takes","full_name":"yegor256/takes","owner":{"login":"yegor256","id":526301,"avatar_url":"https://avatars.githubusercontent.com/u/526301?v=3","gravatar_id":"","url":"https://api.github.com/users/yegor256","html_url":"https://github.com/yegor256","followers_url":"https://api.github.com/users/yegor256/followers","following_url":"https://api.github.com/users/yegor256/following{/other_user}","gists_url":"https://api.github.com/users/yegor256/gists{/gist_id}","starred_url":"https://api.github.com/users/yegor256/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yegor256/subscriptions","organizations_url":"https://api.github.com/users/yegor256/orgs","repos_url":"https://api.github.com/users/yegor256/repos","events_url":"https://api.github.com/users/yegor256/events{/privacy}","received_events_url":"https://api.github.com/users/yegor256/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/yegor256/takes","description":"True Object-Oriented and Immutable Java Web Framework","fork":false,"url":"https://api.github.com/repos/yegor256/takes","forks_url":"https://api.github.com/repos/yegor256/takes/forks","keys_url":"https://api.github.com/repos/yegor256/takes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yegor256/takes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yegor256/takes/teams","hooks_url":"https://api.github.com/repos/yegor256/takes/hooks","issue_events_url":"https://api.github.com/repos/yegor256/takes/issues/events{/number}","events_url":"https://api.github.com/repos/yegor256/takes/events","assignees_url":"https://api.github.com/repos/yegor256/takes/assignees{/user}","branches_url":"https://api.github.com/repos/yegor256/takes/branches{/branch}","tags_url":"https://api.github.com/repos/yegor256/takes/tags","blobs_url":"https://api.github.com/repos/yegor256/takes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yegor256/takes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yegor256/takes/git/refs{/sha}","trees_url":"https://api.github.com/repos/yegor256/takes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yegor256/takes/statuses/{sha}","languages_url":"https://api.github.com/repos/yegor256/takes/languages","stargazers_url":"https://api.github.com/repos/yegor256/takes/stargazers","contributors_url":"https://api.github.com/repos/yegor256/takes/contributors","subscribers_url":"https://api.github.com/repos/yegor256/takes/subscribers","subscription_url":"https://api.github.com/repos/yegor256/takes/subscription","commits_url":"https://api.github.com/repos/yegor256/takes/commits{/sha}","git_commits_url":"https://api.github.com/repos/yegor256/takes/git/commits{/sha}","comments_url":"https://api.github.com/repos/yegor256/takes/comments{/number}","issue_comment_url":"https://api.github.com/repos/yegor256/takes/issues/comments{/number}","contents_url":"https://api.github.com/repos/yegor256/takes/contents/{+path}","compare_url":"https://api.github.com/repos/yegor256/takes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yegor256/takes/merges","archive_url":"https://api.github.com/repos/yegor256/takes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yegor256/takes/downloads","issues_url":"https://api.github.com/repos/yegor256/takes/issues{/number}","pulls_url":"https://api.github.com/repos/yegor256/takes/pulls{/number}","milestones_url":"https://api.github.com/repos/yegor256/takes/milestones{/number}","notifications_url":"https://api.github.com/repos/yegor256/takes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yegor256/takes/labels{/name}","releases_url":"https://api.github.com/repos/yegor256/takes/releases{/id}","deployments_url":"https://api.github.com/repos/yegor256/takes/deployments","created_at":"2015-01-07T16:57:47Z","updated_at":"2016-03-02T10:27:03Z","pushed_at":"2016-03-03T22:53:01Z","git_url":"git://github.com/yegor256/takes.git","ssh_url":"git@github.com:yegor256/takes.git","clone_url":"https://github.com/yegor256/takes.git","svn_url":"https://github.com/yegor256/takes","homepage":"http://www.takes.org","size":30428,"stargazers_count":157,"watchers_count":157,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":88,"mirror_url":null,"open_issues_count":56,"forks":88,"open_issues":56,"watchers":157,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/yegor256/takes/pulls/636"},"html":{"href":"https://github.com/yegor256/takes/pull/636"},"issue":{"href":"https://api.github.com/repos/yegor256/takes/issues/636"},"comments":{"href":"https://api.github.com/repos/yegor256/takes/issues/636/comments"},"review_comments":{"href":"https://api.github.com/repos/yegor256/takes/pulls/636/comments"},"review_comment":{"href":"https://api.github.com/repos/yegor256/takes/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/yegor256/takes/pulls/636/commits"},"statuses":{"href":"https://api.github.com/repos/yegor256/takes/statuses/d77cf5c78460c7db339b44dcebc36a2cc9c79561"}}}}