{"action":"created","comment":{"url":"https://api.github.com/repos/epamteam6/RestaurantWeb/pulls/comments/148742340","pull_request_review_id":74032157,"id":148742340,"diff_hunk":"@@ -0,0 +1,97 @@\n+package com.dao;\n+\n+import com.model.DishOrder;\n+import org.junit.Before;\n+import org.junit.Test;\n+import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder;\n+import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType;\n+\n+import static org.junit.Assert.*;\n+import static org.hamcrest.CoreMatchers.*;\n+\n+import javax.sql.DataSource;\n+import java.util.ArrayList;\n+import java.util.List;\n+\n+public class DishOrderDAOTest {\n+\n+    DishOrderDAO dishOrderDAO = DishOrderDAO.getInstance();\n+\n+    @Before\n+    public void init() throws Exception {\n+\n+        dishOrderDAO.setDataSource(getDataSource());\n+    }\n+\n+    public DataSource getDataSource() {\n+\n+        EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder();\n+\n+        return builder\n+                .setType(EmbeddedDatabaseType.H2)\n+                .addScript(\"init_dish_order.sql\")\n+                .addScript(\"data_dish_order.sql\")\n+                .build();\n+    }\n+\n+    @Test\n+    public void add() throws Exception {\n+\n+        DishOrder dishOrder = new DishOrder(6, 100, 100, 100, 1000);\n+        dishOrderDAO.create(dishOrder);\n+\n+        assertEquals(dishOrderDAO.getByOrderId(100).get(), dishOrder);\n+    }\n+\n+    @Test\n+    public void update() throws Exception {\n+\n+        DishOrder act = dishOrderDAO.getById(1).get();\n+        act.setDishSum(100);\n+        dishOrderDAO.update(act);\n+\n+        DishOrder exp = dishOrderDAO.getById(1).get();\n+        assertEquals(act, exp);\n+    }\n+\n+    @Test\n+    public void remove() throws Exception {\n+\n+        assertEquals(true, dishOrderDAO.getById(2).isPresent());\n+        dishOrderDAO.remove(2);\n+        assertEquals(false, dishOrderDAO.getById(2).isPresent());\n+    }\n+\n+    @Test\n+    public void getAll() throws Exception {\n+\n+        List<DishOrder> act = dishOrderDAO.getAll();\n+\n+        List<DishOrder> exp = new ArrayList<>();\n+        exp.add(new DishOrder(1, 1, 2, 2, 340));\n+        exp.add(new DishOrder(2, 1, 6, 1, 135));\n+        exp.add(new DishOrder(3, 2, 4, 1, 180));\n+        exp.add(new DishOrder(4, 2, 9, 2, 110));\n+        exp.add(new DishOrder(5, 3, 8, 3, 330));\n+\n+        assertThat(act, is(exp));\n+    }\n+\n+    @Test\n+    public void getByOrderId() throws Exception {\n+\n+        DishOrder act = dishOrderDAO.getByOrderId(1).get();\n+        DishOrder exp = new DishOrder(1, 1, 2, 2, 340);\n+\n+        assertThat(act, is(exp));\n+    }\n+\n+    @Test\n+    public void getById() throws Exception {\n+\n+        DishOrder act = dishOrderDAO.getById(2).get();\n+        DishOrder exp = new DishOrder(2, 1, 6, 1, 135);\n+\n+        assertThat(act, is(exp));\n+    }\n+}","path":"src/test/java/com/dao/DishOrderDAOTest.java","position":113,"original_position":97,"commit_id":"ec0a0dc9ac17241da8819591bb144a2317e430ba","original_commit_id":"a07031b399bc29407e695758cf62b5d881f7eb19","user":{"login":"Valannor","id":25310430,"avatar_url":"https://avatars0.githubusercontent.com/u/25310430?v=4","gravatar_id":"","url":"https://api.github.com/users/Valannor","html_url":"https://github.com/Valannor","followers_url":"https://api.github.com/users/Valannor/followers","following_url":"https://api.github.com/users/Valannor/following{/other_user}","gists_url":"https://api.github.com/users/Valannor/gists{/gist_id}","starred_url":"https://api.github.com/users/Valannor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Valannor/subscriptions","organizations_url":"https://api.github.com/users/Valannor/orgs","repos_url":"https://api.github.com/users/Valannor/repos","events_url":"https://api.github.com/users/Valannor/events{/privacy}","received_events_url":"https://api.github.com/users/Valannor/received_events","type":"User","site_admin":false},"body":"Done","created_at":"2017-11-03T09:58:29Z","updated_at":"2017-11-03T09:58:29Z","html_url":"https://github.com/epamteam6/RestaurantWeb/pull/6#discussion_r148742340","pull_request_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/pulls/6","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/epamteam6/RestaurantWeb/pulls/comments/148742340"},"html":{"href":"https://github.com/epamteam6/RestaurantWeb/pull/6#discussion_r148742340"},"pull_request":{"href":"https://api.github.com/repos/epamteam6/RestaurantWeb/pulls/6"}},"in_reply_to_id":148505510},"pull_request":{"url":"https://api.github.com/repos/epamteam6/RestaurantWeb/pulls/6","id":150032053,"html_url":"https://github.com/epamteam6/RestaurantWeb/pull/6","diff_url":"https://github.com/epamteam6/RestaurantWeb/pull/6.diff","patch_url":"https://github.com/epamteam6/RestaurantWeb/pull/6.patch","issue_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/issues/6","number":6,"state":"open","locked":false,"title":"Restaurant 4 dish order dao","user":{"login":"Valannor","id":25310430,"avatar_url":"https://avatars0.githubusercontent.com/u/25310430?v=4","gravatar_id":"","url":"https://api.github.com/users/Valannor","html_url":"https://github.com/Valannor","followers_url":"https://api.github.com/users/Valannor/followers","following_url":"https://api.github.com/users/Valannor/following{/other_user}","gists_url":"https://api.github.com/users/Valannor/gists{/gist_id}","starred_url":"https://api.github.com/users/Valannor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Valannor/subscriptions","organizations_url":"https://api.github.com/users/Valannor/orgs","repos_url":"https://api.github.com/users/Valannor/repos","events_url":"https://api.github.com/users/Valannor/events{/privacy}","received_events_url":"https://api.github.com/users/Valannor/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-11-01T12:55:10Z","updated_at":"2017-11-03T09:58:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cc9053a0a00403f1e6adc60b9c04e2d1e1aaa4f8","assignee":null,"assignees":[],"requested_reviewers":[{"login":"vlshat","id":11502482,"avatar_url":"https://avatars0.githubusercontent.com/u/11502482?v=4","gravatar_id":"","url":"https://api.github.com/users/vlshat","html_url":"https://github.com/vlshat","followers_url":"https://api.github.com/users/vlshat/followers","following_url":"https://api.github.com/users/vlshat/following{/other_user}","gists_url":"https://api.github.com/users/vlshat/gists{/gist_id}","starred_url":"https://api.github.com/users/vlshat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vlshat/subscriptions","organizations_url":"https://api.github.com/users/vlshat/orgs","repos_url":"https://api.github.com/users/vlshat/repos","events_url":"https://api.github.com/users/vlshat/events{/privacy}","received_events_url":"https://api.github.com/users/vlshat/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/pulls/6/commits","review_comments_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/pulls/6/comments","review_comment_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/pulls/comments{/number}","comments_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/issues/6/comments","statuses_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/statuses/ec0a0dc9ac17241da8819591bb144a2317e430ba","head":{"label":"epamteam6:restaurant_4_DishOrderDAO","ref":"restaurant_4_DishOrderDAO","sha":"ec0a0dc9ac17241da8819591bb144a2317e430ba","user":{"login":"epamteam6","id":32954943,"avatar_url":"https://avatars3.githubusercontent.com/u/32954943?v=4","gravatar_id":"","url":"https://api.github.com/users/epamteam6","html_url":"https://github.com/epamteam6","followers_url":"https://api.github.com/users/epamteam6/followers","following_url":"https://api.github.com/users/epamteam6/following{/other_user}","gists_url":"https://api.github.com/users/epamteam6/gists{/gist_id}","starred_url":"https://api.github.com/users/epamteam6/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/epamteam6/subscriptions","organizations_url":"https://api.github.com/users/epamteam6/orgs","repos_url":"https://api.github.com/users/epamteam6/repos","events_url":"https://api.github.com/users/epamteam6/events{/privacy}","received_events_url":"https://api.github.com/users/epamteam6/received_events","type":"User","site_admin":false},"repo":{"id":108543428,"name":"RestaurantWeb","full_name":"epamteam6/RestaurantWeb","owner":{"login":"epamteam6","id":32954943,"avatar_url":"https://avatars3.githubusercontent.com/u/32954943?v=4","gravatar_id":"","url":"https://api.github.com/users/epamteam6","html_url":"https://github.com/epamteam6","followers_url":"https://api.github.com/users/epamteam6/followers","following_url":"https://api.github.com/users/epamteam6/following{/other_user}","gists_url":"https://api.github.com/users/epamteam6/gists{/gist_id}","starred_url":"https://api.github.com/users/epamteam6/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/epamteam6/subscriptions","organizations_url":"https://api.github.com/users/epamteam6/orgs","repos_url":"https://api.github.com/users/epamteam6/repos","events_url":"https://api.github.com/users/epamteam6/events{/privacy}","received_events_url":"https://api.github.com/users/epamteam6/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/epamteam6/RestaurantWeb","description":null,"fork":false,"url":"https://api.github.com/repos/epamteam6/RestaurantWeb","forks_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/forks","keys_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/teams","hooks_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/hooks","issue_events_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/issues/events{/number}","events_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/events","assignees_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/assignees{/user}","branches_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/branches{/branch}","tags_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/tags","blobs_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/git/refs{/sha}","trees_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/statuses/{sha}","languages_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/languages","stargazers_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/stargazers","contributors_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/contributors","subscribers_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/subscribers","subscription_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/subscription","commits_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/commits{/sha}","git_commits_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/git/commits{/sha}","comments_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/comments{/number}","issue_comment_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/issues/comments{/number}","contents_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/contents/{+path}","compare_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/merges","archive_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/downloads","issues_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/issues{/number}","pulls_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/pulls{/number}","milestones_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/milestones{/number}","notifications_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/labels{/name}","releases_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/releases{/id}","deployments_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/deployments","created_at":"2017-10-27T12:29:09Z","updated_at":"2017-10-29T14:06:13Z","pushed_at":"2017-11-02T21:46:39Z","git_url":"git://github.com/epamteam6/RestaurantWeb.git","ssh_url":"git@github.com:epamteam6/RestaurantWeb.git","clone_url":"https://github.com/epamteam6/RestaurantWeb.git","svn_url":"https://github.com/epamteam6/RestaurantWeb","homepage":null,"size":122,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"base":{"label":"epamteam6:master","ref":"master","sha":"f0701b25c60614a2ab06d9c972eb0d7c0c7bc668","user":{"login":"epamteam6","id":32954943,"avatar_url":"https://avatars3.githubusercontent.com/u/32954943?v=4","gravatar_id":"","url":"https://api.github.com/users/epamteam6","html_url":"https://github.com/epamteam6","followers_url":"https://api.github.com/users/epamteam6/followers","following_url":"https://api.github.com/users/epamteam6/following{/other_user}","gists_url":"https://api.github.com/users/epamteam6/gists{/gist_id}","starred_url":"https://api.github.com/users/epamteam6/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/epamteam6/subscriptions","organizations_url":"https://api.github.com/users/epamteam6/orgs","repos_url":"https://api.github.com/users/epamteam6/repos","events_url":"https://api.github.com/users/epamteam6/events{/privacy}","received_events_url":"https://api.github.com/users/epamteam6/received_events","type":"User","site_admin":false},"repo":{"id":108543428,"name":"RestaurantWeb","full_name":"epamteam6/RestaurantWeb","owner":{"login":"epamteam6","id":32954943,"avatar_url":"https://avatars3.githubusercontent.com/u/32954943?v=4","gravatar_id":"","url":"https://api.github.com/users/epamteam6","html_url":"https://github.com/epamteam6","followers_url":"https://api.github.com/users/epamteam6/followers","following_url":"https://api.github.com/users/epamteam6/following{/other_user}","gists_url":"https://api.github.com/users/epamteam6/gists{/gist_id}","starred_url":"https://api.github.com/users/epamteam6/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/epamteam6/subscriptions","organizations_url":"https://api.github.com/users/epamteam6/orgs","repos_url":"https://api.github.com/users/epamteam6/repos","events_url":"https://api.github.com/users/epamteam6/events{/privacy}","received_events_url":"https://api.github.com/users/epamteam6/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/epamteam6/RestaurantWeb","description":null,"fork":false,"url":"https://api.github.com/repos/epamteam6/RestaurantWeb","forks_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/forks","keys_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/teams","hooks_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/hooks","issue_events_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/issues/events{/number}","events_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/events","assignees_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/assignees{/user}","branches_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/branches{/branch}","tags_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/tags","blobs_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/git/refs{/sha}","trees_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/statuses/{sha}","languages_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/languages","stargazers_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/stargazers","contributors_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/contributors","subscribers_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/subscribers","subscription_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/subscription","commits_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/commits{/sha}","git_commits_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/git/commits{/sha}","comments_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/comments{/number}","issue_comment_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/issues/comments{/number}","contents_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/contents/{+path}","compare_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/merges","archive_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/downloads","issues_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/issues{/number}","pulls_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/pulls{/number}","milestones_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/milestones{/number}","notifications_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/labels{/name}","releases_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/releases{/id}","deployments_url":"https://api.github.com/repos/epamteam6/RestaurantWeb/deployments","created_at":"2017-10-27T12:29:09Z","updated_at":"2017-10-29T14:06:13Z","pushed_at":"2017-11-02T21:46:39Z","git_url":"git://github.com/epamteam6/RestaurantWeb.git","ssh_url":"git@github.com:epamteam6/RestaurantWeb.git","clone_url":"https://github.com/epamteam6/RestaurantWeb.git","svn_url":"https://github.com/epamteam6/RestaurantWeb","homepage":null,"size":122,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/epamteam6/RestaurantWeb/pulls/6"},"html":{"href":"https://github.com/epamteam6/RestaurantWeb/pull/6"},"issue":{"href":"https://api.github.com/repos/epamteam6/RestaurantWeb/issues/6"},"comments":{"href":"https://api.github.com/repos/epamteam6/RestaurantWeb/issues/6/comments"},"review_comments":{"href":"https://api.github.com/repos/epamteam6/RestaurantWeb/pulls/6/comments"},"review_comment":{"href":"https://api.github.com/repos/epamteam6/RestaurantWeb/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/epamteam6/RestaurantWeb/pulls/6/commits"},"statuses":{"href":"https://api.github.com/repos/epamteam6/RestaurantWeb/statuses/ec0a0dc9ac17241da8819591bb144a2317e430ba"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"Valannor"}}