{"action":"created","comment":{"url":"https://api.github.com/repos/TEAMMATES/teammates/pulls/comments/123898263","pull_request_review_id":46144888,"id":123898263,"diff_hunk":"@@ -0,0 +1,105 @@\n+package teammates.test.cases.search;\n+\n+import java.util.ArrayList;\n+import java.util.Arrays;\n+import java.util.Comparator;\n+\n+import org.testng.annotations.Test;\n+\n+import teammates.common.datatransfer.FeedbackResponseCommentSearchResultBundle;\n+import teammates.common.datatransfer.attributes.FeedbackResponseCommentAttributes;\n+import teammates.common.datatransfer.attributes.InstructorAttributes;\n+import teammates.storage.api.FeedbackResponseCommentsDb;\n+\n+/**\n+ * SUT: {@link FeedbackResponseCommentsDb},\n+ *      {@link teammates.storage.search.FeedbackResponseCommentDocument},\n+ *      {@link teammates.storage.search.FeedbackResponseCommentSearchQuery}.\n+ */\n+public class FeedbackResponseCommentSearchTest extends BaseSearchTest {\n+\n+    @Test\n+    public void allTests() {\n+        FeedbackResponseCommentsDb commentsDb = new FeedbackResponseCommentsDb();\n+\n+        FeedbackResponseCommentAttributes frc1I1Q1S1 = dataBundle.feedbackResponseComments\n+                .get(\"comment1FromT1C1ToR1Q1S1C1\");\n+        FeedbackResponseCommentAttributes frc1I1Q2S1 = dataBundle.feedbackResponseComments\n+                .get(\"comment1FromT1C1ToR1Q2S1C1\");\n+        ArrayList<InstructorAttributes> instructors = new ArrayList<InstructorAttributes>();\n+        instructors.add(dataBundle.instructors.get(\"instructor1OfCourse1\"));\n+\n+        ______TS(\"success: search for comments in whole system; query string does not match any comment\");\n+\n+        FeedbackResponseCommentSearchResultBundle bundle = commentsDb.search(\"non-existent\", instructors);\n+        assertEquals(0, bundle.numberOfResults);\n+        assertTrue(bundle.comments.isEmpty());\n+\n+        ______TS(\"success: search for comments in whole system; query string matches single comment\");\n+\n+        bundle = commentsDb.search(\"\\\"Instructor 1 comment to student 1 self feedback Question 2\\\"\", instructors);\n+        verifySearchResults(bundle, frc1I1Q2S1);\n+\n+        ______TS(\"success: search for comments in instructor's course; query string matches some comments\");\n+\n+        bundle = commentsDb.search(\"\\\"self feedback\\\"\", instructors);\n+        verifySearchResults(bundle, frc1I1Q1S1, frc1I1Q2S1);\n+\n+        ______TS(\"success: search for comments in instructor's course; query string is case in-sensitive\");\n+\n+        bundle = commentsDb.search(\"\\\"Instructor 1 COMMENT to student 1 self feedback Question 2\\\"\", instructors);\n+        verifySearchResults(bundle, frc1I1Q2S1);\n+\n+        ______TS(\"success: search for comments searchable by feedbackSessionName\");\n+\n+        bundle = commentsDb.search(\"\\\"First feedback session\\\"\", instructors);\n+        verifySearchResults(bundle, frc1I1Q2S1, frc1I1Q1S1);\n+\n+        ______TS(\"success: search for comments using Instructor's email\");\n+\n+        bundle = commentsDb.search(\"instructor1@course1.tmt\", instructors);\n+        verifySearchResults(bundle, frc1I1Q2S1, frc1I1Q1S1);\n+\n+        ______TS(\"success: search for comments using Student name\");\n+\n+        bundle = commentsDb.search(\"Student in two courses\", instructors);\n+        verifySearchResults(bundle, frc1I1Q1S1, frc1I1Q2S1);\n+\n+        ______TS(\"success: search for comments; no results for deleted comment\");\n+\n+        commentsDb.deleteDocument(frc1I1Q2S1);\n+        bundle = commentsDb.search(\"\\\"Instructor 1 comment to student 1 self feedback Question 2\\\"\", instructors);\n+        verifySearchResults(bundle);\n+\n+    }\n+\n+    /*\n+     * Verifies that search results match with expected output.\n+     * Compares the text for each comment as it is unique.\n+     *\n+     * @param actual the results from the search query.\n+     * @param expected the expected results for the search query.\n+     */\n+    private static void verifySearchResults(FeedbackResponseCommentSearchResultBundle actual,\n+                FeedbackResponseCommentAttributes... expected) {\n+        assertEquals(expected.length, actual.numberOfResults);\n+        assertEquals(expected.length, actual.comments.size());\n+        sortFeedbackResponseCommentsByCreationTime(expected);\n+        int i = 0;\n+        for (String key : actual.comments.keySet()) {\n+            for (FeedbackResponseCommentAttributes comment : actual.comments.get(key)) {\n+                assertEquals(expected[i].commentText, comment.commentText);\n+                i++;\n+            }\n+        }\n+    }\n+\n+    private static void sortFeedbackResponseCommentsByCreationTime(FeedbackResponseCommentAttributes...frcsToSort) {","path":"src/test/java/teammates/test/cases/search/FeedbackResponseCommentSearchTest.java","position":null,"original_position":97,"commit_id":"07ca5724974f996d23b6592f34487ec822857caf","original_commit_id":"cfc2226cbb97c2cbd417376971f3be84c59ceb91","user":{"login":"Mynk96","id":17481466,"avatar_url":"https://avatars1.githubusercontent.com/u/17481466?v=3","gravatar_id":"","url":"https://api.github.com/users/Mynk96","html_url":"https://github.com/Mynk96","followers_url":"https://api.github.com/users/Mynk96/followers","following_url":"https://api.github.com/users/Mynk96/following{/other_user}","gists_url":"https://api.github.com/users/Mynk96/gists{/gist_id}","starred_url":"https://api.github.com/users/Mynk96/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mynk96/subscriptions","organizations_url":"https://api.github.com/users/Mynk96/orgs","repos_url":"https://api.github.com/users/Mynk96/repos","events_url":"https://api.github.com/users/Mynk96/events{/privacy}","received_events_url":"https://api.github.com/users/Mynk96/received_events","type":"User","site_admin":false},"body":"Yes, As we have already one method to sort `List<FeedbackResponseCommentAttributes>` I have added the same method to sort `FeedbackResponseCommentAttributes[ ]` in `FeedbackResponseCommentAttributes.java` and used this method in testing","created_at":"2017-06-25T12:54:13Z","updated_at":"2017-06-25T12:54:13Z","html_url":"https://github.com/TEAMMATES/teammates/pull/7576#discussion_r123898263","pull_request_url":"https://api.github.com/repos/TEAMMATES/teammates/pulls/7576","_links":{"self":{"href":"https://api.github.com/repos/TEAMMATES/teammates/pulls/comments/123898263"},"html":{"href":"https://github.com/TEAMMATES/teammates/pull/7576#discussion_r123898263"},"pull_request":{"href":"https://api.github.com/repos/TEAMMATES/teammates/pulls/7576"}}},"pull_request":{"url":"https://api.github.com/repos/TEAMMATES/teammates/pulls/7576","id":127267117,"html_url":"https://github.com/TEAMMATES/teammates/pull/7576","diff_url":"https://github.com/TEAMMATES/teammates/pull/7576.diff","patch_url":"https://github.com/TEAMMATES/teammates/pull/7576.patch","issue_url":"https://api.github.com/repos/TEAMMATES/teammates/issues/7576","number":7576,"state":"open","locked":false,"title":"Add FeedbackResponseCommentSearchTest to test searching for feedback response comments #6550","user":{"login":"Mynk96","id":17481466,"avatar_url":"https://avatars1.githubusercontent.com/u/17481466?v=3","gravatar_id":"","url":"https://api.github.com/users/Mynk96","html_url":"https://github.com/Mynk96","followers_url":"https://api.github.com/users/Mynk96/followers","following_url":"https://api.github.com/users/Mynk96/following{/other_user}","gists_url":"https://api.github.com/users/Mynk96/gists{/gist_id}","starred_url":"https://api.github.com/users/Mynk96/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mynk96/subscriptions","organizations_url":"https://api.github.com/users/Mynk96/orgs","repos_url":"https://api.github.com/users/Mynk96/repos","events_url":"https://api.github.com/users/Mynk96/events{/privacy}","received_events_url":"https://api.github.com/users/Mynk96/received_events","type":"User","site_admin":false},"body":"Fixes #6550\r\n\r\nAdded FeedbackResponseCommentSearchTest","created_at":"2017-06-23T18:49:30Z","updated_at":"2017-06-25T12:54:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2b3ec96cd1226a4bb3c526003347fa2188835b12","assignee":{"login":"chowyb","id":7546744,"avatar_url":"https://avatars0.githubusercontent.com/u/7546744?v=3","gravatar_id":"","url":"https://api.github.com/users/chowyb","html_url":"https://github.com/chowyb","followers_url":"https://api.github.com/users/chowyb/followers","following_url":"https://api.github.com/users/chowyb/following{/other_user}","gists_url":"https://api.github.com/users/chowyb/gists{/gist_id}","starred_url":"https://api.github.com/users/chowyb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chowyb/subscriptions","organizations_url":"https://api.github.com/users/chowyb/orgs","repos_url":"https://api.github.com/users/chowyb/repos","events_url":"https://api.github.com/users/chowyb/events{/privacy}","received_events_url":"https://api.github.com/users/chowyb/received_events","type":"User","site_admin":false},"assignees":[{"login":"chowyb","id":7546744,"avatar_url":"https://avatars0.githubusercontent.com/u/7546744?v=3","gravatar_id":"","url":"https://api.github.com/users/chowyb","html_url":"https://github.com/chowyb","followers_url":"https://api.github.com/users/chowyb/followers","following_url":"https://api.github.com/users/chowyb/following{/other_user}","gists_url":"https://api.github.com/users/chowyb/gists{/gist_id}","starred_url":"https://api.github.com/users/chowyb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chowyb/subscriptions","organizations_url":"https://api.github.com/users/chowyb/orgs","repos_url":"https://api.github.com/users/chowyb/repos","events_url":"https://api.github.com/users/chowyb/events{/privacy}","received_events_url":"https://api.github.com/users/chowyb/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/TEAMMATES/teammates/pulls/7576/commits","review_comments_url":"https://api.github.com/repos/TEAMMATES/teammates/pulls/7576/comments","review_comment_url":"https://api.github.com/repos/TEAMMATES/teammates/pulls/comments{/number}","comments_url":"https://api.github.com/repos/TEAMMATES/teammates/issues/7576/comments","statuses_url":"https://api.github.com/repos/TEAMMATES/teammates/statuses/07ca5724974f996d23b6592f34487ec822857caf","head":{"label":"Mynk96:6550-Add-FeedbackResponseCommentSearchTest-to-test-searching-for-feedback-response-comments","ref":"6550-Add-FeedbackResponseCommentSearchTest-to-test-searching-for-feedback-response-comments","sha":"07ca5724974f996d23b6592f34487ec822857caf","user":{"login":"Mynk96","id":17481466,"avatar_url":"https://avatars1.githubusercontent.com/u/17481466?v=3","gravatar_id":"","url":"https://api.github.com/users/Mynk96","html_url":"https://github.com/Mynk96","followers_url":"https://api.github.com/users/Mynk96/followers","following_url":"https://api.github.com/users/Mynk96/following{/other_user}","gists_url":"https://api.github.com/users/Mynk96/gists{/gist_id}","starred_url":"https://api.github.com/users/Mynk96/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mynk96/subscriptions","organizations_url":"https://api.github.com/users/Mynk96/orgs","repos_url":"https://api.github.com/users/Mynk96/repos","events_url":"https://api.github.com/users/Mynk96/events{/privacy}","received_events_url":"https://api.github.com/users/Mynk96/received_events","type":"User","site_admin":false},"repo":{"id":88467207,"name":"teammates","full_name":"Mynk96/teammates","owner":{"login":"Mynk96","id":17481466,"avatar_url":"https://avatars1.githubusercontent.com/u/17481466?v=3","gravatar_id":"","url":"https://api.github.com/users/Mynk96","html_url":"https://github.com/Mynk96","followers_url":"https://api.github.com/users/Mynk96/followers","following_url":"https://api.github.com/users/Mynk96/following{/other_user}","gists_url":"https://api.github.com/users/Mynk96/gists{/gist_id}","starred_url":"https://api.github.com/users/Mynk96/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mynk96/subscriptions","organizations_url":"https://api.github.com/users/Mynk96/orgs","repos_url":"https://api.github.com/users/Mynk96/repos","events_url":"https://api.github.com/users/Mynk96/events{/privacy}","received_events_url":"https://api.github.com/users/Mynk96/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Mynk96/teammates","description":"This is the project website for the TEAMMATES feedback management tool for education","fork":true,"url":"https://api.github.com/repos/Mynk96/teammates","forks_url":"https://api.github.com/repos/Mynk96/teammates/forks","keys_url":"https://api.github.com/repos/Mynk96/teammates/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Mynk96/teammates/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Mynk96/teammates/teams","hooks_url":"https://api.github.com/repos/Mynk96/teammates/hooks","issue_events_url":"https://api.github.com/repos/Mynk96/teammates/issues/events{/number}","events_url":"https://api.github.com/repos/Mynk96/teammates/events","assignees_url":"https://api.github.com/repos/Mynk96/teammates/assignees{/user}","branches_url":"https://api.github.com/repos/Mynk96/teammates/branches{/branch}","tags_url":"https://api.github.com/repos/Mynk96/teammates/tags","blobs_url":"https://api.github.com/repos/Mynk96/teammates/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Mynk96/teammates/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Mynk96/teammates/git/refs{/sha}","trees_url":"https://api.github.com/repos/Mynk96/teammates/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Mynk96/teammates/statuses/{sha}","languages_url":"https://api.github.com/repos/Mynk96/teammates/languages","stargazers_url":"https://api.github.com/repos/Mynk96/teammates/stargazers","contributors_url":"https://api.github.com/repos/Mynk96/teammates/contributors","subscribers_url":"https://api.github.com/repos/Mynk96/teammates/subscribers","subscription_url":"https://api.github.com/repos/Mynk96/teammates/subscription","commits_url":"https://api.github.com/repos/Mynk96/teammates/commits{/sha}","git_commits_url":"https://api.github.com/repos/Mynk96/teammates/git/commits{/sha}","comments_url":"https://api.github.com/repos/Mynk96/teammates/comments{/number}","issue_comment_url":"https://api.github.com/repos/Mynk96/teammates/issues/comments{/number}","contents_url":"https://api.github.com/repos/Mynk96/teammates/contents/{+path}","compare_url":"https://api.github.com/repos/Mynk96/teammates/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Mynk96/teammates/merges","archive_url":"https://api.github.com/repos/Mynk96/teammates/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Mynk96/teammates/downloads","issues_url":"https://api.github.com/repos/Mynk96/teammates/issues{/number}","pulls_url":"https://api.github.com/repos/Mynk96/teammates/pulls{/number}","milestones_url":"https://api.github.com/repos/Mynk96/teammates/milestones{/number}","notifications_url":"https://api.github.com/repos/Mynk96/teammates/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Mynk96/teammates/labels{/name}","releases_url":"https://api.github.com/repos/Mynk96/teammates/releases{/id}","deployments_url":"https://api.github.com/repos/Mynk96/teammates/deployments","created_at":"2017-04-17T04:13:06Z","updated_at":"2017-04-17T04:13:12Z","pushed_at":"2017-06-25T12:53:50Z","git_url":"git://github.com/Mynk96/teammates.git","ssh_url":"git@github.com:Mynk96/teammates.git","clone_url":"https://github.com/Mynk96/teammates.git","svn_url":"https://github.com/Mynk96/teammates","homepage":"http://teammatesv4.appspot.com/","size":185769,"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":"master"}},"base":{"label":"TEAMMATES:master","ref":"master","sha":"935872235aae83981527f5861b79967b8b43144f","user":{"login":"TEAMMATES","id":7374810,"avatar_url":"https://avatars1.githubusercontent.com/u/7374810?v=3","gravatar_id":"","url":"https://api.github.com/users/TEAMMATES","html_url":"https://github.com/TEAMMATES","followers_url":"https://api.github.com/users/TEAMMATES/followers","following_url":"https://api.github.com/users/TEAMMATES/following{/other_user}","gists_url":"https://api.github.com/users/TEAMMATES/gists{/gist_id}","starred_url":"https://api.github.com/users/TEAMMATES/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TEAMMATES/subscriptions","organizations_url":"https://api.github.com/users/TEAMMATES/orgs","repos_url":"https://api.github.com/users/TEAMMATES/repos","events_url":"https://api.github.com/users/TEAMMATES/events{/privacy}","received_events_url":"https://api.github.com/users/TEAMMATES/received_events","type":"Organization","site_admin":false},"repo":{"id":19369035,"name":"teammates","full_name":"TEAMMATES/teammates","owner":{"login":"TEAMMATES","id":7374810,"avatar_url":"https://avatars1.githubusercontent.com/u/7374810?v=3","gravatar_id":"","url":"https://api.github.com/users/TEAMMATES","html_url":"https://github.com/TEAMMATES","followers_url":"https://api.github.com/users/TEAMMATES/followers","following_url":"https://api.github.com/users/TEAMMATES/following{/other_user}","gists_url":"https://api.github.com/users/TEAMMATES/gists{/gist_id}","starred_url":"https://api.github.com/users/TEAMMATES/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TEAMMATES/subscriptions","organizations_url":"https://api.github.com/users/TEAMMATES/orgs","repos_url":"https://api.github.com/users/TEAMMATES/repos","events_url":"https://api.github.com/users/TEAMMATES/events{/privacy}","received_events_url":"https://api.github.com/users/TEAMMATES/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/TEAMMATES/teammates","description":"This is the project website for the TEAMMATES feedback management tool for education","fork":false,"url":"https://api.github.com/repos/TEAMMATES/teammates","forks_url":"https://api.github.com/repos/TEAMMATES/teammates/forks","keys_url":"https://api.github.com/repos/TEAMMATES/teammates/keys{/key_id}","collaborators_url":"https://api.github.com/repos/TEAMMATES/teammates/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/TEAMMATES/teammates/teams","hooks_url":"https://api.github.com/repos/TEAMMATES/teammates/hooks","issue_events_url":"https://api.github.com/repos/TEAMMATES/teammates/issues/events{/number}","events_url":"https://api.github.com/repos/TEAMMATES/teammates/events","assignees_url":"https://api.github.com/repos/TEAMMATES/teammates/assignees{/user}","branches_url":"https://api.github.com/repos/TEAMMATES/teammates/branches{/branch}","tags_url":"https://api.github.com/repos/TEAMMATES/teammates/tags","blobs_url":"https://api.github.com/repos/TEAMMATES/teammates/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/TEAMMATES/teammates/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/TEAMMATES/teammates/git/refs{/sha}","trees_url":"https://api.github.com/repos/TEAMMATES/teammates/git/trees{/sha}","statuses_url":"https://api.github.com/repos/TEAMMATES/teammates/statuses/{sha}","languages_url":"https://api.github.com/repos/TEAMMATES/teammates/languages","stargazers_url":"https://api.github.com/repos/TEAMMATES/teammates/stargazers","contributors_url":"https://api.github.com/repos/TEAMMATES/teammates/contributors","subscribers_url":"https://api.github.com/repos/TEAMMATES/teammates/subscribers","subscription_url":"https://api.github.com/repos/TEAMMATES/teammates/subscription","commits_url":"https://api.github.com/repos/TEAMMATES/teammates/commits{/sha}","git_commits_url":"https://api.github.com/repos/TEAMMATES/teammates/git/commits{/sha}","comments_url":"https://api.github.com/repos/TEAMMATES/teammates/comments{/number}","issue_comment_url":"https://api.github.com/repos/TEAMMATES/teammates/issues/comments{/number}","contents_url":"https://api.github.com/repos/TEAMMATES/teammates/contents/{+path}","compare_url":"https://api.github.com/repos/TEAMMATES/teammates/compare/{base}...{head}","merges_url":"https://api.github.com/repos/TEAMMATES/teammates/merges","archive_url":"https://api.github.com/repos/TEAMMATES/teammates/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/TEAMMATES/teammates/downloads","issues_url":"https://api.github.com/repos/TEAMMATES/teammates/issues{/number}","pulls_url":"https://api.github.com/repos/TEAMMATES/teammates/pulls{/number}","milestones_url":"https://api.github.com/repos/TEAMMATES/teammates/milestones{/number}","notifications_url":"https://api.github.com/repos/TEAMMATES/teammates/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/TEAMMATES/teammates/labels{/name}","releases_url":"https://api.github.com/repos/TEAMMATES/teammates/releases{/id}","deployments_url":"https://api.github.com/repos/TEAMMATES/teammates/deployments","created_at":"2014-05-02T07:43:00Z","updated_at":"2017-06-25T02:20:43Z","pushed_at":"2017-06-25T12:53:51Z","git_url":"git://github.com/TEAMMATES/teammates.git","ssh_url":"git@github.com:TEAMMATES/teammates.git","clone_url":"https://github.com/TEAMMATES/teammates.git","svn_url":"https://github.com/TEAMMATES/teammates","homepage":"https://teammatesv4.appspot.com/","size":187859,"stargazers_count":361,"watchers_count":361,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":828,"mirror_url":null,"open_issues_count":309,"forks":828,"open_issues":309,"watchers":361,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/TEAMMATES/teammates/pulls/7576"},"html":{"href":"https://github.com/TEAMMATES/teammates/pull/7576"},"issue":{"href":"https://api.github.com/repos/TEAMMATES/teammates/issues/7576"},"comments":{"href":"https://api.github.com/repos/TEAMMATES/teammates/issues/7576/comments"},"review_comments":{"href":"https://api.github.com/repos/TEAMMATES/teammates/pulls/7576/comments"},"review_comment":{"href":"https://api.github.com/repos/TEAMMATES/teammates/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/TEAMMATES/teammates/pulls/7576/commits"},"statuses":{"href":"https://api.github.com/repos/TEAMMATES/teammates/statuses/07ca5724974f996d23b6592f34487ec822857caf"}}}}
{"actor":{"display_login":"Mynk96"}}