{"action":"created","comment":{"url":"https://api.github.com/repos/kalpeshgandhi/Develope/pulls/comments/37196505","id":37196505,"diff_hunk":"@@ -0,0 +1,203 @@\n+/**\n+ * This is a class that will check the functionality for the fetched queries related to the \n+ * aggregate result. It also prints the results.\n+ */\n+@isTest\n+private class TestAggregateQueries \n+{\n+    /**\n+     * This is a method that test to retrieve sum of all closed Opportunity amount for \n+     * current fiscal year. Store this information in a map with key as year and value as \n+     * sum of amount. Iterate this map to display statistics.\n+     */\n+     static testMethod void testOpportunityRecords() \n+     {\n+         // Create the instance of the Opportunity\n+         List<Opportunity> opportunityList = new List<Opportunity>();\n+         for (Integer i = 0; i<=1; i++) \n+         {\n+             // Create the opportunity Record\n+             Opportunity opportunityInstance = new Opportunity(Name = 'Test' + i,\n+                                                               CloseDate = System.Today(),\n+                                                               StageName = 'Closed Won',\n+                                                               Amount = 13000);\n+                                                               \n+             // Create the opportunity Record\n+             Opportunity opportunityInstance2 = new Opportunity(Name = 'Test' + i,\n+                                                                CloseDate = System.Today(),\n+                                                                StageName = 'Closed Won',\n+                                                                Amount = 14000);\n+             // Add records to the List\n+             opportunityList.add(opportunityInstance);\n+             opportunityList.add(opportunityInstance2);\n+         }\n+         // Start the Test\n+         Test.startTest();\n+         \n+         // Insert the List\n+         insert opportunityList;\n+         \n+         // Check the records are added or not\n+         System.assertEquals(4,opportunityList.size());\n+         \n+         // Stop the test\n+         Test.stopTest();\n+         // Create the Instance of the Class\n+         AggregateRelationShipSoql aggregateInstance = new AggregateRelationShipSoql();\n+         Map<Integer,Double> mapInstance=aggregateInstance.sumOfClosedOpportunityAmountForCurrentFiscalYear();\n+         System.assertEquals(54000,mapInstance.get(2015)); \n+    } \n+    \n+    /**\n+     * This is a method that test to retrieve sum of all Open Opportunity amount for \n+     * current fiscal year. Store this information in a map with key as year and value as \n+     * sum of amount. Iterate this map to display statistics.\n+     */\n+     static testMethod void testOpportunityRecordsUnsuccessful() \n+     {\n+         // Create the instance of the Opportunity\n+         List<Opportunity> opportunityList = new List<Opportunity>();\n+         for (Integer i = 0; i<=1; i++) \n+         {\n+             // Create the opportunity Record\n+             Opportunity opportunityInstance = new Opportunity(Name = 'Test' + i,\n+                                                               CloseDate = System.Today(),\n+                                                               StageName = 'Qualification',\n+                                                               Amount = 13000);\n+                                                               \n+             // Create the opportunity Record\n+             Opportunity opportunityInstance2 = new Opportunity(Name = 'Test' + i,\n+                                                                CloseDate = System.Today(),\n+                                                                StageName = 'Qualification',\n+                                                                Amount = 14000);\n+             // Add records to the List\n+             opportunityList.add(opportunityInstance);\n+             opportunityList.add(opportunityInstance2);\n+         }\n+         // Start the Test\n+         Test.startTest();\n+         \n+         // Insert the List\n+         insert opportunityList;\n+         \n+         // Check the records are added or not\n+         System.assertEquals(4,opportunityList.size());\n+         \n+         // Stop the test\n+         Test.stopTest();\n+         // Create the Instance of the Class\n+         AggregateRelationShipSoql aggregateInstance = new AggregateRelationShipSoql();\n+         Map<Integer,Double> mapInstance=aggregateInstance.sumOfClosedOpportunityAmountForCurrentFiscalYear();\n+         System.assertEquals(null,mapInstance.get(2015)); \n+    } \n+    \n+   /**\n+    * This is a Method that Test to get distinct Lead records on basis of 'Lead Source'\n+    *  having greater than 10 leads. Print this information.\n+    */\n+    static testMethod void testDuplicateLeadRecords() \n+    {\n+        // Create the instance of the lead list\n+        List<Lead> leadList = new List<Lead>();\n+        // Iterate over the loop\n+        for (Integer i = 0;i<= 50; i++) \n+        {\n+            // Create the lead record\n+            Lead leadInstance = new Lead(LastName = 'TestLead'+i, \n+                                         Company = 'ESPL', \n+                                         LeadSource ='Web', \n+                                         Status ='Closed');\n+                                         \n+            Lead leadInstance2 = new Lead(LastName = 'TestLead'+i, \n+                                         Company = 'ESPL', \n+                                         LeadSource ='Other', \n+                                         Status ='Closed');\n+            // Add record to the list\n+            leadList.add(leadInstance);\n+            leadList.add(leadInstance2);    \n+        }\n+        for (Integer i = 0;i < 5; i++) \n+        {\n+            // Create the lead record\n+            Lead leadInstance3 = new Lead(LastName = 'TestLead'+i, \n+                                         Company = 'ESPL', \n+                                         LeadSource ='Phone Inquiry', \n+                                         Status ='Closed');\n+            // Add record to the list \n+            leadList.add(leadInstance3);    \n+        }\n+        \n+        // Start the test\n+        Test.startTest();\n+        \n+        // Insert the lead \n+        insert leadList;\n+        \n+        // Check the records are added or not\n+        System.assertEquals(107,leadList.size());\n+      \n+        // Stop the test\n+         Test.stopTest();\n+       \n+        // Create the Instance of the Class\n+        AggregateRelationShipSoql aggregateInstance = new AggregateRelationShipSoql();\n+       \n+        System.assertEquals(2, aggregateInstance.totalNoOfDistinctLeadRecordsOnBasisOfLeadSource().size());","path":"TestAggregateQueries.cls","position":145,"original_position":145,"commit_id":"35bea3dc422ee78fc8f2aebd889a69c5c6c61f17","original_commit_id":"35bea3dc422ee78fc8f2aebd889a69c5c6c61f17","user":{"login":"Needhi","id":6712907,"avatar_url":"https://avatars.githubusercontent.com/u/6712907?v=3","gravatar_id":"","url":"https://api.github.com/users/Needhi","html_url":"https://github.com/Needhi","followers_url":"https://api.github.com/users/Needhi/followers","following_url":"https://api.github.com/users/Needhi/following{/other_user}","gists_url":"https://api.github.com/users/Needhi/gists{/gist_id}","starred_url":"https://api.github.com/users/Needhi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Needhi/subscriptions","organizations_url":"https://api.github.com/users/Needhi/orgs","repos_url":"https://api.github.com/users/Needhi/repos","events_url":"https://api.github.com/users/Needhi/events{/privacy}","received_events_url":"https://api.github.com/users/Needhi/received_events","type":"User","site_admin":false},"body":"Add assert","created_at":"2015-08-17T15:00:20Z","updated_at":"2015-08-17T15:00:20Z","html_url":"https://github.com/kalpeshgandhi/Develope/pull/8#discussion_r37196505","pull_request_url":"https://api.github.com/repos/kalpeshgandhi/Develope/pulls/8","_links":{"self":{"href":"https://api.github.com/repos/kalpeshgandhi/Develope/pulls/comments/37196505"},"html":{"href":"https://github.com/kalpeshgandhi/Develope/pull/8#discussion_r37196505"},"pull_request":{"href":"https://api.github.com/repos/kalpeshgandhi/Develope/pulls/8"}}},"pull_request":{"url":"https://api.github.com/repos/kalpeshgandhi/Develope/pulls/8","id":42533497,"html_url":"https://github.com/kalpeshgandhi/Develope/pull/8","diff_url":"https://github.com/kalpeshgandhi/Develope/pull/8.diff","patch_url":"https://github.com/kalpeshgandhi/Develope/pull/8.patch","issue_url":"https://api.github.com/repos/kalpeshgandhi/Develope/issues/8","number":8,"state":"open","locked":false,"title":"Assignment10","user":{"login":"kalpeshgandhi","id":13236336,"avatar_url":"https://avatars.githubusercontent.com/u/13236336?v=3","gravatar_id":"","url":"https://api.github.com/users/kalpeshgandhi","html_url":"https://github.com/kalpeshgandhi","followers_url":"https://api.github.com/users/kalpeshgandhi/followers","following_url":"https://api.github.com/users/kalpeshgandhi/following{/other_user}","gists_url":"https://api.github.com/users/kalpeshgandhi/gists{/gist_id}","starred_url":"https://api.github.com/users/kalpeshgandhi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kalpeshgandhi/subscriptions","organizations_url":"https://api.github.com/users/kalpeshgandhi/orgs","repos_url":"https://api.github.com/users/kalpeshgandhi/repos","events_url":"https://api.github.com/users/kalpeshgandhi/events{/privacy}","received_events_url":"https://api.github.com/users/kalpeshgandhi/received_events","type":"User","site_admin":false},"body":"Assignment 10 with Changes","created_at":"2015-08-16T09:14:58Z","updated_at":"2015-08-17T15:00:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"db9786c431ddae7db26d278f5b114a3440a28c95","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/kalpeshgandhi/Develope/pulls/8/commits","review_comments_url":"https://api.github.com/repos/kalpeshgandhi/Develope/pulls/8/comments","review_comment_url":"https://api.github.com/repos/kalpeshgandhi/Develope/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kalpeshgandhi/Develope/issues/8/comments","statuses_url":"https://api.github.com/repos/kalpeshgandhi/Develope/statuses/35bea3dc422ee78fc8f2aebd889a69c5c6c61f17","head":{"label":"kalpeshgandhi:assignment10","ref":"assignment10","sha":"35bea3dc422ee78fc8f2aebd889a69c5c6c61f17","user":{"login":"kalpeshgandhi","id":13236336,"avatar_url":"https://avatars.githubusercontent.com/u/13236336?v=3","gravatar_id":"","url":"https://api.github.com/users/kalpeshgandhi","html_url":"https://github.com/kalpeshgandhi","followers_url":"https://api.github.com/users/kalpeshgandhi/followers","following_url":"https://api.github.com/users/kalpeshgandhi/following{/other_user}","gists_url":"https://api.github.com/users/kalpeshgandhi/gists{/gist_id}","starred_url":"https://api.github.com/users/kalpeshgandhi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kalpeshgandhi/subscriptions","organizations_url":"https://api.github.com/users/kalpeshgandhi/orgs","repos_url":"https://api.github.com/users/kalpeshgandhi/repos","events_url":"https://api.github.com/users/kalpeshgandhi/events{/privacy}","received_events_url":"https://api.github.com/users/kalpeshgandhi/received_events","type":"User","site_admin":false},"repo":{"id":40370408,"name":"Develope","full_name":"kalpeshgandhi/Develope","owner":{"login":"kalpeshgandhi","id":13236336,"avatar_url":"https://avatars.githubusercontent.com/u/13236336?v=3","gravatar_id":"","url":"https://api.github.com/users/kalpeshgandhi","html_url":"https://github.com/kalpeshgandhi","followers_url":"https://api.github.com/users/kalpeshgandhi/followers","following_url":"https://api.github.com/users/kalpeshgandhi/following{/other_user}","gists_url":"https://api.github.com/users/kalpeshgandhi/gists{/gist_id}","starred_url":"https://api.github.com/users/kalpeshgandhi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kalpeshgandhi/subscriptions","organizations_url":"https://api.github.com/users/kalpeshgandhi/orgs","repos_url":"https://api.github.com/users/kalpeshgandhi/repos","events_url":"https://api.github.com/users/kalpeshgandhi/events{/privacy}","received_events_url":"https://api.github.com/users/kalpeshgandhi/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kalpeshgandhi/Develope","description":"","fork":false,"url":"https://api.github.com/repos/kalpeshgandhi/Develope","forks_url":"https://api.github.com/repos/kalpeshgandhi/Develope/forks","keys_url":"https://api.github.com/repos/kalpeshgandhi/Develope/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kalpeshgandhi/Develope/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kalpeshgandhi/Develope/teams","hooks_url":"https://api.github.com/repos/kalpeshgandhi/Develope/hooks","issue_events_url":"https://api.github.com/repos/kalpeshgandhi/Develope/issues/events{/number}","events_url":"https://api.github.com/repos/kalpeshgandhi/Develope/events","assignees_url":"https://api.github.com/repos/kalpeshgandhi/Develope/assignees{/user}","branches_url":"https://api.github.com/repos/kalpeshgandhi/Develope/branches{/branch}","tags_url":"https://api.github.com/repos/kalpeshgandhi/Develope/tags","blobs_url":"https://api.github.com/repos/kalpeshgandhi/Develope/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kalpeshgandhi/Develope/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kalpeshgandhi/Develope/git/refs{/sha}","trees_url":"https://api.github.com/repos/kalpeshgandhi/Develope/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kalpeshgandhi/Develope/statuses/{sha}","languages_url":"https://api.github.com/repos/kalpeshgandhi/Develope/languages","stargazers_url":"https://api.github.com/repos/kalpeshgandhi/Develope/stargazers","contributors_url":"https://api.github.com/repos/kalpeshgandhi/Develope/contributors","subscribers_url":"https://api.github.com/repos/kalpeshgandhi/Develope/subscribers","subscription_url":"https://api.github.com/repos/kalpeshgandhi/Develope/subscription","commits_url":"https://api.github.com/repos/kalpeshgandhi/Develope/commits{/sha}","git_commits_url":"https://api.github.com/repos/kalpeshgandhi/Develope/git/commits{/sha}","comments_url":"https://api.github.com/repos/kalpeshgandhi/Develope/comments{/number}","issue_comment_url":"https://api.github.com/repos/kalpeshgandhi/Develope/issues/comments{/number}","contents_url":"https://api.github.com/repos/kalpeshgandhi/Develope/contents/{+path}","compare_url":"https://api.github.com/repos/kalpeshgandhi/Develope/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kalpeshgandhi/Develope/merges","archive_url":"https://api.github.com/repos/kalpeshgandhi/Develope/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kalpeshgandhi/Develope/downloads","issues_url":"https://api.github.com/repos/kalpeshgandhi/Develope/issues{/number}","pulls_url":"https://api.github.com/repos/kalpeshgandhi/Develope/pulls{/number}","milestones_url":"https://api.github.com/repos/kalpeshgandhi/Develope/milestones{/number}","notifications_url":"https://api.github.com/repos/kalpeshgandhi/Develope/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kalpeshgandhi/Develope/labels{/name}","releases_url":"https://api.github.com/repos/kalpeshgandhi/Develope/releases{/id}","created_at":"2015-08-07T16:37:20Z","updated_at":"2015-08-07T16:37:20Z","pushed_at":"2015-08-16T09:27:36Z","git_url":"git://github.com/kalpeshgandhi/Develope.git","ssh_url":"git@github.com:kalpeshgandhi/Develope.git","clone_url":"https://github.com/kalpeshgandhi/Develope.git","svn_url":"https://github.com/kalpeshgandhi/Develope","homepage":null,"size":244,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":6,"forks":0,"open_issues":6,"watchers":0,"default_branch":"master"}},"base":{"label":"kalpeshgandhi:master","ref":"master","sha":"a5e2ba9298340214e93a921a2bc6661a45afd122","user":{"login":"kalpeshgandhi","id":13236336,"avatar_url":"https://avatars.githubusercontent.com/u/13236336?v=3","gravatar_id":"","url":"https://api.github.com/users/kalpeshgandhi","html_url":"https://github.com/kalpeshgandhi","followers_url":"https://api.github.com/users/kalpeshgandhi/followers","following_url":"https://api.github.com/users/kalpeshgandhi/following{/other_user}","gists_url":"https://api.github.com/users/kalpeshgandhi/gists{/gist_id}","starred_url":"https://api.github.com/users/kalpeshgandhi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kalpeshgandhi/subscriptions","organizations_url":"https://api.github.com/users/kalpeshgandhi/orgs","repos_url":"https://api.github.com/users/kalpeshgandhi/repos","events_url":"https://api.github.com/users/kalpeshgandhi/events{/privacy}","received_events_url":"https://api.github.com/users/kalpeshgandhi/received_events","type":"User","site_admin":false},"repo":{"id":40370408,"name":"Develope","full_name":"kalpeshgandhi/Develope","owner":{"login":"kalpeshgandhi","id":13236336,"avatar_url":"https://avatars.githubusercontent.com/u/13236336?v=3","gravatar_id":"","url":"https://api.github.com/users/kalpeshgandhi","html_url":"https://github.com/kalpeshgandhi","followers_url":"https://api.github.com/users/kalpeshgandhi/followers","following_url":"https://api.github.com/users/kalpeshgandhi/following{/other_user}","gists_url":"https://api.github.com/users/kalpeshgandhi/gists{/gist_id}","starred_url":"https://api.github.com/users/kalpeshgandhi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kalpeshgandhi/subscriptions","organizations_url":"https://api.github.com/users/kalpeshgandhi/orgs","repos_url":"https://api.github.com/users/kalpeshgandhi/repos","events_url":"https://api.github.com/users/kalpeshgandhi/events{/privacy}","received_events_url":"https://api.github.com/users/kalpeshgandhi/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kalpeshgandhi/Develope","description":"","fork":false,"url":"https://api.github.com/repos/kalpeshgandhi/Develope","forks_url":"https://api.github.com/repos/kalpeshgandhi/Develope/forks","keys_url":"https://api.github.com/repos/kalpeshgandhi/Develope/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kalpeshgandhi/Develope/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kalpeshgandhi/Develope/teams","hooks_url":"https://api.github.com/repos/kalpeshgandhi/Develope/hooks","issue_events_url":"https://api.github.com/repos/kalpeshgandhi/Develope/issues/events{/number}","events_url":"https://api.github.com/repos/kalpeshgandhi/Develope/events","assignees_url":"https://api.github.com/repos/kalpeshgandhi/Develope/assignees{/user}","branches_url":"https://api.github.com/repos/kalpeshgandhi/Develope/branches{/branch}","tags_url":"https://api.github.com/repos/kalpeshgandhi/Develope/tags","blobs_url":"https://api.github.com/repos/kalpeshgandhi/Develope/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kalpeshgandhi/Develope/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kalpeshgandhi/Develope/git/refs{/sha}","trees_url":"https://api.github.com/repos/kalpeshgandhi/Develope/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kalpeshgandhi/Develope/statuses/{sha}","languages_url":"https://api.github.com/repos/kalpeshgandhi/Develope/languages","stargazers_url":"https://api.github.com/repos/kalpeshgandhi/Develope/stargazers","contributors_url":"https://api.github.com/repos/kalpeshgandhi/Develope/contributors","subscribers_url":"https://api.github.com/repos/kalpeshgandhi/Develope/subscribers","subscription_url":"https://api.github.com/repos/kalpeshgandhi/Develope/subscription","commits_url":"https://api.github.com/repos/kalpeshgandhi/Develope/commits{/sha}","git_commits_url":"https://api.github.com/repos/kalpeshgandhi/Develope/git/commits{/sha}","comments_url":"https://api.github.com/repos/kalpeshgandhi/Develope/comments{/number}","issue_comment_url":"https://api.github.com/repos/kalpeshgandhi/Develope/issues/comments{/number}","contents_url":"https://api.github.com/repos/kalpeshgandhi/Develope/contents/{+path}","compare_url":"https://api.github.com/repos/kalpeshgandhi/Develope/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kalpeshgandhi/Develope/merges","archive_url":"https://api.github.com/repos/kalpeshgandhi/Develope/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kalpeshgandhi/Develope/downloads","issues_url":"https://api.github.com/repos/kalpeshgandhi/Develope/issues{/number}","pulls_url":"https://api.github.com/repos/kalpeshgandhi/Develope/pulls{/number}","milestones_url":"https://api.github.com/repos/kalpeshgandhi/Develope/milestones{/number}","notifications_url":"https://api.github.com/repos/kalpeshgandhi/Develope/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kalpeshgandhi/Develope/labels{/name}","releases_url":"https://api.github.com/repos/kalpeshgandhi/Develope/releases{/id}","created_at":"2015-08-07T16:37:20Z","updated_at":"2015-08-07T16:37:20Z","pushed_at":"2015-08-16T09:27:36Z","git_url":"git://github.com/kalpeshgandhi/Develope.git","ssh_url":"git@github.com:kalpeshgandhi/Develope.git","clone_url":"https://github.com/kalpeshgandhi/Develope.git","svn_url":"https://github.com/kalpeshgandhi/Develope","homepage":null,"size":244,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":6,"forks":0,"open_issues":6,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kalpeshgandhi/Develope/pulls/8"},"html":{"href":"https://github.com/kalpeshgandhi/Develope/pull/8"},"issue":{"href":"https://api.github.com/repos/kalpeshgandhi/Develope/issues/8"},"comments":{"href":"https://api.github.com/repos/kalpeshgandhi/Develope/issues/8/comments"},"review_comments":{"href":"https://api.github.com/repos/kalpeshgandhi/Develope/pulls/8/comments"},"review_comment":{"href":"https://api.github.com/repos/kalpeshgandhi/Develope/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kalpeshgandhi/Develope/pulls/8/commits"},"statuses":{"href":"https://api.github.com/repos/kalpeshgandhi/Develope/statuses/35bea3dc422ee78fc8f2aebd889a69c5c6c61f17"}}}}