{"action":"created","comment":{"url":"https://api.github.com/repos/ben-ou/JavaPractice/pulls/comments/25188074","id":25188074,"diff_hunk":"@@ -0,0 +1,152 @@\n+import com.benou.BinaryNode;\n+import com.benou.BinarySearchTree;\n+\n+import junit.framework.Assert;\n+\n+import org.junit.Test;\n+\n+import java.util.Arrays;\n+import java.util.List;\n+\n+/**\n+ * Created by benou on 2/22/15.\n+ */\n+public class BinarySearchTreeTest {\n+\n+    @Test\n+    public void testPreOrder_Basic() {\n+        BinarySearchTree bst = new BinarySearchTree();\n+        bst.insert(2);\n+        bst.insert(1);\n+        bst.insert(4);\n+        bst.insert(3);\n+        bst.insert(5);\n+        List<BinaryNode> expected = Arrays.asList(\n+                new BinaryNode(1),\n+                new BinaryNode(1),\n+                new BinaryNode(1),\n+                new BinaryNode(1),\n+                new BinaryNode(1));\n+//        List<BinaryNode> actual = bst.getPreOrderList();\n+//        Assert.assertEquals(expected, )\n+        bst.printPreOrder(bst.getOverallRoot());\n+    }\n+\n+    @Test\n+    public void testInsert_WhereValueIsSame() {\n+        BinarySearchTree bst = new BinarySearchTree();\n+        bst.insert(2);\n+        bst.insert(2);\n+        Assert.assertEquals(1, bst.size());\n+    }\n+\n+    @Test\n+    public void testInsertToEmpty(){\n+        BinarySearchTree bst = new BinarySearchTree();\n+        bst.insert(2);\n+        Assert.assertEquals(2, bst.getOverallRoot().getData());\n+    }\n+\n+    @Test\n+    public void testTreeIsEmptyAndNotNull(){\n+        BinarySearchTree bst = new BinarySearchTree();\n+        Assert.assertEquals(true, bst.getOverallRoot().getData() == null);\n+        Assert.assertEquals(true, bst.getOverallRoot().getLeft() == null);\n+        Assert.assertEquals(true, bst.getOverallRoot().getRight() == null);\n+        Assert.assertEquals(true, bst != null);\n+    }\n+\n+    @Test\n+    public void testLargeTreeInsertsCorrectNumberOfNodes(){\n+        BinarySearchTree bst = new BinarySearchTree();\n+        for (int i = 50; i < 101; i += 10){\n+            bst.insert(i);\n+            //adds 5 nodes\n+        }\n+        for (int j = 45; j > -1; j -= 10){\n+            bst.insert(j);\n+            // adds 5 nodes\n+        }\n+        for (int k = 47; k < 101; k += 10){\n+            bst.insert(k);\n+            // adds 5 nodes\n+        }\n+        for (int l = 46; l > -1; l -= 10){\n+            bst.insert(l);\n+            // adds 5 nodes\n+        }\n+        Assert.assertEquals(20, bst.size());\n+\n+    }\n+\n+    @Test\n+    public void testMakeEmpty(){\n+        BinarySearchTree bst = new BinarySearchTree();\n+        for (int i = 50; i < 101; i += 10){\n+            bst.insert(i);\n+            //adds 5 nodes\n+        }\n+        for (int j = 45; j > -1; j -= 10){\n+            bst.insert(j);\n+            // adds 5 nodes\n+        }\n+        for (int k = 47; k < 101; k += 10){\n+            bst.insert(k);\n+            // adds 5 nodes\n+        }\n+        for (int l = 46; l > -1; l -= 10){\n+            bst.insert(l);\n+            // adds 5 nodes\n+        }\n+        Assert.assertEquals(20, bst.size());\n+        bst.makeEmpty();\n+        Assert.assertEquals(0, bst.size());\n+        Assert.assertEquals(true, bst == null);\n+    }\n+\n+    @Test\n+    public void testIsempty(){\n+        BinarySearchTree bst = new BinarySearchTree();\n+        Assert.assertEquals(1, bst.size());\n+        Assert.assertEquals(false, bst.isEmpty());","path":"datastructures/src/test/BinarySearchTreeTest.java","position":111,"original_position":111,"commit_id":"b7e3ae0619a1e2b29199f33244eaee12e9733064","original_commit_id":"b7e3ae0619a1e2b29199f33244eaee12e9733064","user":{"login":"oudavid","id":7453627,"avatar_url":"https://avatars.githubusercontent.com/u/7453627?v=3","gravatar_id":"","url":"https://api.github.com/users/oudavid","html_url":"https://github.com/oudavid","followers_url":"https://api.github.com/users/oudavid/followers","following_url":"https://api.github.com/users/oudavid/following{/other_user}","gists_url":"https://api.github.com/users/oudavid/gists{/gist_id}","starred_url":"https://api.github.com/users/oudavid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oudavid/subscriptions","organizations_url":"https://api.github.com/users/oudavid/orgs","repos_url":"https://api.github.com/users/oudavid/repos","events_url":"https://api.github.com/users/oudavid/events{/privacy}","received_events_url":"https://api.github.com/users/oudavid/received_events","type":"User","site_admin":false},"body":"You can use Assert.assertFalse() or Assert.assertTrue()","created_at":"2015-02-23T18:32:21Z","updated_at":"2015-02-23T18:32:21Z","html_url":"https://github.com/ben-ou/JavaPractice/pull/1#discussion_r25188074","pull_request_url":"https://api.github.com/repos/ben-ou/JavaPractice/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/ben-ou/JavaPractice/pulls/comments/25188074"},"html":{"href":"https://github.com/ben-ou/JavaPractice/pull/1#discussion_r25188074"},"pull_request":{"href":"https://api.github.com/repos/ben-ou/JavaPractice/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/ben-ou/JavaPractice/pulls/1","id":29767706,"html_url":"https://github.com/ben-ou/JavaPractice/pull/1","diff_url":"https://github.com/ben-ou/JavaPractice/pull/1.diff","patch_url":"https://github.com/ben-ou/JavaPractice/pull/1.patch","issue_url":"https://api.github.com/repos/ben-ou/JavaPractice/issues/1","number":1,"state":"open","locked":false,"title":"Binary Search Tree implementation","user":{"login":"oudavid","id":7453627,"avatar_url":"https://avatars.githubusercontent.com/u/7453627?v=3","gravatar_id":"","url":"https://api.github.com/users/oudavid","html_url":"https://github.com/oudavid","followers_url":"https://api.github.com/users/oudavid/followers","following_url":"https://api.github.com/users/oudavid/following{/other_user}","gists_url":"https://api.github.com/users/oudavid/gists{/gist_id}","starred_url":"https://api.github.com/users/oudavid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oudavid/subscriptions","organizations_url":"https://api.github.com/users/oudavid/orgs","repos_url":"https://api.github.com/users/oudavid/repos","events_url":"https://api.github.com/users/oudavid/events{/privacy}","received_events_url":"https://api.github.com/users/oudavid/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-02-22T08:51:37Z","updated_at":"2015-02-23T18:32:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"72e437a95a5ad58b549005600d3fdf2203bf39be","assignee":{"login":"ben-ou","id":2114134,"avatar_url":"https://avatars.githubusercontent.com/u/2114134?v=3","gravatar_id":"","url":"https://api.github.com/users/ben-ou","html_url":"https://github.com/ben-ou","followers_url":"https://api.github.com/users/ben-ou/followers","following_url":"https://api.github.com/users/ben-ou/following{/other_user}","gists_url":"https://api.github.com/users/ben-ou/gists{/gist_id}","starred_url":"https://api.github.com/users/ben-ou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ben-ou/subscriptions","organizations_url":"https://api.github.com/users/ben-ou/orgs","repos_url":"https://api.github.com/users/ben-ou/repos","events_url":"https://api.github.com/users/ben-ou/events{/privacy}","received_events_url":"https://api.github.com/users/ben-ou/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/ben-ou/JavaPractice/milestones/1","labels_url":"https://api.github.com/repos/ben-ou/JavaPractice/milestones/1/labels","id":989916,"number":1,"title":"BinarySearchTree Implementation","description":"","creator":{"login":"oudavid","id":7453627,"avatar_url":"https://avatars.githubusercontent.com/u/7453627?v=3","gravatar_id":"","url":"https://api.github.com/users/oudavid","html_url":"https://github.com/oudavid","followers_url":"https://api.github.com/users/oudavid/followers","following_url":"https://api.github.com/users/oudavid/following{/other_user}","gists_url":"https://api.github.com/users/oudavid/gists{/gist_id}","starred_url":"https://api.github.com/users/oudavid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oudavid/subscriptions","organizations_url":"https://api.github.com/users/oudavid/orgs","repos_url":"https://api.github.com/users/oudavid/repos","events_url":"https://api.github.com/users/oudavid/events{/privacy}","received_events_url":"https://api.github.com/users/oudavid/received_events","type":"User","site_admin":false},"open_issues":1,"closed_issues":0,"state":"open","created_at":"2015-02-22T08:55:18Z","updated_at":"2015-02-22T08:55:43Z","due_on":"2015-02-28T08:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/ben-ou/JavaPractice/pulls/1/commits","review_comments_url":"https://api.github.com/repos/ben-ou/JavaPractice/pulls/1/comments","review_comment_url":"https://api.github.com/repos/ben-ou/JavaPractice/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ben-ou/JavaPractice/issues/1/comments","statuses_url":"https://api.github.com/repos/ben-ou/JavaPractice/statuses/b7e3ae0619a1e2b29199f33244eaee12e9733064","head":{"label":"ben-ou:development","ref":"development","sha":"b7e3ae0619a1e2b29199f33244eaee12e9733064","user":{"login":"ben-ou","id":2114134,"avatar_url":"https://avatars.githubusercontent.com/u/2114134?v=3","gravatar_id":"","url":"https://api.github.com/users/ben-ou","html_url":"https://github.com/ben-ou","followers_url":"https://api.github.com/users/ben-ou/followers","following_url":"https://api.github.com/users/ben-ou/following{/other_user}","gists_url":"https://api.github.com/users/ben-ou/gists{/gist_id}","starred_url":"https://api.github.com/users/ben-ou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ben-ou/subscriptions","organizations_url":"https://api.github.com/users/ben-ou/orgs","repos_url":"https://api.github.com/users/ben-ou/repos","events_url":"https://api.github.com/users/ben-ou/events{/privacy}","received_events_url":"https://api.github.com/users/ben-ou/received_events","type":"User","site_admin":false},"repo":{"id":31156224,"name":"JavaPractice","full_name":"ben-ou/JavaPractice","owner":{"login":"ben-ou","id":2114134,"avatar_url":"https://avatars.githubusercontent.com/u/2114134?v=3","gravatar_id":"","url":"https://api.github.com/users/ben-ou","html_url":"https://github.com/ben-ou","followers_url":"https://api.github.com/users/ben-ou/followers","following_url":"https://api.github.com/users/ben-ou/following{/other_user}","gists_url":"https://api.github.com/users/ben-ou/gists{/gist_id}","starred_url":"https://api.github.com/users/ben-ou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ben-ou/subscriptions","organizations_url":"https://api.github.com/users/ben-ou/orgs","repos_url":"https://api.github.com/users/ben-ou/repos","events_url":"https://api.github.com/users/ben-ou/events{/privacy}","received_events_url":"https://api.github.com/users/ben-ou/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ben-ou/JavaPractice","description":"","fork":false,"url":"https://api.github.com/repos/ben-ou/JavaPractice","forks_url":"https://api.github.com/repos/ben-ou/JavaPractice/forks","keys_url":"https://api.github.com/repos/ben-ou/JavaPractice/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ben-ou/JavaPractice/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ben-ou/JavaPractice/teams","hooks_url":"https://api.github.com/repos/ben-ou/JavaPractice/hooks","issue_events_url":"https://api.github.com/repos/ben-ou/JavaPractice/issues/events{/number}","events_url":"https://api.github.com/repos/ben-ou/JavaPractice/events","assignees_url":"https://api.github.com/repos/ben-ou/JavaPractice/assignees{/user}","branches_url":"https://api.github.com/repos/ben-ou/JavaPractice/branches{/branch}","tags_url":"https://api.github.com/repos/ben-ou/JavaPractice/tags","blobs_url":"https://api.github.com/repos/ben-ou/JavaPractice/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ben-ou/JavaPractice/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ben-ou/JavaPractice/git/refs{/sha}","trees_url":"https://api.github.com/repos/ben-ou/JavaPractice/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ben-ou/JavaPractice/statuses/{sha}","languages_url":"https://api.github.com/repos/ben-ou/JavaPractice/languages","stargazers_url":"https://api.github.com/repos/ben-ou/JavaPractice/stargazers","contributors_url":"https://api.github.com/repos/ben-ou/JavaPractice/contributors","subscribers_url":"https://api.github.com/repos/ben-ou/JavaPractice/subscribers","subscription_url":"https://api.github.com/repos/ben-ou/JavaPractice/subscription","commits_url":"https://api.github.com/repos/ben-ou/JavaPractice/commits{/sha}","git_commits_url":"https://api.github.com/repos/ben-ou/JavaPractice/git/commits{/sha}","comments_url":"https://api.github.com/repos/ben-ou/JavaPractice/comments{/number}","issue_comment_url":"https://api.github.com/repos/ben-ou/JavaPractice/issues/comments{/number}","contents_url":"https://api.github.com/repos/ben-ou/JavaPractice/contents/{+path}","compare_url":"https://api.github.com/repos/ben-ou/JavaPractice/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ben-ou/JavaPractice/merges","archive_url":"https://api.github.com/repos/ben-ou/JavaPractice/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ben-ou/JavaPractice/downloads","issues_url":"https://api.github.com/repos/ben-ou/JavaPractice/issues{/number}","pulls_url":"https://api.github.com/repos/ben-ou/JavaPractice/pulls{/number}","milestones_url":"https://api.github.com/repos/ben-ou/JavaPractice/milestones{/number}","notifications_url":"https://api.github.com/repos/ben-ou/JavaPractice/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ben-ou/JavaPractice/labels{/name}","releases_url":"https://api.github.com/repos/ben-ou/JavaPractice/releases{/id}","created_at":"2015-02-22T07:38:33Z","updated_at":"2015-02-22T09:29:35Z","pushed_at":"2015-02-23T03:30:57Z","git_url":"git://github.com/ben-ou/JavaPractice.git","ssh_url":"git@github.com:ben-ou/JavaPractice.git","clone_url":"https://github.com/ben-ou/JavaPractice.git","svn_url":"https://github.com/ben-ou/JavaPractice","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"ben-ou:master","ref":"master","sha":"288a997d549067c1f4be957b262d13b10f377046","user":{"login":"ben-ou","id":2114134,"avatar_url":"https://avatars.githubusercontent.com/u/2114134?v=3","gravatar_id":"","url":"https://api.github.com/users/ben-ou","html_url":"https://github.com/ben-ou","followers_url":"https://api.github.com/users/ben-ou/followers","following_url":"https://api.github.com/users/ben-ou/following{/other_user}","gists_url":"https://api.github.com/users/ben-ou/gists{/gist_id}","starred_url":"https://api.github.com/users/ben-ou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ben-ou/subscriptions","organizations_url":"https://api.github.com/users/ben-ou/orgs","repos_url":"https://api.github.com/users/ben-ou/repos","events_url":"https://api.github.com/users/ben-ou/events{/privacy}","received_events_url":"https://api.github.com/users/ben-ou/received_events","type":"User","site_admin":false},"repo":{"id":31156224,"name":"JavaPractice","full_name":"ben-ou/JavaPractice","owner":{"login":"ben-ou","id":2114134,"avatar_url":"https://avatars.githubusercontent.com/u/2114134?v=3","gravatar_id":"","url":"https://api.github.com/users/ben-ou","html_url":"https://github.com/ben-ou","followers_url":"https://api.github.com/users/ben-ou/followers","following_url":"https://api.github.com/users/ben-ou/following{/other_user}","gists_url":"https://api.github.com/users/ben-ou/gists{/gist_id}","starred_url":"https://api.github.com/users/ben-ou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ben-ou/subscriptions","organizations_url":"https://api.github.com/users/ben-ou/orgs","repos_url":"https://api.github.com/users/ben-ou/repos","events_url":"https://api.github.com/users/ben-ou/events{/privacy}","received_events_url":"https://api.github.com/users/ben-ou/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ben-ou/JavaPractice","description":"","fork":false,"url":"https://api.github.com/repos/ben-ou/JavaPractice","forks_url":"https://api.github.com/repos/ben-ou/JavaPractice/forks","keys_url":"https://api.github.com/repos/ben-ou/JavaPractice/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ben-ou/JavaPractice/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ben-ou/JavaPractice/teams","hooks_url":"https://api.github.com/repos/ben-ou/JavaPractice/hooks","issue_events_url":"https://api.github.com/repos/ben-ou/JavaPractice/issues/events{/number}","events_url":"https://api.github.com/repos/ben-ou/JavaPractice/events","assignees_url":"https://api.github.com/repos/ben-ou/JavaPractice/assignees{/user}","branches_url":"https://api.github.com/repos/ben-ou/JavaPractice/branches{/branch}","tags_url":"https://api.github.com/repos/ben-ou/JavaPractice/tags","blobs_url":"https://api.github.com/repos/ben-ou/JavaPractice/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ben-ou/JavaPractice/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ben-ou/JavaPractice/git/refs{/sha}","trees_url":"https://api.github.com/repos/ben-ou/JavaPractice/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ben-ou/JavaPractice/statuses/{sha}","languages_url":"https://api.github.com/repos/ben-ou/JavaPractice/languages","stargazers_url":"https://api.github.com/repos/ben-ou/JavaPractice/stargazers","contributors_url":"https://api.github.com/repos/ben-ou/JavaPractice/contributors","subscribers_url":"https://api.github.com/repos/ben-ou/JavaPractice/subscribers","subscription_url":"https://api.github.com/repos/ben-ou/JavaPractice/subscription","commits_url":"https://api.github.com/repos/ben-ou/JavaPractice/commits{/sha}","git_commits_url":"https://api.github.com/repos/ben-ou/JavaPractice/git/commits{/sha}","comments_url":"https://api.github.com/repos/ben-ou/JavaPractice/comments{/number}","issue_comment_url":"https://api.github.com/repos/ben-ou/JavaPractice/issues/comments{/number}","contents_url":"https://api.github.com/repos/ben-ou/JavaPractice/contents/{+path}","compare_url":"https://api.github.com/repos/ben-ou/JavaPractice/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ben-ou/JavaPractice/merges","archive_url":"https://api.github.com/repos/ben-ou/JavaPractice/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ben-ou/JavaPractice/downloads","issues_url":"https://api.github.com/repos/ben-ou/JavaPractice/issues{/number}","pulls_url":"https://api.github.com/repos/ben-ou/JavaPractice/pulls{/number}","milestones_url":"https://api.github.com/repos/ben-ou/JavaPractice/milestones{/number}","notifications_url":"https://api.github.com/repos/ben-ou/JavaPractice/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ben-ou/JavaPractice/labels{/name}","releases_url":"https://api.github.com/repos/ben-ou/JavaPractice/releases{/id}","created_at":"2015-02-22T07:38:33Z","updated_at":"2015-02-22T09:29:35Z","pushed_at":"2015-02-23T03:30:57Z","git_url":"git://github.com/ben-ou/JavaPractice.git","ssh_url":"git@github.com:ben-ou/JavaPractice.git","clone_url":"https://github.com/ben-ou/JavaPractice.git","svn_url":"https://github.com/ben-ou/JavaPractice","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ben-ou/JavaPractice/pulls/1"},"html":{"href":"https://github.com/ben-ou/JavaPractice/pull/1"},"issue":{"href":"https://api.github.com/repos/ben-ou/JavaPractice/issues/1"},"comments":{"href":"https://api.github.com/repos/ben-ou/JavaPractice/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/ben-ou/JavaPractice/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/ben-ou/JavaPractice/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ben-ou/JavaPractice/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/ben-ou/JavaPractice/statuses/b7e3ae0619a1e2b29199f33244eaee12e9733064"}}}}