{"action":"created","comment":{"url":"https://api.github.com/repos/openmrs/openmrs-core/pulls/comments/91599597","pull_request_review_id":12109967,"id":91599597,"diff_hunk":"@@ -521,8 +526,128 @@ public void removePatientFromCohort_shouldSaveCohortAfterRemovingPatient() throw\n \t\t// make a patient, add it using the method\n \t\tPatient patientToAddThenRemove = new Patient(4);\n \t\tservice.addPatientToCohort(service.getCohort(2), patientToAddThenRemove);\n-\t\tassertTrue(service.getCohort(2).contains(patientToAddThenRemove));\n+\t\tassertTrue(service.getCohort(2).contains(patientToAddThenRemove.getPatientId()));\n \t\tservice.removePatientFromCohort(service.getCohort(2), patientToAddThenRemove);\n-\t\tassertFalse(service.getCohort(2).contains(patientToAddThenRemove));\n+\t\tList<CohortMembership> memberList = service.getCohort(2)\n+\t\t\t\t.getMembers().stream()\n+\t\t\t\t.filter(m -> m.getPatient().getPatientId().equals(patientToAddThenRemove.getPatientId()))\n+\t\t\t\t.collect(Collectors.toList());\n+\t\tCohortMembership memberWithPatientToRemove = memberList.get(0);\n+\t\tassertNotNull(memberWithPatientToRemove.getEndDate());\n+\t}\n+\n+\t/**\n+\t * @verifies {@link CohortService#addMembershipToCohort(Cohort, CohortMembership)}\n+\t * test = should add membership to cohort\n+\t */\n+\t@Test\n+\t@Verifies(value = \"should add membership to cohort\", method = \"addMembershipToCohort(Cohort, CohortMembership)\")\n+\tpublic void addMembershipToCohort_shouldAddMembershipToCohort() throws Exception {\n+\t\texecuteDataSet(COHORT_XML);\n+\t\t\n+\t\tPatient p = new Patient(4);\n+\t\tif (!service.getCohort(1).contains(p)) {\n+\t\t\tCohortMembership memberToAdd = new CohortMembership(p);\n+\t\t\tservice.addMembershipToCohort(service.getCohort(1), memberToAdd);\n+\t\t\tassertTrue(service.getCohort(1).contains(p));\n+\t\t}\n+\t}\n+\n+\t/**\n+\t * @verifies {@link CohortService#removeMemberShipFromCohort(Cohort, CohortMembership)}\n+\t * test = should remove membership from cohort\n+\t */\n+\t@Test\n+\t@Verifies(value = \"should remove membership from cohort\", method = \"removeMemberShipFromCohort(Cohort, CohortMembership)\")\n+\tpublic void removeMembershipFromCohort_shouldRemoveMembershipFromCohort() throws Exception {\n+\t\texecuteDataSet(COHORT_XML);\n+\n+\t\tCohortMembership memberToAddThenRemove = new CohortMembership(new Patient(4));\n+\t\tservice.addMembershipToCohort(service.getCohort(1), memberToAddThenRemove);\n+\t\tassertTrue(service.getCohort(1).contains(memberToAddThenRemove.getPatient()));\n+\t\tassertNull(memberToAddThenRemove.getEndDate());\n+\n+\t\tservice.removeMemberShipFromCohort(service.getCohort(1), memberToAddThenRemove);\n+\t\tassertNotNull(memberToAddThenRemove.getEndDate());\n+\t}\n+\n+\t/**\n+\t * @verifies {@link CohortService#patientVoided(Patient)}\n+\t * test = should void membership for every patient voided\n+\t */\n+\t@Test\n+\t@Verifies(value = \"should void membership for every patient voided\", method = \"patientVoided(Patient)\")\n+\tpublic void patientVoided_shouldVoidMemberships() throws Exception {\n+\t\texecuteDataSet(COHORT_XML);\n+\n+\t\tCohort cohort = Context.getCohortService().getCohort(2);\n+\t\tPatient voidedPatient = new Patient(7);\n+\t\tvoidedPatient.setVoided(true);\n+\t\tvoidedPatient.setDateVoided(new Date());\n+\t\tvoidedPatient.setVoidedBy(Context.getAuthenticatedUser());\n+\t\tvoidedPatient.setVoidReason(\"Voided as a result of the associated patient getting voided\");\n+\n+\t\tCohortMembership newMemberContainingVoidedPatient = new CohortMembership(voidedPatient);\n+\t\tcohort.addMembership(newMemberContainingVoidedPatient);\n+\t\tassertTrue(cohort.contains(voidedPatient));\n+\n+\t\tservice.patientVoided(voidedPatient);\n+\t\tassertEquals(voidedPatient.getVoided(), newMemberContainingVoidedPatient.getVoided());","path":"api/src/test/java/org/openmrs/api/CohortServiceTest.java","position":158,"original_position":158,"commit_id":"d89a6e5d5b5bce17b4ccb4783e3ab246948b2c50","original_commit_id":"52deaff6e3d6ea68062bab9388720e7f3334bf60","user":{"login":"vshl","id":193819,"avatar_url":"https://avatars.githubusercontent.com/u/193819?v=3","gravatar_id":"","url":"https://api.github.com/users/vshl","html_url":"https://github.com/vshl","followers_url":"https://api.github.com/users/vshl/followers","following_url":"https://api.github.com/users/vshl/following{/other_user}","gists_url":"https://api.github.com/users/vshl/gists{/gist_id}","starred_url":"https://api.github.com/users/vshl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vshl/subscriptions","organizations_url":"https://api.github.com/users/vshl/orgs","repos_url":"https://api.github.com/users/vshl/repos","events_url":"https://api.github.com/users/vshl/events{/privacy}","received_events_url":"https://api.github.com/users/vshl/received_events","type":"User","site_admin":false},"body":"Agree. assertTrue makes more sense.","created_at":"2016-12-08T20:26:38Z","updated_at":"2016-12-08T20:26:38Z","html_url":"https://github.com/openmrs/openmrs-core/pull/1831#discussion_r91599597","pull_request_url":"https://api.github.com/repos/openmrs/openmrs-core/pulls/1831","_links":{"self":{"href":"https://api.github.com/repos/openmrs/openmrs-core/pulls/comments/91599597"},"html":{"href":"https://github.com/openmrs/openmrs-core/pull/1831#discussion_r91599597"},"pull_request":{"href":"https://api.github.com/repos/openmrs/openmrs-core/pulls/1831"}}},"pull_request":{"url":"https://api.github.com/repos/openmrs/openmrs-core/pulls/1831","id":85175374,"html_url":"https://github.com/openmrs/openmrs-core/pull/1831","diff_url":"https://github.com/openmrs/openmrs-core/pull/1831.diff","patch_url":"https://github.com/openmrs/openmrs-core/pull/1831.patch","issue_url":"https://api.github.com/repos/openmrs/openmrs-core/issues/1831","number":1831,"state":"open","locked":false,"title":"TRUNK-4906 Expanded Cohort details","user":{"login":"vshl","id":193819,"avatar_url":"https://avatars.githubusercontent.com/u/193819?v=3","gravatar_id":"","url":"https://api.github.com/users/vshl","html_url":"https://github.com/vshl","followers_url":"https://api.github.com/users/vshl/followers","following_url":"https://api.github.com/users/vshl/following{/other_user}","gists_url":"https://api.github.com/users/vshl/gists{/gist_id}","starred_url":"https://api.github.com/users/vshl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vshl/subscriptions","organizations_url":"https://api.github.com/users/vshl/orgs","repos_url":"https://api.github.com/users/vshl/repos","events_url":"https://api.github.com/users/vshl/events{/privacy}","received_events_url":"https://api.github.com/users/vshl/received_events","type":"User","site_admin":false},"body":"<!--- Provide PR Title above as: 'TRUNK-JiraIssueNumber JiraIssueTitle' -->\n## Description\n\n<!--- Describe your changes in detail -->\n\nAdded CohortMember object to include membership details of Cohort Members. The cohort_member table has two additional columns start_date and end_date.\n## Related Issue\n\n<!--- This project only accepts pull requests related to open issues -->\n\n<!--- If suggesting a new feature or change, please discuss it in an issue\nfirst -->\n\n<!--- If fixing a bug, there should be an issue describing it with steps to\nreproduce -->\n\n<!--- Please link to the issue here: -->\n\nsee https://issues.openmrs.org/browse/TRUNK-4906\n## Checklist:\n\n<!--- Go over all the following points, and put an `x` in all the boxes that\napply. -->\n\n<!--- If you're unsure about any of these, don't hesitate to ask. We're here to\nhelp! -->\n- [x] My pull request only contains one single commit.\n- [x] My pull request is based on the latest master branch\n  `git pull --rebase upstream master`.\n- [x] I ran `mvn clean package` right before creating this pull request and\n  added all formatting changes to my commit.\n- [x] My code follows the code style of this project.\n- [x] I have read the **CONTRIBUTING** document.\n- [x] I have added tests to cover my changes.\n- [x] All new and existing tests passed.\n","created_at":"2016-09-14T06:54:21Z","updated_at":"2016-12-08T20:26:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4bc93c443b725b43ea8ba143d834ec839af468e5","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/openmrs/openmrs-core/pulls/1831/commits","review_comments_url":"https://api.github.com/repos/openmrs/openmrs-core/pulls/1831/comments","review_comment_url":"https://api.github.com/repos/openmrs/openmrs-core/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openmrs/openmrs-core/issues/1831/comments","statuses_url":"https://api.github.com/repos/openmrs/openmrs-core/statuses/d89a6e5d5b5bce17b4ccb4783e3ab246948b2c50","head":{"label":"vshl:TRUNK-4906-Expanded-Cohort-Details","ref":"TRUNK-4906-Expanded-Cohort-Details","sha":"d89a6e5d5b5bce17b4ccb4783e3ab246948b2c50","user":{"login":"vshl","id":193819,"avatar_url":"https://avatars.githubusercontent.com/u/193819?v=3","gravatar_id":"","url":"https://api.github.com/users/vshl","html_url":"https://github.com/vshl","followers_url":"https://api.github.com/users/vshl/followers","following_url":"https://api.github.com/users/vshl/following{/other_user}","gists_url":"https://api.github.com/users/vshl/gists{/gist_id}","starred_url":"https://api.github.com/users/vshl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vshl/subscriptions","organizations_url":"https://api.github.com/users/vshl/orgs","repos_url":"https://api.github.com/users/vshl/repos","events_url":"https://api.github.com/users/vshl/events{/privacy}","received_events_url":"https://api.github.com/users/vshl/received_events","type":"User","site_admin":false},"repo":{"id":63982007,"name":"openmrs-core","full_name":"vshl/openmrs-core","owner":{"login":"vshl","id":193819,"avatar_url":"https://avatars.githubusercontent.com/u/193819?v=3","gravatar_id":"","url":"https://api.github.com/users/vshl","html_url":"https://github.com/vshl","followers_url":"https://api.github.com/users/vshl/followers","following_url":"https://api.github.com/users/vshl/following{/other_user}","gists_url":"https://api.github.com/users/vshl/gists{/gist_id}","starred_url":"https://api.github.com/users/vshl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vshl/subscriptions","organizations_url":"https://api.github.com/users/vshl/orgs","repos_url":"https://api.github.com/users/vshl/repos","events_url":"https://api.github.com/users/vshl/events{/privacy}","received_events_url":"https://api.github.com/users/vshl/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/vshl/openmrs-core","description":"OpenMRS API and web application code","fork":true,"url":"https://api.github.com/repos/vshl/openmrs-core","forks_url":"https://api.github.com/repos/vshl/openmrs-core/forks","keys_url":"https://api.github.com/repos/vshl/openmrs-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vshl/openmrs-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vshl/openmrs-core/teams","hooks_url":"https://api.github.com/repos/vshl/openmrs-core/hooks","issue_events_url":"https://api.github.com/repos/vshl/openmrs-core/issues/events{/number}","events_url":"https://api.github.com/repos/vshl/openmrs-core/events","assignees_url":"https://api.github.com/repos/vshl/openmrs-core/assignees{/user}","branches_url":"https://api.github.com/repos/vshl/openmrs-core/branches{/branch}","tags_url":"https://api.github.com/repos/vshl/openmrs-core/tags","blobs_url":"https://api.github.com/repos/vshl/openmrs-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vshl/openmrs-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vshl/openmrs-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/vshl/openmrs-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vshl/openmrs-core/statuses/{sha}","languages_url":"https://api.github.com/repos/vshl/openmrs-core/languages","stargazers_url":"https://api.github.com/repos/vshl/openmrs-core/stargazers","contributors_url":"https://api.github.com/repos/vshl/openmrs-core/contributors","subscribers_url":"https://api.github.com/repos/vshl/openmrs-core/subscribers","subscription_url":"https://api.github.com/repos/vshl/openmrs-core/subscription","commits_url":"https://api.github.com/repos/vshl/openmrs-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/vshl/openmrs-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/vshl/openmrs-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/vshl/openmrs-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/vshl/openmrs-core/contents/{+path}","compare_url":"https://api.github.com/repos/vshl/openmrs-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vshl/openmrs-core/merges","archive_url":"https://api.github.com/repos/vshl/openmrs-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vshl/openmrs-core/downloads","issues_url":"https://api.github.com/repos/vshl/openmrs-core/issues{/number}","pulls_url":"https://api.github.com/repos/vshl/openmrs-core/pulls{/number}","milestones_url":"https://api.github.com/repos/vshl/openmrs-core/milestones{/number}","notifications_url":"https://api.github.com/repos/vshl/openmrs-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vshl/openmrs-core/labels{/name}","releases_url":"https://api.github.com/repos/vshl/openmrs-core/releases{/id}","deployments_url":"https://api.github.com/repos/vshl/openmrs-core/deployments","created_at":"2016-07-22T20:43:22Z","updated_at":"2016-07-22T20:43:39Z","pushed_at":"2016-12-08T18:36:09Z","git_url":"git://github.com/vshl/openmrs-core.git","ssh_url":"git@github.com:vshl/openmrs-core.git","clone_url":"https://github.com/vshl/openmrs-core.git","svn_url":"https://github.com/vshl/openmrs-core","homepage":"http://openmrs.org","size":221782,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"openmrs:master","ref":"master","sha":"6744580c6a73a299b57991414f85619b8b95aeff","user":{"login":"openmrs","id":860776,"avatar_url":"https://avatars.githubusercontent.com/u/860776?v=3","gravatar_id":"","url":"https://api.github.com/users/openmrs","html_url":"https://github.com/openmrs","followers_url":"https://api.github.com/users/openmrs/followers","following_url":"https://api.github.com/users/openmrs/following{/other_user}","gists_url":"https://api.github.com/users/openmrs/gists{/gist_id}","starred_url":"https://api.github.com/users/openmrs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openmrs/subscriptions","organizations_url":"https://api.github.com/users/openmrs/orgs","repos_url":"https://api.github.com/users/openmrs/repos","events_url":"https://api.github.com/users/openmrs/events{/privacy}","received_events_url":"https://api.github.com/users/openmrs/received_events","type":"Organization","site_admin":false},"repo":{"id":5187976,"name":"openmrs-core","full_name":"openmrs/openmrs-core","owner":{"login":"openmrs","id":860776,"avatar_url":"https://avatars.githubusercontent.com/u/860776?v=3","gravatar_id":"","url":"https://api.github.com/users/openmrs","html_url":"https://github.com/openmrs","followers_url":"https://api.github.com/users/openmrs/followers","following_url":"https://api.github.com/users/openmrs/following{/other_user}","gists_url":"https://api.github.com/users/openmrs/gists{/gist_id}","starred_url":"https://api.github.com/users/openmrs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openmrs/subscriptions","organizations_url":"https://api.github.com/users/openmrs/orgs","repos_url":"https://api.github.com/users/openmrs/repos","events_url":"https://api.github.com/users/openmrs/events{/privacy}","received_events_url":"https://api.github.com/users/openmrs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openmrs/openmrs-core","description":"OpenMRS API and web application code","fork":false,"url":"https://api.github.com/repos/openmrs/openmrs-core","forks_url":"https://api.github.com/repos/openmrs/openmrs-core/forks","keys_url":"https://api.github.com/repos/openmrs/openmrs-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openmrs/openmrs-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openmrs/openmrs-core/teams","hooks_url":"https://api.github.com/repos/openmrs/openmrs-core/hooks","issue_events_url":"https://api.github.com/repos/openmrs/openmrs-core/issues/events{/number}","events_url":"https://api.github.com/repos/openmrs/openmrs-core/events","assignees_url":"https://api.github.com/repos/openmrs/openmrs-core/assignees{/user}","branches_url":"https://api.github.com/repos/openmrs/openmrs-core/branches{/branch}","tags_url":"https://api.github.com/repos/openmrs/openmrs-core/tags","blobs_url":"https://api.github.com/repos/openmrs/openmrs-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openmrs/openmrs-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openmrs/openmrs-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/openmrs/openmrs-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openmrs/openmrs-core/statuses/{sha}","languages_url":"https://api.github.com/repos/openmrs/openmrs-core/languages","stargazers_url":"https://api.github.com/repos/openmrs/openmrs-core/stargazers","contributors_url":"https://api.github.com/repos/openmrs/openmrs-core/contributors","subscribers_url":"https://api.github.com/repos/openmrs/openmrs-core/subscribers","subscription_url":"https://api.github.com/repos/openmrs/openmrs-core/subscription","commits_url":"https://api.github.com/repos/openmrs/openmrs-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/openmrs/openmrs-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/openmrs/openmrs-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/openmrs/openmrs-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/openmrs/openmrs-core/contents/{+path}","compare_url":"https://api.github.com/repos/openmrs/openmrs-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openmrs/openmrs-core/merges","archive_url":"https://api.github.com/repos/openmrs/openmrs-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openmrs/openmrs-core/downloads","issues_url":"https://api.github.com/repos/openmrs/openmrs-core/issues{/number}","pulls_url":"https://api.github.com/repos/openmrs/openmrs-core/pulls{/number}","milestones_url":"https://api.github.com/repos/openmrs/openmrs-core/milestones{/number}","notifications_url":"https://api.github.com/repos/openmrs/openmrs-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openmrs/openmrs-core/labels{/name}","releases_url":"https://api.github.com/repos/openmrs/openmrs-core/releases{/id}","deployments_url":"https://api.github.com/repos/openmrs/openmrs-core/deployments","created_at":"2012-07-26T04:54:29Z","updated_at":"2016-12-05T10:41:34Z","pushed_at":"2016-12-08T18:36:10Z","git_url":"git://github.com/openmrs/openmrs-core.git","ssh_url":"git@github.com:openmrs/openmrs-core.git","clone_url":"https://github.com/openmrs/openmrs-core.git","svn_url":"https://github.com/openmrs/openmrs-core","homepage":"http://openmrs.org","size":240612,"stargazers_count":385,"watchers_count":385,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1593,"mirror_url":null,"open_issues_count":6,"forks":1593,"open_issues":6,"watchers":385,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openmrs/openmrs-core/pulls/1831"},"html":{"href":"https://github.com/openmrs/openmrs-core/pull/1831"},"issue":{"href":"https://api.github.com/repos/openmrs/openmrs-core/issues/1831"},"comments":{"href":"https://api.github.com/repos/openmrs/openmrs-core/issues/1831/comments"},"review_comments":{"href":"https://api.github.com/repos/openmrs/openmrs-core/pulls/1831/comments"},"review_comment":{"href":"https://api.github.com/repos/openmrs/openmrs-core/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openmrs/openmrs-core/pulls/1831/commits"},"statuses":{"href":"https://api.github.com/repos/openmrs/openmrs-core/statuses/d89a6e5d5b5bce17b4ccb4783e3ab246948b2c50"}}}}
{"actor":{"display_login":"vshl"}}