{"action":"created","comment":{"url":"https://api.github.com/repos/googlesamples/android-architecture/pulls/comments/149655999","pull_request_review_id":75082103,"id":149655999,"diff_hunk":"@@ -0,0 +1,172 @@\n+/*\n+ * Copyright 2017, The Android Open Source Project\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+package com.example.android.architecture.blueprints.todoapp.data.source.local\n+\n+import android.arch.persistence.room.Room\n+import android.support.test.InstrumentationRegistry\n+import android.support.test.runner.AndroidJUnit4\n+import com.example.android.architecture.blueprints.todoapp.data.Task\n+import org.hamcrest.CoreMatchers.`is`\n+import org.hamcrest.CoreMatchers.notNullValue\n+import org.hamcrest.MatcherAssert.assertThat\n+import org.junit.After\n+import org.junit.Before\n+import org.junit.Test\n+import org.junit.runner.RunWith\n+\n+@RunWith(AndroidJUnit4::class) class TasksDaoTest {\n+\n+    private lateinit var database: ToDoDatabase\n+\n+    @Before fun initDb() {\n+        // using an in-memory database because the information stored here disappears when the\n+        // process is killed\n+        database = Room.inMemoryDatabaseBuilder(InstrumentationRegistry.getContext(),\n+                ToDoDatabase::class.java).build()\n+    }\n+\n+    @After fun closeDb() {\n+        database.close()\n+    }\n+\n+    @Test fun insertTaskAndGetById() {\n+        // When inserting a task\n+        database.taskDao().insertTask(TASK)\n+\n+        // When getting the task by id from the database\n+        val loaded = database.taskDao().getTaskById(TASK.id)\n+\n+        // The loaded data contains the expected values\n+        assertTask(loaded, \"id\", \"title\", \"description\", true)\n+    }\n+\n+    @Test fun insertTaskReplacesOnConflict() {\n+        //Given that a task is inserted\n+        database.taskDao().insertTask(TASK)\n+\n+        // When a task with the same id is inserted\n+        val newTask = Task(\"title2\", \"description2\", \"id\").apply {\n+            isCompleted = true\n+        }\n+        database.taskDao().insertTask(newTask)\n+\n+        // When getting the task by id from the database\n+        val loaded = database.taskDao().getTaskById(TASK.id)\n+\n+        // The loaded data contains the expected values\n+        assertTask(loaded, \"id\", \"title2\", \"description2\", true)\n+    }\n+\n+    @Test fun insertTaskAndGetTasks() {\n+        // When inserting a task\n+        database.taskDao().insertTask(TASK)\n+\n+        // When getting the tasks from the database\n+        val tasks = database.taskDao().getTasks()\n+\n+        // There is only 1 task in the database\n+        assertThat(tasks.size, `is`(1))\n+        // The loaded data contains the expected values\n+        assertTask(tasks[0], \"id\", \"title\", \"description\", true)\n+    }\n+\n+    @Test fun updateTaskAndGetById() {\n+        // When inserting a task\n+        database.taskDao().insertTask(TASK)\n+\n+        // When the task is updated\n+        val updatedTask = Task(\"title2\", \"description2\", \"id\").apply {\n+            isCompleted = true\n+        }\n+        database.taskDao().updateTask(updatedTask)\n+\n+        // When getting the task by id from the database\n+        val loaded = database.taskDao().getTaskById(\"id\")\n+\n+        // The loaded data contains the expected values\n+        assertTask(loaded, \"id\", \"title2\", \"description2\", true)\n+    }\n+\n+    @Test fun updateCompletedAndGetById() {\n+        // When inserting a task\n+        database.taskDao().insertTask(TASK)\n+\n+        // When the task is updated\n+        database.taskDao().updateCompleted(TASK.id, false)\n+\n+        // When getting the task by id from the database\n+        val loaded = database.taskDao().getTaskById(\"id\")\n+\n+        // The loaded data contains the expected values\n+        assertTask(loaded, TASK.id, TASK.title, TASK.description, false)\n+    }\n+\n+    @Test fun deleteTaskByIdAndGettingTasks() {\n+        //Given a task inserted","path":"todoapp/app/src/androidTest/java/com/example/android/architecture/blueprints/todoapp/data/source/local/TasksDaoTest.kt","position":119,"original_position":119,"commit_id":"67761105f512cdba07a4f1c5aee0487369d58c2f","original_commit_id":"67761105f512cdba07a4f1c5aee0487369d58c2f","user":{"login":"DougSig","id":5641478,"avatar_url":"https://avatars2.githubusercontent.com/u/5641478?v=4","gravatar_id":"","url":"https://api.github.com/users/DougSig","html_url":"https://github.com/DougSig","followers_url":"https://api.github.com/users/DougSig/followers","following_url":"https://api.github.com/users/DougSig/following{/other_user}","gists_url":"https://api.github.com/users/DougSig/gists{/gist_id}","starred_url":"https://api.github.com/users/DougSig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DougSig/subscriptions","organizations_url":"https://api.github.com/users/DougSig/orgs","repos_url":"https://api.github.com/users/DougSig/repos","events_url":"https://api.github.com/users/DougSig/events{/privacy}","received_events_url":"https://api.github.com/users/DougSig/received_events","type":"User","site_admin":false},"body":"Done.","created_at":"2017-11-08T12:37:11Z","updated_at":"2017-11-08T12:37:11Z","html_url":"https://github.com/googlesamples/android-architecture/pull/453#discussion_r149655999","pull_request_url":"https://api.github.com/repos/googlesamples/android-architecture/pulls/453","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/googlesamples/android-architecture/pulls/comments/149655999"},"html":{"href":"https://github.com/googlesamples/android-architecture/pull/453#discussion_r149655999"},"pull_request":{"href":"https://api.github.com/repos/googlesamples/android-architecture/pulls/453"}},"in_reply_to_id":149618615},"pull_request":{"url":"https://api.github.com/repos/googlesamples/android-architecture/pulls/453","id":151274940,"html_url":"https://github.com/googlesamples/android-architecture/pull/453","diff_url":"https://github.com/googlesamples/android-architecture/pull/453.diff","patch_url":"https://github.com/googlesamples/android-architecture/pull/453.patch","issue_url":"https://api.github.com/repos/googlesamples/android-architecture/issues/453","number":453,"state":"open","locked":false,"title":"[dev-todo-mvp-kotlin] Updating travis, circle, gradle files, and stats.","user":{"login":"DougSig","id":5641478,"avatar_url":"https://avatars2.githubusercontent.com/u/5641478?v=4","gravatar_id":"","url":"https://api.github.com/users/DougSig","html_url":"https://github.com/DougSig","followers_url":"https://api.github.com/users/DougSig/followers","following_url":"https://api.github.com/users/DougSig/following{/other_user}","gists_url":"https://api.github.com/users/DougSig/gists{/gist_id}","starred_url":"https://api.github.com/users/DougSig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DougSig/subscriptions","organizations_url":"https://api.github.com/users/DougSig/orgs","repos_url":"https://api.github.com/users/DougSig/repos","events_url":"https://api.github.com/users/DougSig/events{/privacy}","received_events_url":"https://api.github.com/users/DougSig/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-11-08T01:52:48Z","updated_at":"2017-11-08T12:37:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"84a0d864894e9af86865528b8ec151cf59fb0519","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/googlesamples/android-architecture/pulls/453/commits","review_comments_url":"https://api.github.com/repos/googlesamples/android-architecture/pulls/453/comments","review_comment_url":"https://api.github.com/repos/googlesamples/android-architecture/pulls/comments{/number}","comments_url":"https://api.github.com/repos/googlesamples/android-architecture/issues/453/comments","statuses_url":"https://api.github.com/repos/googlesamples/android-architecture/statuses/67761105f512cdba07a4f1c5aee0487369d58c2f","head":{"label":"DougSig:dev-todo-mvp-kotlin","ref":"dev-todo-mvp-kotlin","sha":"67761105f512cdba07a4f1c5aee0487369d58c2f","user":{"login":"DougSig","id":5641478,"avatar_url":"https://avatars2.githubusercontent.com/u/5641478?v=4","gravatar_id":"","url":"https://api.github.com/users/DougSig","html_url":"https://github.com/DougSig","followers_url":"https://api.github.com/users/DougSig/followers","following_url":"https://api.github.com/users/DougSig/following{/other_user}","gists_url":"https://api.github.com/users/DougSig/gists{/gist_id}","starred_url":"https://api.github.com/users/DougSig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DougSig/subscriptions","organizations_url":"https://api.github.com/users/DougSig/orgs","repos_url":"https://api.github.com/users/DougSig/repos","events_url":"https://api.github.com/users/DougSig/events{/privacy}","received_events_url":"https://api.github.com/users/DougSig/received_events","type":"User","site_admin":false},"repo":{"id":77099954,"name":"android-architecture","full_name":"DougSig/android-architecture","owner":{"login":"DougSig","id":5641478,"avatar_url":"https://avatars2.githubusercontent.com/u/5641478?v=4","gravatar_id":"","url":"https://api.github.com/users/DougSig","html_url":"https://github.com/DougSig","followers_url":"https://api.github.com/users/DougSig/followers","following_url":"https://api.github.com/users/DougSig/following{/other_user}","gists_url":"https://api.github.com/users/DougSig/gists{/gist_id}","starred_url":"https://api.github.com/users/DougSig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DougSig/subscriptions","organizations_url":"https://api.github.com/users/DougSig/orgs","repos_url":"https://api.github.com/users/DougSig/repos","events_url":"https://api.github.com/users/DougSig/events{/privacy}","received_events_url":"https://api.github.com/users/DougSig/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/DougSig/android-architecture","description":"A collection of samples to discuss and showcase different architectural tools and patterns for Android apps.","fork":true,"url":"https://api.github.com/repos/DougSig/android-architecture","forks_url":"https://api.github.com/repos/DougSig/android-architecture/forks","keys_url":"https://api.github.com/repos/DougSig/android-architecture/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DougSig/android-architecture/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DougSig/android-architecture/teams","hooks_url":"https://api.github.com/repos/DougSig/android-architecture/hooks","issue_events_url":"https://api.github.com/repos/DougSig/android-architecture/issues/events{/number}","events_url":"https://api.github.com/repos/DougSig/android-architecture/events","assignees_url":"https://api.github.com/repos/DougSig/android-architecture/assignees{/user}","branches_url":"https://api.github.com/repos/DougSig/android-architecture/branches{/branch}","tags_url":"https://api.github.com/repos/DougSig/android-architecture/tags","blobs_url":"https://api.github.com/repos/DougSig/android-architecture/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DougSig/android-architecture/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DougSig/android-architecture/git/refs{/sha}","trees_url":"https://api.github.com/repos/DougSig/android-architecture/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DougSig/android-architecture/statuses/{sha}","languages_url":"https://api.github.com/repos/DougSig/android-architecture/languages","stargazers_url":"https://api.github.com/repos/DougSig/android-architecture/stargazers","contributors_url":"https://api.github.com/repos/DougSig/android-architecture/contributors","subscribers_url":"https://api.github.com/repos/DougSig/android-architecture/subscribers","subscription_url":"https://api.github.com/repos/DougSig/android-architecture/subscription","commits_url":"https://api.github.com/repos/DougSig/android-architecture/commits{/sha}","git_commits_url":"https://api.github.com/repos/DougSig/android-architecture/git/commits{/sha}","comments_url":"https://api.github.com/repos/DougSig/android-architecture/comments{/number}","issue_comment_url":"https://api.github.com/repos/DougSig/android-architecture/issues/comments{/number}","contents_url":"https://api.github.com/repos/DougSig/android-architecture/contents/{+path}","compare_url":"https://api.github.com/repos/DougSig/android-architecture/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DougSig/android-architecture/merges","archive_url":"https://api.github.com/repos/DougSig/android-architecture/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DougSig/android-architecture/downloads","issues_url":"https://api.github.com/repos/DougSig/android-architecture/issues{/number}","pulls_url":"https://api.github.com/repos/DougSig/android-architecture/pulls{/number}","milestones_url":"https://api.github.com/repos/DougSig/android-architecture/milestones{/number}","notifications_url":"https://api.github.com/repos/DougSig/android-architecture/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DougSig/android-architecture/labels{/name}","releases_url":"https://api.github.com/repos/DougSig/android-architecture/releases{/id}","deployments_url":"https://api.github.com/repos/DougSig/android-architecture/deployments","created_at":"2016-12-22T01:38:40Z","updated_at":"2017-08-16T20:51:28Z","pushed_at":"2017-11-08T07:41:11Z","git_url":"git://github.com/DougSig/android-architecture.git","ssh_url":"git@github.com:DougSig/android-architecture.git","clone_url":"https://github.com/DougSig/android-architecture.git","svn_url":"https://github.com/DougSig/android-architecture","homepage":"","size":7870,"stargazers_count":1,"watchers_count":1,"language":null,"has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"googlesamples:dev-todo-mvp-kotlin","ref":"dev-todo-mvp-kotlin","sha":"f8b5c3c6db6081c716a4e1ed84b2b1a38df9e028","user":{"login":"googlesamples","id":7378196,"avatar_url":"https://avatars3.githubusercontent.com/u/7378196?v=4","gravatar_id":"","url":"https://api.github.com/users/googlesamples","html_url":"https://github.com/googlesamples","followers_url":"https://api.github.com/users/googlesamples/followers","following_url":"https://api.github.com/users/googlesamples/following{/other_user}","gists_url":"https://api.github.com/users/googlesamples/gists{/gist_id}","starred_url":"https://api.github.com/users/googlesamples/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/googlesamples/subscriptions","organizations_url":"https://api.github.com/users/googlesamples/orgs","repos_url":"https://api.github.com/users/googlesamples/repos","events_url":"https://api.github.com/users/googlesamples/events{/privacy}","received_events_url":"https://api.github.com/users/googlesamples/received_events","type":"Organization","site_admin":false},"repo":{"id":51148780,"name":"android-architecture","full_name":"googlesamples/android-architecture","owner":{"login":"googlesamples","id":7378196,"avatar_url":"https://avatars3.githubusercontent.com/u/7378196?v=4","gravatar_id":"","url":"https://api.github.com/users/googlesamples","html_url":"https://github.com/googlesamples","followers_url":"https://api.github.com/users/googlesamples/followers","following_url":"https://api.github.com/users/googlesamples/following{/other_user}","gists_url":"https://api.github.com/users/googlesamples/gists{/gist_id}","starred_url":"https://api.github.com/users/googlesamples/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/googlesamples/subscriptions","organizations_url":"https://api.github.com/users/googlesamples/orgs","repos_url":"https://api.github.com/users/googlesamples/repos","events_url":"https://api.github.com/users/googlesamples/events{/privacy}","received_events_url":"https://api.github.com/users/googlesamples/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/googlesamples/android-architecture","description":"A collection of samples to discuss and showcase different architectural tools and patterns for Android apps.","fork":false,"url":"https://api.github.com/repos/googlesamples/android-architecture","forks_url":"https://api.github.com/repos/googlesamples/android-architecture/forks","keys_url":"https://api.github.com/repos/googlesamples/android-architecture/keys{/key_id}","collaborators_url":"https://api.github.com/repos/googlesamples/android-architecture/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/googlesamples/android-architecture/teams","hooks_url":"https://api.github.com/repos/googlesamples/android-architecture/hooks","issue_events_url":"https://api.github.com/repos/googlesamples/android-architecture/issues/events{/number}","events_url":"https://api.github.com/repos/googlesamples/android-architecture/events","assignees_url":"https://api.github.com/repos/googlesamples/android-architecture/assignees{/user}","branches_url":"https://api.github.com/repos/googlesamples/android-architecture/branches{/branch}","tags_url":"https://api.github.com/repos/googlesamples/android-architecture/tags","blobs_url":"https://api.github.com/repos/googlesamples/android-architecture/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/googlesamples/android-architecture/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/googlesamples/android-architecture/git/refs{/sha}","trees_url":"https://api.github.com/repos/googlesamples/android-architecture/git/trees{/sha}","statuses_url":"https://api.github.com/repos/googlesamples/android-architecture/statuses/{sha}","languages_url":"https://api.github.com/repos/googlesamples/android-architecture/languages","stargazers_url":"https://api.github.com/repos/googlesamples/android-architecture/stargazers","contributors_url":"https://api.github.com/repos/googlesamples/android-architecture/contributors","subscribers_url":"https://api.github.com/repos/googlesamples/android-architecture/subscribers","subscription_url":"https://api.github.com/repos/googlesamples/android-architecture/subscription","commits_url":"https://api.github.com/repos/googlesamples/android-architecture/commits{/sha}","git_commits_url":"https://api.github.com/repos/googlesamples/android-architecture/git/commits{/sha}","comments_url":"https://api.github.com/repos/googlesamples/android-architecture/comments{/number}","issue_comment_url":"https://api.github.com/repos/googlesamples/android-architecture/issues/comments{/number}","contents_url":"https://api.github.com/repos/googlesamples/android-architecture/contents/{+path}","compare_url":"https://api.github.com/repos/googlesamples/android-architecture/compare/{base}...{head}","merges_url":"https://api.github.com/repos/googlesamples/android-architecture/merges","archive_url":"https://api.github.com/repos/googlesamples/android-architecture/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/googlesamples/android-architecture/downloads","issues_url":"https://api.github.com/repos/googlesamples/android-architecture/issues{/number}","pulls_url":"https://api.github.com/repos/googlesamples/android-architecture/pulls{/number}","milestones_url":"https://api.github.com/repos/googlesamples/android-architecture/milestones{/number}","notifications_url":"https://api.github.com/repos/googlesamples/android-architecture/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/googlesamples/android-architecture/labels{/name}","releases_url":"https://api.github.com/repos/googlesamples/android-architecture/releases{/id}","deployments_url":"https://api.github.com/repos/googlesamples/android-architecture/deployments","created_at":"2016-02-05T13:42:07Z","updated_at":"2017-11-08T12:08:11Z","pushed_at":"2017-11-08T07:41:12Z","git_url":"git://github.com/googlesamples/android-architecture.git","ssh_url":"git@github.com:googlesamples/android-architecture.git","clone_url":"https://github.com/googlesamples/android-architecture.git","svn_url":"https://github.com/googlesamples/android-architecture","homepage":"","size":8053,"stargazers_count":22775,"watchers_count":22775,"language":null,"has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6233,"mirror_url":null,"archived":false,"open_issues_count":89,"forks":6233,"open_issues":89,"watchers":22775,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/googlesamples/android-architecture/pulls/453"},"html":{"href":"https://github.com/googlesamples/android-architecture/pull/453"},"issue":{"href":"https://api.github.com/repos/googlesamples/android-architecture/issues/453"},"comments":{"href":"https://api.github.com/repos/googlesamples/android-architecture/issues/453/comments"},"review_comments":{"href":"https://api.github.com/repos/googlesamples/android-architecture/pulls/453/comments"},"review_comment":{"href":"https://api.github.com/repos/googlesamples/android-architecture/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/googlesamples/android-architecture/pulls/453/commits"},"statuses":{"href":"https://api.github.com/repos/googlesamples/android-architecture/statuses/67761105f512cdba07a4f1c5aee0487369d58c2f"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"DougSig"}}