{"action":"created","comment":{"url":"https://api.github.com/repos/motech/modules/pulls/comments/52767635","id":52767635,"diff_hunk":"@@ -47,6 +52,57 @@ public void shouldReturnNullWhenClassIsNotSupported() {\n     }\n \n     @Test\n+    public void shouldReturnNullWhenWrongLookupNameForEncounter() {\n+        String className = OpenMRSEncounter.class.getSimpleName();\n+        Object object = taskDataProvider.lookup(className, \"wrongLookupName\", null);\n+\n+        assertNull(object);\n+        verifyZeroInteractions(encounterService);\n+    }\n+\n+    @Test\n+    public void shouldReturnNullWhenEmptyLookupFieldsForLookupGetEncounterByUuid() {\n+        String className = OpenMRSEncounter.class.getSimpleName();\n+        Map<String, String> lookupFields = new HashMap<>();\n+\n+        when(encounterService.getEncounterByUuid(null)).thenReturn(null);\n+        Object object = taskDataProvider.lookup(className, BY_UUID, lookupFields);\n+\n+        assertNull(object);\n+        verify(encounterService).getEncounterByUuid(null);\n+    }\n+\n+    @Test\n+    public void shouldReturnNullWhenEncounterNotFoundForLookupGetEncounterByUuid() {\n+        String className = OpenMRSEncounter.class.getSimpleName();\n+        Map<String, String> lookupFields = new HashMap<>();\n+        lookupFields.put(UUID, \"4\");\n+\n+        when(encounterService.getEncounterByUuid(\"4\")).thenReturn(null);\n+        Object object = taskDataProvider.lookup(className, BY_UUID, lookupFields);\n+\n+        assertNull(object);\n+        verify(encounterService).getEncounterByUuid(\"4\");\n+    }\n+\n+    @Test\n+    public void shouldReturnEncounterForLookupGetEncounterByUuid() {\n+        String className = OpenMRSEncounter.class.getSimpleName();\n+        Map<String, String> lookupFields = new HashMap<>();\n+        lookupFields.put(UUID, \"5\");\n+\n+        OpenMRSEncounter openMRSEncounter = new OpenMRSEncounter();\n+        openMRSEncounter.setEncounterType(\"encounterTypeTest\");\n+\n+        when(encounterService.getEncounterByUuid(\"5\")).thenReturn(openMRSEncounter);\n+        Object object = taskDataProvider.lookup(className, BY_UUID, lookupFields);","path":"openmrs-19/src/test/java/org/motechproject/openmrs19/tasks/OpenMRSTaskDataProviderTest.java","position":76,"original_position":76,"commit_id":"7e7755805aada84f095fdcd5d6995396bec9f47b","original_commit_id":"7e7755805aada84f095fdcd5d6995396bec9f47b","user":{"login":"pgesek","id":1384169,"avatar_url":"https://avatars.githubusercontent.com/u/1384169?v=3","gravatar_id":"","url":"https://api.github.com/users/pgesek","html_url":"https://github.com/pgesek","followers_url":"https://api.github.com/users/pgesek/followers","following_url":"https://api.github.com/users/pgesek/following{/other_user}","gists_url":"https://api.github.com/users/pgesek/gists{/gist_id}","starred_url":"https://api.github.com/users/pgesek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pgesek/subscriptions","organizations_url":"https://api.github.com/users/pgesek/orgs","repos_url":"https://api.github.com/users/pgesek/repos","events_url":"https://api.github.com/users/pgesek/events{/privacy}","received_events_url":"https://api.github.com/users/pgesek/received_events","type":"User","site_admin":false},"body":"since this this is 'then' line, can we separate it from the line above?","created_at":"2016-02-12T16:59:17Z","updated_at":"2016-02-12T16:59:17Z","html_url":"https://github.com/motech/modules/pull/136#discussion_r52767635","pull_request_url":"https://api.github.com/repos/motech/modules/pulls/136","_links":{"self":{"href":"https://api.github.com/repos/motech/modules/pulls/comments/52767635"},"html":{"href":"https://github.com/motech/modules/pull/136#discussion_r52767635"},"pull_request":{"href":"https://api.github.com/repos/motech/modules/pulls/136"}}},"pull_request":{"url":"https://api.github.com/repos/motech/modules/pulls/136","id":59035850,"html_url":"https://github.com/motech/modules/pull/136","diff_url":"https://github.com/motech/modules/pull/136.diff","patch_url":"https://github.com/motech/modules/pull/136.patch","issue_url":"https://api.github.com/repos/motech/modules/issues/136","number":136,"state":"open","locked":false,"title":"MOTECH-2161: Adds getEncounterByUuid lookup","user":{"login":"kmadej","id":9861925,"avatar_url":"https://avatars.githubusercontent.com/u/9861925?v=3","gravatar_id":"","url":"https://api.github.com/users/kmadej","html_url":"https://github.com/kmadej","followers_url":"https://api.github.com/users/kmadej/followers","following_url":"https://api.github.com/users/kmadej/following{/other_user}","gists_url":"https://api.github.com/users/kmadej/gists{/gist_id}","starred_url":"https://api.github.com/users/kmadej/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kmadej/subscriptions","organizations_url":"https://api.github.com/users/kmadej/orgs","repos_url":"https://api.github.com/users/kmadej/repos","events_url":"https://api.github.com/users/kmadej/events{/privacy}","received_events_url":"https://api.github.com/users/kmadej/received_events","type":"User","site_admin":false},"body":"This PR adds next lookup to a task data source in OpenMRS module. I had to\r\nadjust OpenMRS model in our Motech implementation. The following changes\r\nhad to be done:\r\n\r\n- add display field to Encounter and OpenMRSEncounter\r\n- add display field to Location and OpenMRSFacility\r\n\r\nOpenMRSEncounter and OpenMRSFacility are Motech representation of Encounter\r\nand Location model.\r\n\r\nAfter this changes we have getEncounterByUuid lookup in OpenMRS task data source,\r\nwith the following fields :\r\n\r\nEncounter UUID\r\nEncounter display\r\nEncounter date\r\nProvider UUID\r\nProvider display\r\nLocation UUID\r\nLocation display\r\nPatient UUID\r\nPatient display\r\n\r\nIn the spec for this issue there is information about OpenMRS Form, which is\r\nrelated with Encounter. However, now we don't have Motech representation of\r\nOpenMRS Form and that's why this field is not included in Encounter fields.\r\nI will do it in another PR.\r\n\r\nLookups getPatientByUuid and getPatientByMotechId will be added in the separate\r\nPR.","created_at":"2016-02-11T14:15:42Z","updated_at":"2016-02-12T16:59:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"06cbbf0291d4e94caa383e56ba083eb0ff1ef5dd","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/motech/modules/pulls/136/commits","review_comments_url":"https://api.github.com/repos/motech/modules/pulls/136/comments","review_comment_url":"https://api.github.com/repos/motech/modules/pulls/comments{/number}","comments_url":"https://api.github.com/repos/motech/modules/issues/136/comments","statuses_url":"https://api.github.com/repos/motech/modules/statuses/7e7755805aada84f095fdcd5d6995396bec9f47b","head":{"label":"kmadej:MOTECH-2161-getEncounterByUuid","ref":"MOTECH-2161-getEncounterByUuid","sha":"7e7755805aada84f095fdcd5d6995396bec9f47b","user":{"login":"kmadej","id":9861925,"avatar_url":"https://avatars.githubusercontent.com/u/9861925?v=3","gravatar_id":"","url":"https://api.github.com/users/kmadej","html_url":"https://github.com/kmadej","followers_url":"https://api.github.com/users/kmadej/followers","following_url":"https://api.github.com/users/kmadej/following{/other_user}","gists_url":"https://api.github.com/users/kmadej/gists{/gist_id}","starred_url":"https://api.github.com/users/kmadej/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kmadej/subscriptions","organizations_url":"https://api.github.com/users/kmadej/orgs","repos_url":"https://api.github.com/users/kmadej/repos","events_url":"https://api.github.com/users/kmadej/events{/privacy}","received_events_url":"https://api.github.com/users/kmadej/received_events","type":"User","site_admin":false},"repo":{"id":42516514,"name":"modules","full_name":"kmadej/modules","owner":{"login":"kmadej","id":9861925,"avatar_url":"https://avatars.githubusercontent.com/u/9861925?v=3","gravatar_id":"","url":"https://api.github.com/users/kmadej","html_url":"https://github.com/kmadej","followers_url":"https://api.github.com/users/kmadej/followers","following_url":"https://api.github.com/users/kmadej/following{/other_user}","gists_url":"https://api.github.com/users/kmadej/gists{/gist_id}","starred_url":"https://api.github.com/users/kmadej/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kmadej/subscriptions","organizations_url":"https://api.github.com/users/kmadej/orgs","repos_url":"https://api.github.com/users/kmadej/repos","events_url":"https://api.github.com/users/kmadej/events{/privacy}","received_events_url":"https://api.github.com/users/kmadej/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kmadej/modules","description":" Mobile Technology for Community Health - Modules","fork":true,"url":"https://api.github.com/repos/kmadej/modules","forks_url":"https://api.github.com/repos/kmadej/modules/forks","keys_url":"https://api.github.com/repos/kmadej/modules/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kmadej/modules/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kmadej/modules/teams","hooks_url":"https://api.github.com/repos/kmadej/modules/hooks","issue_events_url":"https://api.github.com/repos/kmadej/modules/issues/events{/number}","events_url":"https://api.github.com/repos/kmadej/modules/events","assignees_url":"https://api.github.com/repos/kmadej/modules/assignees{/user}","branches_url":"https://api.github.com/repos/kmadej/modules/branches{/branch}","tags_url":"https://api.github.com/repos/kmadej/modules/tags","blobs_url":"https://api.github.com/repos/kmadej/modules/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kmadej/modules/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kmadej/modules/git/refs{/sha}","trees_url":"https://api.github.com/repos/kmadej/modules/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kmadej/modules/statuses/{sha}","languages_url":"https://api.github.com/repos/kmadej/modules/languages","stargazers_url":"https://api.github.com/repos/kmadej/modules/stargazers","contributors_url":"https://api.github.com/repos/kmadej/modules/contributors","subscribers_url":"https://api.github.com/repos/kmadej/modules/subscribers","subscription_url":"https://api.github.com/repos/kmadej/modules/subscription","commits_url":"https://api.github.com/repos/kmadej/modules/commits{/sha}","git_commits_url":"https://api.github.com/repos/kmadej/modules/git/commits{/sha}","comments_url":"https://api.github.com/repos/kmadej/modules/comments{/number}","issue_comment_url":"https://api.github.com/repos/kmadej/modules/issues/comments{/number}","contents_url":"https://api.github.com/repos/kmadej/modules/contents/{+path}","compare_url":"https://api.github.com/repos/kmadej/modules/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kmadej/modules/merges","archive_url":"https://api.github.com/repos/kmadej/modules/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kmadej/modules/downloads","issues_url":"https://api.github.com/repos/kmadej/modules/issues{/number}","pulls_url":"https://api.github.com/repos/kmadej/modules/pulls{/number}","milestones_url":"https://api.github.com/repos/kmadej/modules/milestones{/number}","notifications_url":"https://api.github.com/repos/kmadej/modules/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kmadej/modules/labels{/name}","releases_url":"https://api.github.com/repos/kmadej/modules/releases{/id}","deployments_url":"https://api.github.com/repos/kmadej/modules/deployments","created_at":"2015-09-15T11:57:43Z","updated_at":"2015-09-15T11:57:46Z","pushed_at":"2016-02-11T14:14:05Z","git_url":"git://github.com/kmadej/modules.git","ssh_url":"git@github.com:kmadej/modules.git","clone_url":"https://github.com/kmadej/modules.git","svn_url":"https://github.com/kmadej/modules","homepage":"http://modules.motechproject.org","size":31477,"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":"motech:master","ref":"master","sha":"cda00523ac7ce38dba139b6a20ee75b26a3634ca","user":{"login":"motech","id":477919,"avatar_url":"https://avatars.githubusercontent.com/u/477919?v=3","gravatar_id":"","url":"https://api.github.com/users/motech","html_url":"https://github.com/motech","followers_url":"https://api.github.com/users/motech/followers","following_url":"https://api.github.com/users/motech/following{/other_user}","gists_url":"https://api.github.com/users/motech/gists{/gist_id}","starred_url":"https://api.github.com/users/motech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/motech/subscriptions","organizations_url":"https://api.github.com/users/motech/orgs","repos_url":"https://api.github.com/users/motech/repos","events_url":"https://api.github.com/users/motech/events{/privacy}","received_events_url":"https://api.github.com/users/motech/received_events","type":"Organization","site_admin":false},"repo":{"id":19785525,"name":"modules","full_name":"motech/modules","owner":{"login":"motech","id":477919,"avatar_url":"https://avatars.githubusercontent.com/u/477919?v=3","gravatar_id":"","url":"https://api.github.com/users/motech","html_url":"https://github.com/motech","followers_url":"https://api.github.com/users/motech/followers","following_url":"https://api.github.com/users/motech/following{/other_user}","gists_url":"https://api.github.com/users/motech/gists{/gist_id}","starred_url":"https://api.github.com/users/motech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/motech/subscriptions","organizations_url":"https://api.github.com/users/motech/orgs","repos_url":"https://api.github.com/users/motech/repos","events_url":"https://api.github.com/users/motech/events{/privacy}","received_events_url":"https://api.github.com/users/motech/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/motech/modules","description":" Mobile Technology for Community Health - Modules","fork":false,"url":"https://api.github.com/repos/motech/modules","forks_url":"https://api.github.com/repos/motech/modules/forks","keys_url":"https://api.github.com/repos/motech/modules/keys{/key_id}","collaborators_url":"https://api.github.com/repos/motech/modules/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/motech/modules/teams","hooks_url":"https://api.github.com/repos/motech/modules/hooks","issue_events_url":"https://api.github.com/repos/motech/modules/issues/events{/number}","events_url":"https://api.github.com/repos/motech/modules/events","assignees_url":"https://api.github.com/repos/motech/modules/assignees{/user}","branches_url":"https://api.github.com/repos/motech/modules/branches{/branch}","tags_url":"https://api.github.com/repos/motech/modules/tags","blobs_url":"https://api.github.com/repos/motech/modules/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/motech/modules/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/motech/modules/git/refs{/sha}","trees_url":"https://api.github.com/repos/motech/modules/git/trees{/sha}","statuses_url":"https://api.github.com/repos/motech/modules/statuses/{sha}","languages_url":"https://api.github.com/repos/motech/modules/languages","stargazers_url":"https://api.github.com/repos/motech/modules/stargazers","contributors_url":"https://api.github.com/repos/motech/modules/contributors","subscribers_url":"https://api.github.com/repos/motech/modules/subscribers","subscription_url":"https://api.github.com/repos/motech/modules/subscription","commits_url":"https://api.github.com/repos/motech/modules/commits{/sha}","git_commits_url":"https://api.github.com/repos/motech/modules/git/commits{/sha}","comments_url":"https://api.github.com/repos/motech/modules/comments{/number}","issue_comment_url":"https://api.github.com/repos/motech/modules/issues/comments{/number}","contents_url":"https://api.github.com/repos/motech/modules/contents/{+path}","compare_url":"https://api.github.com/repos/motech/modules/compare/{base}...{head}","merges_url":"https://api.github.com/repos/motech/modules/merges","archive_url":"https://api.github.com/repos/motech/modules/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/motech/modules/downloads","issues_url":"https://api.github.com/repos/motech/modules/issues{/number}","pulls_url":"https://api.github.com/repos/motech/modules/pulls{/number}","milestones_url":"https://api.github.com/repos/motech/modules/milestones{/number}","notifications_url":"https://api.github.com/repos/motech/modules/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/motech/modules/labels{/name}","releases_url":"https://api.github.com/repos/motech/modules/releases{/id}","deployments_url":"https://api.github.com/repos/motech/modules/deployments","created_at":"2014-05-14T15:41:17Z","updated_at":"2016-01-13T08:57:18Z","pushed_at":"2016-02-12T16:18:55Z","git_url":"git://github.com/motech/modules.git","ssh_url":"git@github.com:motech/modules.git","clone_url":"https://github.com/motech/modules.git","svn_url":"https://github.com/motech/modules","homepage":"http://modules.motechproject.org","size":31673,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":30,"mirror_url":null,"open_issues_count":8,"forks":30,"open_issues":8,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/motech/modules/pulls/136"},"html":{"href":"https://github.com/motech/modules/pull/136"},"issue":{"href":"https://api.github.com/repos/motech/modules/issues/136"},"comments":{"href":"https://api.github.com/repos/motech/modules/issues/136/comments"},"review_comments":{"href":"https://api.github.com/repos/motech/modules/pulls/136/comments"},"review_comment":{"href":"https://api.github.com/repos/motech/modules/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/motech/modules/pulls/136/commits"},"statuses":{"href":"https://api.github.com/repos/motech/modules/statuses/7e7755805aada84f095fdcd5d6995396bec9f47b"}}}}