{"action":"created","comment":{"url":"https://api.github.com/repos/Glucosio/glucosio-android/pulls/comments/133043180","pull_request_review_id":56182284,"id":133043180,"diff_hunk":"@@ -0,0 +1,126 @@\n+package org.glucosio.android.tools;\n+\n+\n+import android.test.mock.MockContext;\n+\n+import org.junit.Test;\n+\n+import static junit.framework.Assert.assertTrue;\n+\n+public class GlucoseRangesLogicTest {\n+\n+    private GlucoseRangesExt glucoseRangesExt = new GlucoseRangesExt(new MockContext());\n+    private String preferredRange = \"\";\n+    private int reading = 65;\n+\n+\n+    @Test\n+    public void expectPurpleWhenReadingValueIs65WithNoPreferredRange() {\n+        assertTrue(glucoseRangesExt.colorFromReading(reading, preferredRange).equals(\"purple\"));\n+    }\n+\n+    @Test\n+    public void expectRedWhenReadingValueIs210WithNoPreferredRange() {\n+        reading = 210;\n+\n+        assertTrue(glucoseRangesExt.colorFromReading(reading, preferredRange).equals(\"red\"));\n+    }\n+\n+    @Test\n+    public void expectGreenWhenReadingValueIs100WithADAPreferredRange() {\n+        reading = 100;\n+        preferredRange = \"ADA\";\n+\n+        assertTrue(glucoseRangesExt.colorFromReading(reading, preferredRange).equals(\"green\"));\n+    }\n+\n+    @Test\n+    public void expectBlueWhenReadingValueIs72WithADAPreferredRange() {\n+        // FIXME: 13.08.2017 FIX ADA range in primary and extension classes\n+        reading = 72;\n+        preferredRange = \"ADA\";\n+\n+        assertTrue(glucoseRangesExt.colorFromReading(reading, preferredRange).equals(\"blue\"));\n+    }\n+\n+    @Test\n+    public void expectOrangeWhenReadingValueIs185WithADAPreferredRange() {\n+        reading = 185;\n+        preferredRange = \"ADA\";\n+\n+        assertTrue(glucoseRangesExt.colorFromReading(reading, preferredRange).equals(\"orange\"));\n+    }\n+\n+    @Test\n+    public void expectGreenWhenReadingValueIs130WithAACEPreferredRange() {\n+        reading = 130;\n+        preferredRange = \"AACE\";\n+\n+        assertTrue(glucoseRangesExt.colorFromReading(reading, preferredRange).equals(\"green\"));\n+    }\n+\n+    @Test\n+    public void expectBlueWhenReadingValueIs90WithAACEPreferredRange() {\n+        reading = 90;\n+        preferredRange = \"AACE\";\n+\n+        assertTrue(glucoseRangesExt.colorFromReading(reading, preferredRange).equals(\"blue\"));\n+    }\n+\n+    @Test\n+    public void expectOrangeWhenReadingValueIs150WithAACEPreferredRange() {\n+        reading = 150;\n+        preferredRange = \"AACE\";\n+\n+        assertTrue(glucoseRangesExt.colorFromReading(reading, preferredRange).equals(\"orange\"));\n+    }\n+\n+    @Test\n+    public void expectGreenWhenReadingValueIs100WithUK_NICEPreferredRange() {","path":"app/src/test/java/org/glucosio/android/tools/GlucoseRangesLogicTest.java","position":79,"original_position":79,"commit_id":"6c191e0130a11bbfbbb42ce7bd3062758dcd49d9","original_commit_id":"6c191e0130a11bbfbbb42ce7bd3062758dcd49d9","user":{"login":"codacy-bot","id":19940114,"avatar_url":"https://avatars1.githubusercontent.com/u/19940114?v=4","gravatar_id":"","url":"https://api.github.com/users/codacy-bot","html_url":"https://github.com/codacy-bot","followers_url":"https://api.github.com/users/codacy-bot/followers","following_url":"https://api.github.com/users/codacy-bot/following{/other_user}","gists_url":"https://api.github.com/users/codacy-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/codacy-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codacy-bot/subscriptions","organizations_url":"https://api.github.com/users/codacy-bot/orgs","repos_url":"https://api.github.com/users/codacy-bot/repos","events_url":"https://api.github.com/users/codacy-bot/events{/privacy}","received_events_url":"https://api.github.com/users/codacy-bot/received_events","type":"User","site_admin":false},"body":"![Codacy](https://www.codacy.com/assets/images/favicon.png) Issue found: [Method names should not contain underscores](https://www.codacy.com/app/eugenemartynov/glucosio-android/pullRequest?prid=840667)","created_at":"2017-08-14T19:44:28Z","updated_at":"2017-08-14T19:44:28Z","html_url":"https://github.com/Glucosio/glucosio-android/pull/362#discussion_r133043180","pull_request_url":"https://api.github.com/repos/Glucosio/glucosio-android/pulls/362","_links":{"self":{"href":"https://api.github.com/repos/Glucosio/glucosio-android/pulls/comments/133043180"},"html":{"href":"https://github.com/Glucosio/glucosio-android/pull/362#discussion_r133043180"},"pull_request":{"href":"https://api.github.com/repos/Glucosio/glucosio-android/pulls/362"}}},"pull_request":{"url":"https://api.github.com/repos/Glucosio/glucosio-android/pulls/362","id":135507781,"html_url":"https://github.com/Glucosio/glucosio-android/pull/362","diff_url":"https://github.com/Glucosio/glucosio-android/pull/362.diff","patch_url":"https://github.com/Glucosio/glucosio-android/pull/362.patch","issue_url":"https://api.github.com/repos/Glucosio/glucosio-android/issues/362","number":362,"state":"open","locked":false,"title":"FIX #358: Adding unit tests for GlucoseRange and InputFilterMinMax.","user":{"login":"piotrek1543","id":11292212,"avatar_url":"https://avatars0.githubusercontent.com/u/11292212?v=4","gravatar_id":"","url":"https://api.github.com/users/piotrek1543","html_url":"https://github.com/piotrek1543","followers_url":"https://api.github.com/users/piotrek1543/followers","following_url":"https://api.github.com/users/piotrek1543/following{/other_user}","gists_url":"https://api.github.com/users/piotrek1543/gists{/gist_id}","starred_url":"https://api.github.com/users/piotrek1543/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/piotrek1543/subscriptions","organizations_url":"https://api.github.com/users/piotrek1543/orgs","repos_url":"https://api.github.com/users/piotrek1543/repos","events_url":"https://api.github.com/users/piotrek1543/events{/privacy}","received_events_url":"https://api.github.com/users/piotrek1543/received_events","type":"User","site_admin":false},"body":"Hi,\r\n\r\naccording to issue https://github.com/Glucosio/glucosio-android/issues/358, I've decided to check tests code and create this pull request. Well, it's not strict original code, I've done some changes...\r\n\r\n***Changes made in reference to original cases***\r\n- created `GlucoseRangesExt` and `GlucoseRangesLogicTest` to avoid code duplication problem and for better existing code management;\r\n - renamed most of test method names as they were not meaningful at all;\r\n - fixed empty catch in `InputFilterMinMax` class and changed visibility of `isInRange` method (sorry, but I couldn't avoid this);\r\n- added default empty constructor to `GlucoseRanges`\r\n- used `ContextCompat.getColor(context, colorRes)` instead of `context.getColor(colorRes)`\r\n- using default`stringToColor(String color)` instead of created for tests.\r\n\r\n***Things to do***\r\n- fix unaccessible ADA Blue variable https://github.com/Glucosio/glucosio-android/issues/363, \r\n- fix ADA Blue test cases\r\n- reformatting InputFilterMinMax unit test classes.\r\n\r\nWell, I was a bit confused when I saw that someone created modified `GlucoseRange` and `InputFilterMinMax` classes with brand-new methods created just for testing purposes, instead of using the existing ones, which is right way of test-driven development.\r\n\r\nHope, you would like it.\r\nCheers!\r\n","created_at":"2017-08-13T20:56:21Z","updated_at":"2017-08-14T19:44:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5aaeec245202fb050b25a8242a95c36b4c0910ee","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/Glucosio/glucosio-android/pulls/362/commits","review_comments_url":"https://api.github.com/repos/Glucosio/glucosio-android/pulls/362/comments","review_comment_url":"https://api.github.com/repos/Glucosio/glucosio-android/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Glucosio/glucosio-android/issues/362/comments","statuses_url":"https://api.github.com/repos/Glucosio/glucosio-android/statuses/6c191e0130a11bbfbbb42ce7bd3062758dcd49d9","head":{"label":"piotrek1543:support/improving_unit_tests","ref":"support/improving_unit_tests","sha":"6c191e0130a11bbfbbb42ce7bd3062758dcd49d9","user":{"login":"piotrek1543","id":11292212,"avatar_url":"https://avatars0.githubusercontent.com/u/11292212?v=4","gravatar_id":"","url":"https://api.github.com/users/piotrek1543","html_url":"https://github.com/piotrek1543","followers_url":"https://api.github.com/users/piotrek1543/followers","following_url":"https://api.github.com/users/piotrek1543/following{/other_user}","gists_url":"https://api.github.com/users/piotrek1543/gists{/gist_id}","starred_url":"https://api.github.com/users/piotrek1543/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/piotrek1543/subscriptions","organizations_url":"https://api.github.com/users/piotrek1543/orgs","repos_url":"https://api.github.com/users/piotrek1543/repos","events_url":"https://api.github.com/users/piotrek1543/events{/privacy}","received_events_url":"https://api.github.com/users/piotrek1543/received_events","type":"User","site_admin":false},"repo":{"id":100097340,"name":"glucosio-android","full_name":"piotrek1543/glucosio-android","owner":{"login":"piotrek1543","id":11292212,"avatar_url":"https://avatars0.githubusercontent.com/u/11292212?v=4","gravatar_id":"","url":"https://api.github.com/users/piotrek1543","html_url":"https://github.com/piotrek1543","followers_url":"https://api.github.com/users/piotrek1543/followers","following_url":"https://api.github.com/users/piotrek1543/following{/other_user}","gists_url":"https://api.github.com/users/piotrek1543/gists{/gist_id}","starred_url":"https://api.github.com/users/piotrek1543/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/piotrek1543/subscriptions","organizations_url":"https://api.github.com/users/piotrek1543/orgs","repos_url":"https://api.github.com/users/piotrek1543/repos","events_url":"https://api.github.com/users/piotrek1543/events{/privacy}","received_events_url":"https://api.github.com/users/piotrek1543/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/piotrek1543/glucosio-android","description":"Glucosio Android App","fork":true,"url":"https://api.github.com/repos/piotrek1543/glucosio-android","forks_url":"https://api.github.com/repos/piotrek1543/glucosio-android/forks","keys_url":"https://api.github.com/repos/piotrek1543/glucosio-android/keys{/key_id}","collaborators_url":"https://api.github.com/repos/piotrek1543/glucosio-android/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/piotrek1543/glucosio-android/teams","hooks_url":"https://api.github.com/repos/piotrek1543/glucosio-android/hooks","issue_events_url":"https://api.github.com/repos/piotrek1543/glucosio-android/issues/events{/number}","events_url":"https://api.github.com/repos/piotrek1543/glucosio-android/events","assignees_url":"https://api.github.com/repos/piotrek1543/glucosio-android/assignees{/user}","branches_url":"https://api.github.com/repos/piotrek1543/glucosio-android/branches{/branch}","tags_url":"https://api.github.com/repos/piotrek1543/glucosio-android/tags","blobs_url":"https://api.github.com/repos/piotrek1543/glucosio-android/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/piotrek1543/glucosio-android/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/piotrek1543/glucosio-android/git/refs{/sha}","trees_url":"https://api.github.com/repos/piotrek1543/glucosio-android/git/trees{/sha}","statuses_url":"https://api.github.com/repos/piotrek1543/glucosio-android/statuses/{sha}","languages_url":"https://api.github.com/repos/piotrek1543/glucosio-android/languages","stargazers_url":"https://api.github.com/repos/piotrek1543/glucosio-android/stargazers","contributors_url":"https://api.github.com/repos/piotrek1543/glucosio-android/contributors","subscribers_url":"https://api.github.com/repos/piotrek1543/glucosio-android/subscribers","subscription_url":"https://api.github.com/repos/piotrek1543/glucosio-android/subscription","commits_url":"https://api.github.com/repos/piotrek1543/glucosio-android/commits{/sha}","git_commits_url":"https://api.github.com/repos/piotrek1543/glucosio-android/git/commits{/sha}","comments_url":"https://api.github.com/repos/piotrek1543/glucosio-android/comments{/number}","issue_comment_url":"https://api.github.com/repos/piotrek1543/glucosio-android/issues/comments{/number}","contents_url":"https://api.github.com/repos/piotrek1543/glucosio-android/contents/{+path}","compare_url":"https://api.github.com/repos/piotrek1543/glucosio-android/compare/{base}...{head}","merges_url":"https://api.github.com/repos/piotrek1543/glucosio-android/merges","archive_url":"https://api.github.com/repos/piotrek1543/glucosio-android/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/piotrek1543/glucosio-android/downloads","issues_url":"https://api.github.com/repos/piotrek1543/glucosio-android/issues{/number}","pulls_url":"https://api.github.com/repos/piotrek1543/glucosio-android/pulls{/number}","milestones_url":"https://api.github.com/repos/piotrek1543/glucosio-android/milestones{/number}","notifications_url":"https://api.github.com/repos/piotrek1543/glucosio-android/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/piotrek1543/glucosio-android/labels{/name}","releases_url":"https://api.github.com/repos/piotrek1543/glucosio-android/releases{/id}","deployments_url":"https://api.github.com/repos/piotrek1543/glucosio-android/deployments","created_at":"2017-08-12T07:40:19Z","updated_at":"2017-08-12T07:40:22Z","pushed_at":"2017-08-13T20:31:44Z","git_url":"git://github.com/piotrek1543/glucosio-android.git","ssh_url":"git@github.com:piotrek1543/glucosio-android.git","clone_url":"https://github.com/piotrek1543/glucosio-android.git","svn_url":"https://github.com/piotrek1543/glucosio-android","homepage":"","size":21454,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"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":"develop"}},"base":{"label":"Glucosio:develop","ref":"develop","sha":"8353fae3ec0987296ef703f4f67493911df0071f","user":{"login":"Glucosio","id":12890580,"avatar_url":"https://avatars3.githubusercontent.com/u/12890580?v=4","gravatar_id":"","url":"https://api.github.com/users/Glucosio","html_url":"https://github.com/Glucosio","followers_url":"https://api.github.com/users/Glucosio/followers","following_url":"https://api.github.com/users/Glucosio/following{/other_user}","gists_url":"https://api.github.com/users/Glucosio/gists{/gist_id}","starred_url":"https://api.github.com/users/Glucosio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Glucosio/subscriptions","organizations_url":"https://api.github.com/users/Glucosio/orgs","repos_url":"https://api.github.com/users/Glucosio/repos","events_url":"https://api.github.com/users/Glucosio/events{/privacy}","received_events_url":"https://api.github.com/users/Glucosio/received_events","type":"Organization","site_admin":false},"repo":{"id":37447498,"name":"glucosio-android","full_name":"Glucosio/glucosio-android","owner":{"login":"Glucosio","id":12890580,"avatar_url":"https://avatars3.githubusercontent.com/u/12890580?v=4","gravatar_id":"","url":"https://api.github.com/users/Glucosio","html_url":"https://github.com/Glucosio","followers_url":"https://api.github.com/users/Glucosio/followers","following_url":"https://api.github.com/users/Glucosio/following{/other_user}","gists_url":"https://api.github.com/users/Glucosio/gists{/gist_id}","starred_url":"https://api.github.com/users/Glucosio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Glucosio/subscriptions","organizations_url":"https://api.github.com/users/Glucosio/orgs","repos_url":"https://api.github.com/users/Glucosio/repos","events_url":"https://api.github.com/users/Glucosio/events{/privacy}","received_events_url":"https://api.github.com/users/Glucosio/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Glucosio/glucosio-android","description":"Glucosio Android App","fork":false,"url":"https://api.github.com/repos/Glucosio/glucosio-android","forks_url":"https://api.github.com/repos/Glucosio/glucosio-android/forks","keys_url":"https://api.github.com/repos/Glucosio/glucosio-android/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Glucosio/glucosio-android/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Glucosio/glucosio-android/teams","hooks_url":"https://api.github.com/repos/Glucosio/glucosio-android/hooks","issue_events_url":"https://api.github.com/repos/Glucosio/glucosio-android/issues/events{/number}","events_url":"https://api.github.com/repos/Glucosio/glucosio-android/events","assignees_url":"https://api.github.com/repos/Glucosio/glucosio-android/assignees{/user}","branches_url":"https://api.github.com/repos/Glucosio/glucosio-android/branches{/branch}","tags_url":"https://api.github.com/repos/Glucosio/glucosio-android/tags","blobs_url":"https://api.github.com/repos/Glucosio/glucosio-android/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Glucosio/glucosio-android/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Glucosio/glucosio-android/git/refs{/sha}","trees_url":"https://api.github.com/repos/Glucosio/glucosio-android/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Glucosio/glucosio-android/statuses/{sha}","languages_url":"https://api.github.com/repos/Glucosio/glucosio-android/languages","stargazers_url":"https://api.github.com/repos/Glucosio/glucosio-android/stargazers","contributors_url":"https://api.github.com/repos/Glucosio/glucosio-android/contributors","subscribers_url":"https://api.github.com/repos/Glucosio/glucosio-android/subscribers","subscription_url":"https://api.github.com/repos/Glucosio/glucosio-android/subscription","commits_url":"https://api.github.com/repos/Glucosio/glucosio-android/commits{/sha}","git_commits_url":"https://api.github.com/repos/Glucosio/glucosio-android/git/commits{/sha}","comments_url":"https://api.github.com/repos/Glucosio/glucosio-android/comments{/number}","issue_comment_url":"https://api.github.com/repos/Glucosio/glucosio-android/issues/comments{/number}","contents_url":"https://api.github.com/repos/Glucosio/glucosio-android/contents/{+path}","compare_url":"https://api.github.com/repos/Glucosio/glucosio-android/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Glucosio/glucosio-android/merges","archive_url":"https://api.github.com/repos/Glucosio/glucosio-android/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Glucosio/glucosio-android/downloads","issues_url":"https://api.github.com/repos/Glucosio/glucosio-android/issues{/number}","pulls_url":"https://api.github.com/repos/Glucosio/glucosio-android/pulls{/number}","milestones_url":"https://api.github.com/repos/Glucosio/glucosio-android/milestones{/number}","notifications_url":"https://api.github.com/repos/Glucosio/glucosio-android/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Glucosio/glucosio-android/labels{/name}","releases_url":"https://api.github.com/repos/Glucosio/glucosio-android/releases{/id}","deployments_url":"https://api.github.com/repos/Glucosio/glucosio-android/deployments","created_at":"2015-06-15T06:28:27Z","updated_at":"2017-08-07T08:16:38Z","pushed_at":"2017-08-13T20:56:22Z","git_url":"git://github.com/Glucosio/glucosio-android.git","ssh_url":"git@github.com:Glucosio/glucosio-android.git","clone_url":"https://github.com/Glucosio/glucosio-android.git","svn_url":"https://github.com/Glucosio/glucosio-android","homepage":"","size":21450,"stargazers_count":264,"watchers_count":264,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":128,"mirror_url":null,"open_issues_count":51,"forks":128,"open_issues":51,"watchers":264,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/Glucosio/glucosio-android/pulls/362"},"html":{"href":"https://github.com/Glucosio/glucosio-android/pull/362"},"issue":{"href":"https://api.github.com/repos/Glucosio/glucosio-android/issues/362"},"comments":{"href":"https://api.github.com/repos/Glucosio/glucosio-android/issues/362/comments"},"review_comments":{"href":"https://api.github.com/repos/Glucosio/glucosio-android/pulls/362/comments"},"review_comment":{"href":"https://api.github.com/repos/Glucosio/glucosio-android/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Glucosio/glucosio-android/pulls/362/commits"},"statuses":{"href":"https://api.github.com/repos/Glucosio/glucosio-android/statuses/6c191e0130a11bbfbbb42ce7bd3062758dcd49d9"}}}}
{"actor":{"display_login":"codacy-bot"}}