{"action":"created","comment":{"url":"https://api.github.com/repos/novoda/merlin/pulls/comments/66632447","id":66632447,"diff_hunk":"@@ -0,0 +1,88 @@\n+package com.novoda.merlin.service;\n+\n+import java.util.ArrayList;\n+import java.util.Collection;\n+import java.util.List;\n+\n+import org.junit.Test;\n+import org.junit.experimental.runners.Enclosed;\n+import org.junit.runner.RunWith;\n+import org.junit.runners.Parameterized;\n+\n+import static com.novoda.merlin.service.ResponseCodeValidator.CustomEndpointResponseCodeValidator;\n+import static com.novoda.merlin.service.ResponseCodeValidator.DefaultEndpointResponseCodeValidator;\n+import static org.fest.assertions.api.Assertions.assertThat;\n+\n+@RunWith(Enclosed.class)\n+public class ResponseCodeValidatorTests {\n+\n+    private static final int NO_CONTENT = 204;\n+\n+    @RunWith(Parameterized.class)\n+    public static class DefaultEndpointResponseCodeValidatorTest {\n+\n+        private final int responseCode;\n+\n+        @Parameterized.Parameters(name = \"{0}\")","path":"core/src/test/java/com/novoda/merlin/service/ResponseCodeValidatorTests.java","position":26,"original_position":26,"commit_id":"0231a6dc5001a887afc75697c79d028258790cbb","original_commit_id":"6bc6189e138a29236f240c740aeb43e68d268d25","user":{"login":"juankysoriano","id":7768517,"avatar_url":"https://avatars.githubusercontent.com/u/7768517?v=3","gravatar_id":"","url":"https://api.github.com/users/juankysoriano","html_url":"https://github.com/juankysoriano","followers_url":"https://api.github.com/users/juankysoriano/followers","following_url":"https://api.github.com/users/juankysoriano/following{/other_user}","gists_url":"https://api.github.com/users/juankysoriano/gists{/gist_id}","starred_url":"https://api.github.com/users/juankysoriano/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juankysoriano/subscriptions","organizations_url":"https://api.github.com/users/juankysoriano/orgs","repos_url":"https://api.github.com/users/juankysoriano/repos","events_url":"https://api.github.com/users/juankysoriano/events{/privacy}","received_events_url":"https://api.github.com/users/juankysoriano/received_events","type":"User","site_admin":false},"body":"Usually you have a `[][]` parameteres where you map the `responseCode` to the expected `value`. If you do that but you want to maintain clarity on the output you can also rewrite this `name = \"{0}\"` to: `name = \" response code {0} should return {1}\"`\r\n\r\nThis will allow you to have just one single test! with two tests in place you are running 2xN times, where N is the number of response codes. \r\n\r\nNot a blocker, but could be nicer 😄 \r\n","created_at":"2016-06-10T15:25:13Z","updated_at":"2016-06-10T15:25:13Z","html_url":"https://github.com/novoda/merlin/pull/83#discussion_r66632447","pull_request_url":"https://api.github.com/repos/novoda/merlin/pulls/83","_links":{"self":{"href":"https://api.github.com/repos/novoda/merlin/pulls/comments/66632447"},"html":{"href":"https://github.com/novoda/merlin/pull/83#discussion_r66632447"},"pull_request":{"href":"https://api.github.com/repos/novoda/merlin/pulls/83"}}},"pull_request":{"url":"https://api.github.com/repos/novoda/merlin/pulls/83","id":73388339,"html_url":"https://github.com/novoda/merlin/pull/83","diff_url":"https://github.com/novoda/merlin/pull/83.diff","patch_url":"https://github.com/novoda/merlin/pull/83.patch","issue_url":"https://api.github.com/repos/novoda/merlin/issues/83","number":83,"state":"open","locked":false,"title":"Update ping validation","user":{"login":"joetimmins","id":10560214,"avatar_url":"https://avatars.githubusercontent.com/u/10560214?v=3","gravatar_id":"","url":"https://api.github.com/users/joetimmins","html_url":"https://github.com/joetimmins","followers_url":"https://api.github.com/users/joetimmins/followers","following_url":"https://api.github.com/users/joetimmins/following{/other_user}","gists_url":"https://api.github.com/users/joetimmins/gists{/gist_id}","starred_url":"https://api.github.com/users/joetimmins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joetimmins/subscriptions","organizations_url":"https://api.github.com/users/joetimmins/orgs","repos_url":"https://api.github.com/users/joetimmins/repos","events_url":"https://api.github.com/users/joetimmins/events{/privacy}","received_events_url":"https://api.github.com/users/joetimmins/received_events","type":"User","site_admin":false},"body":"Fixes https://github.com/novoda/merlin/issues/81\r\nFixes https://github.com/novoda/merlin/issues/79\r\n\r\nMerlin had a problem resolving online status when connected to a network with no real internet access. When pinging a remote host, it treated *any* server response whatsoever as being an indicator of having a valid internet connection. \r\n\r\nHowever, when connected to a captive network that required a web-based login to be completed, or connected to a wifi router with no Internet cable plugged into the back of it, Merlin would receive some kind of http response, and therefore think it had a real internet connection. Even though it didn't.\r\n\r\nThis PR fixes that problem when using the default endpoint. (FYI this default endpoint is http://connectivitycheck.android.com/generate_204 - which is mentioned in issue #82 .) It does this by checking the response code from that endpoint as being 204, and if it isn't, Merlin will not think it has an internet connection. If you're connected to a captive network or an Internet-less wifi router, you won't get a 204 from this ping.\r\n\r\nIf you configure Merlin to use a different endpoint, it reverts to using the old behaviour. So if you do that, you may not get accurate reading of whether or not you're connected to the actual Internet.","created_at":"2016-06-10T15:06:09Z","updated_at":"2016-06-10T15:25:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f81fe983d2c7446fb4d2d22ce93169a12838cef5","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/novoda/merlin/pulls/83/commits","review_comments_url":"https://api.github.com/repos/novoda/merlin/pulls/83/comments","review_comment_url":"https://api.github.com/repos/novoda/merlin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/novoda/merlin/issues/83/comments","statuses_url":"https://api.github.com/repos/novoda/merlin/statuses/0231a6dc5001a887afc75697c79d028258790cbb","head":{"label":"novoda:update-ping-validation","ref":"update-ping-validation","sha":"0231a6dc5001a887afc75697c79d028258790cbb","user":{"login":"novoda","id":74874,"avatar_url":"https://avatars.githubusercontent.com/u/74874?v=3","gravatar_id":"","url":"https://api.github.com/users/novoda","html_url":"https://github.com/novoda","followers_url":"https://api.github.com/users/novoda/followers","following_url":"https://api.github.com/users/novoda/following{/other_user}","gists_url":"https://api.github.com/users/novoda/gists{/gist_id}","starred_url":"https://api.github.com/users/novoda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/novoda/subscriptions","organizations_url":"https://api.github.com/users/novoda/orgs","repos_url":"https://api.github.com/users/novoda/repos","events_url":"https://api.github.com/users/novoda/events{/privacy}","received_events_url":"https://api.github.com/users/novoda/received_events","type":"Organization","site_admin":false},"repo":{"id":9941578,"name":"merlin","full_name":"novoda/merlin","owner":{"login":"novoda","id":74874,"avatar_url":"https://avatars.githubusercontent.com/u/74874?v=3","gravatar_id":"","url":"https://api.github.com/users/novoda","html_url":"https://github.com/novoda","followers_url":"https://api.github.com/users/novoda/followers","following_url":"https://api.github.com/users/novoda/following{/other_user}","gists_url":"https://api.github.com/users/novoda/gists{/gist_id}","starred_url":"https://api.github.com/users/novoda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/novoda/subscriptions","organizations_url":"https://api.github.com/users/novoda/orgs","repos_url":"https://api.github.com/users/novoda/repos","events_url":"https://api.github.com/users/novoda/events{/privacy}","received_events_url":"https://api.github.com/users/novoda/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/novoda/merlin","description":"Observes network connection status & gives callbacks","fork":false,"url":"https://api.github.com/repos/novoda/merlin","forks_url":"https://api.github.com/repos/novoda/merlin/forks","keys_url":"https://api.github.com/repos/novoda/merlin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/novoda/merlin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/novoda/merlin/teams","hooks_url":"https://api.github.com/repos/novoda/merlin/hooks","issue_events_url":"https://api.github.com/repos/novoda/merlin/issues/events{/number}","events_url":"https://api.github.com/repos/novoda/merlin/events","assignees_url":"https://api.github.com/repos/novoda/merlin/assignees{/user}","branches_url":"https://api.github.com/repos/novoda/merlin/branches{/branch}","tags_url":"https://api.github.com/repos/novoda/merlin/tags","blobs_url":"https://api.github.com/repos/novoda/merlin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/novoda/merlin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/novoda/merlin/git/refs{/sha}","trees_url":"https://api.github.com/repos/novoda/merlin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/novoda/merlin/statuses/{sha}","languages_url":"https://api.github.com/repos/novoda/merlin/languages","stargazers_url":"https://api.github.com/repos/novoda/merlin/stargazers","contributors_url":"https://api.github.com/repos/novoda/merlin/contributors","subscribers_url":"https://api.github.com/repos/novoda/merlin/subscribers","subscription_url":"https://api.github.com/repos/novoda/merlin/subscription","commits_url":"https://api.github.com/repos/novoda/merlin/commits{/sha}","git_commits_url":"https://api.github.com/repos/novoda/merlin/git/commits{/sha}","comments_url":"https://api.github.com/repos/novoda/merlin/comments{/number}","issue_comment_url":"https://api.github.com/repos/novoda/merlin/issues/comments{/number}","contents_url":"https://api.github.com/repos/novoda/merlin/contents/{+path}","compare_url":"https://api.github.com/repos/novoda/merlin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/novoda/merlin/merges","archive_url":"https://api.github.com/repos/novoda/merlin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/novoda/merlin/downloads","issues_url":"https://api.github.com/repos/novoda/merlin/issues{/number}","pulls_url":"https://api.github.com/repos/novoda/merlin/pulls{/number}","milestones_url":"https://api.github.com/repos/novoda/merlin/milestones{/number}","notifications_url":"https://api.github.com/repos/novoda/merlin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/novoda/merlin/labels{/name}","releases_url":"https://api.github.com/repos/novoda/merlin/releases{/id}","deployments_url":"https://api.github.com/repos/novoda/merlin/deployments","created_at":"2013-05-08T17:03:53Z","updated_at":"2016-06-10T12:29:33Z","pushed_at":"2016-06-10T15:22:10Z","git_url":"git://github.com/novoda/merlin.git","ssh_url":"git@github.com:novoda/merlin.git","clone_url":"https://github.com/novoda/merlin.git","svn_url":"https://github.com/novoda/merlin","homepage":"","size":1324,"stargazers_count":266,"watchers_count":266,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":39,"mirror_url":null,"open_issues_count":8,"forks":39,"open_issues":8,"watchers":266,"default_branch":"master"}},"base":{"label":"novoda:master","ref":"master","sha":"c2f0f89a25af361b82ebfc30b02a62a6e643607d","user":{"login":"novoda","id":74874,"avatar_url":"https://avatars.githubusercontent.com/u/74874?v=3","gravatar_id":"","url":"https://api.github.com/users/novoda","html_url":"https://github.com/novoda","followers_url":"https://api.github.com/users/novoda/followers","following_url":"https://api.github.com/users/novoda/following{/other_user}","gists_url":"https://api.github.com/users/novoda/gists{/gist_id}","starred_url":"https://api.github.com/users/novoda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/novoda/subscriptions","organizations_url":"https://api.github.com/users/novoda/orgs","repos_url":"https://api.github.com/users/novoda/repos","events_url":"https://api.github.com/users/novoda/events{/privacy}","received_events_url":"https://api.github.com/users/novoda/received_events","type":"Organization","site_admin":false},"repo":{"id":9941578,"name":"merlin","full_name":"novoda/merlin","owner":{"login":"novoda","id":74874,"avatar_url":"https://avatars.githubusercontent.com/u/74874?v=3","gravatar_id":"","url":"https://api.github.com/users/novoda","html_url":"https://github.com/novoda","followers_url":"https://api.github.com/users/novoda/followers","following_url":"https://api.github.com/users/novoda/following{/other_user}","gists_url":"https://api.github.com/users/novoda/gists{/gist_id}","starred_url":"https://api.github.com/users/novoda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/novoda/subscriptions","organizations_url":"https://api.github.com/users/novoda/orgs","repos_url":"https://api.github.com/users/novoda/repos","events_url":"https://api.github.com/users/novoda/events{/privacy}","received_events_url":"https://api.github.com/users/novoda/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/novoda/merlin","description":"Observes network connection status & gives callbacks","fork":false,"url":"https://api.github.com/repos/novoda/merlin","forks_url":"https://api.github.com/repos/novoda/merlin/forks","keys_url":"https://api.github.com/repos/novoda/merlin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/novoda/merlin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/novoda/merlin/teams","hooks_url":"https://api.github.com/repos/novoda/merlin/hooks","issue_events_url":"https://api.github.com/repos/novoda/merlin/issues/events{/number}","events_url":"https://api.github.com/repos/novoda/merlin/events","assignees_url":"https://api.github.com/repos/novoda/merlin/assignees{/user}","branches_url":"https://api.github.com/repos/novoda/merlin/branches{/branch}","tags_url":"https://api.github.com/repos/novoda/merlin/tags","blobs_url":"https://api.github.com/repos/novoda/merlin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/novoda/merlin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/novoda/merlin/git/refs{/sha}","trees_url":"https://api.github.com/repos/novoda/merlin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/novoda/merlin/statuses/{sha}","languages_url":"https://api.github.com/repos/novoda/merlin/languages","stargazers_url":"https://api.github.com/repos/novoda/merlin/stargazers","contributors_url":"https://api.github.com/repos/novoda/merlin/contributors","subscribers_url":"https://api.github.com/repos/novoda/merlin/subscribers","subscription_url":"https://api.github.com/repos/novoda/merlin/subscription","commits_url":"https://api.github.com/repos/novoda/merlin/commits{/sha}","git_commits_url":"https://api.github.com/repos/novoda/merlin/git/commits{/sha}","comments_url":"https://api.github.com/repos/novoda/merlin/comments{/number}","issue_comment_url":"https://api.github.com/repos/novoda/merlin/issues/comments{/number}","contents_url":"https://api.github.com/repos/novoda/merlin/contents/{+path}","compare_url":"https://api.github.com/repos/novoda/merlin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/novoda/merlin/merges","archive_url":"https://api.github.com/repos/novoda/merlin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/novoda/merlin/downloads","issues_url":"https://api.github.com/repos/novoda/merlin/issues{/number}","pulls_url":"https://api.github.com/repos/novoda/merlin/pulls{/number}","milestones_url":"https://api.github.com/repos/novoda/merlin/milestones{/number}","notifications_url":"https://api.github.com/repos/novoda/merlin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/novoda/merlin/labels{/name}","releases_url":"https://api.github.com/repos/novoda/merlin/releases{/id}","deployments_url":"https://api.github.com/repos/novoda/merlin/deployments","created_at":"2013-05-08T17:03:53Z","updated_at":"2016-06-10T12:29:33Z","pushed_at":"2016-06-10T15:22:10Z","git_url":"git://github.com/novoda/merlin.git","ssh_url":"git@github.com:novoda/merlin.git","clone_url":"https://github.com/novoda/merlin.git","svn_url":"https://github.com/novoda/merlin","homepage":"","size":1324,"stargazers_count":266,"watchers_count":266,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":39,"mirror_url":null,"open_issues_count":8,"forks":39,"open_issues":8,"watchers":266,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/novoda/merlin/pulls/83"},"html":{"href":"https://github.com/novoda/merlin/pull/83"},"issue":{"href":"https://api.github.com/repos/novoda/merlin/issues/83"},"comments":{"href":"https://api.github.com/repos/novoda/merlin/issues/83/comments"},"review_comments":{"href":"https://api.github.com/repos/novoda/merlin/pulls/83/comments"},"review_comment":{"href":"https://api.github.com/repos/novoda/merlin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/novoda/merlin/pulls/83/commits"},"statuses":{"href":"https://api.github.com/repos/novoda/merlin/statuses/0231a6dc5001a887afc75697c79d028258790cbb"}}}}
{"actor":{"display_login":"juankysoriano"}}