{"action":"created","comment":{"url":"https://api.github.com/repos/woworks/otus-spring-2018/pulls/comments/200198077","pull_request_review_id":134466903,"id":200198077,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwMDE5ODA3Nw==","diff_hunk":"@@ -0,0 +1,54 @@\n+package com.woworks.otus.spring.hw1;\n+\n+import com.woworks.otus.spring.hw1.domain.Question;\n+import com.woworks.otus.spring.hw1.service.QuestionService;\n+import org.springframework.context.support.ClassPathXmlApplicationContext;\n+\n+import java.util.Arrays;\n+import java.util.List;\n+import java.util.Scanner;\n+\n+public class Main {\n+\n+    public static void main(String[] args) {\n+        runQuiz();\n+    }\n+\n+\n+    private static void runQuiz() {\n+\n+        int score = 0;\n+\n+        List<String> answers = Arrays.asList(\"1\", \"2\", \"3\", \"4\");\n+        System.out.println(\"Please answer the following 5 questions:\");\n+\n+        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(\"/spring-context.xml\");\n+        QuestionService service = context.getBean(QuestionService.class);\n+        List<Question> questions = service.getAll();\n+        System.out.println(\"questions: \" + questions.toString());\n+\n+        Scanner scanner = new Scanner(System.in);\n+\n+        for (Question question : questions) {\n+            System.out.println(question.getQuestion() + \"(1,2,3,4)\");\n+            for (int i = 0; i < question.getAnswers().size(); i++) {\n+                System.out.println((i + 1) + \": \" + question.getAnswers().get(i));\n+            }\n+\n+            String answer = scanner.nextLine();\n+            while (!answers.contains(answer)) {\n+                System.out.println(\"Wrong input!. Correct input - 1 or 2 or 3 or 4\");\n+                answer = scanner.nextLine();\n+            }\n+\n+            String userAnswer = question.getAnswers().get(Integer.valueOf(answer) - 1);\n+            System.out.println(\"Your answer: \" + userAnswer);\n+\n+            if (question.getCorrectAnswer().equals(userAnswer)) {\n+                score++;\n+            }\n+        }\n+\n+        System.out.println(\"Your score is: \" + score);\n+    }","path":"hw1-spring-intro/src/main/java/com/woworks/otus/spring/hw1/Main.java","position":53,"original_position":53,"commit_id":"08feded08fc131d7371a85cb79995ecc8a905a1a","original_commit_id":"08feded08fc131d7371a85cb79995ecc8a905a1a","user":{"login":"ydvorzhetskiy","id":5715941,"node_id":"MDQ6VXNlcjU3MTU5NDE=","avatar_url":"https://avatars2.githubusercontent.com/u/5715941?v=4","gravatar_id":"","url":"https://api.github.com/users/ydvorzhetskiy","html_url":"https://github.com/ydvorzhetskiy","followers_url":"https://api.github.com/users/ydvorzhetskiy/followers","following_url":"https://api.github.com/users/ydvorzhetskiy/following{/other_user}","gists_url":"https://api.github.com/users/ydvorzhetskiy/gists{/gist_id}","starred_url":"https://api.github.com/users/ydvorzhetskiy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ydvorzhetskiy/subscriptions","organizations_url":"https://api.github.com/users/ydvorzhetskiy/orgs","repos_url":"https://api.github.com/users/ydvorzhetskiy/repos","events_url":"https://api.github.com/users/ydvorzhetskiy/events{/privacy}","received_events_url":"https://api.github.com/users/ydvorzhetskiy/received_events","type":"User","site_admin":false},"body":"Предполагалось, что в Main Вы получите один только бин и вызовете один тольеко метод)\r\n\r\nЕсли уж совсем не хочется засовывать в бин. ТО предлагаю засунуть в домееные объекты. Т.е. выделить тест.\r\n\r\n```if (question.getCorrectAnswer().equals(userAnswer)) {\r\n     score++;\r\n}``` - вот это отличный пример бизнес-логики, которую момжно поместить куда-то.","created_at":"2018-07-04T20:31:01Z","updated_at":"2018-07-04T20:41:59Z","html_url":"https://github.com/woworks/otus-spring-2018/pull/1#discussion_r200198077","pull_request_url":"https://api.github.com/repos/woworks/otus-spring-2018/pulls/1","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/woworks/otus-spring-2018/pulls/comments/200198077"},"html":{"href":"https://github.com/woworks/otus-spring-2018/pull/1#discussion_r200198077"},"pull_request":{"href":"https://api.github.com/repos/woworks/otus-spring-2018/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/woworks/otus-spring-2018/pulls/1","id":198544150,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk4NTQ0MTUw","html_url":"https://github.com/woworks/otus-spring-2018/pull/1","diff_url":"https://github.com/woworks/otus-spring-2018/pull/1.diff","patch_url":"https://github.com/woworks/otus-spring-2018/pull/1.patch","issue_url":"https://api.github.com/repos/woworks/otus-spring-2018/issues/1","number":1,"state":"open","locked":false,"title":"- homework 1 initial commit (quiz app reading questions/answers data …","user":{"login":"woworks","id":2965982,"node_id":"MDQ6VXNlcjI5NjU5ODI=","avatar_url":"https://avatars0.githubusercontent.com/u/2965982?v=4","gravatar_id":"","url":"https://api.github.com/users/woworks","html_url":"https://github.com/woworks","followers_url":"https://api.github.com/users/woworks/followers","following_url":"https://api.github.com/users/woworks/following{/other_user}","gists_url":"https://api.github.com/users/woworks/gists{/gist_id}","starred_url":"https://api.github.com/users/woworks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/woworks/subscriptions","organizations_url":"https://api.github.com/users/woworks/orgs","repos_url":"https://api.github.com/users/woworks/repos","events_url":"https://api.github.com/users/woworks/events{/privacy}","received_events_url":"https://api.github.com/users/woworks/received_events","type":"User","site_admin":false},"body":"…from csv file)","created_at":"2018-07-01T21:43:55Z","updated_at":"2018-07-04T20:41:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b63d1ec89dc7a8bc966287a3cfd29c9e79d04749","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/woworks/otus-spring-2018/pulls/1/commits","review_comments_url":"https://api.github.com/repos/woworks/otus-spring-2018/pulls/1/comments","review_comment_url":"https://api.github.com/repos/woworks/otus-spring-2018/pulls/comments{/number}","comments_url":"https://api.github.com/repos/woworks/otus-spring-2018/issues/1/comments","statuses_url":"https://api.github.com/repos/woworks/otus-spring-2018/statuses/08feded08fc131d7371a85cb79995ecc8a905a1a","head":{"label":"woworks:feature/hw1","ref":"feature/hw1","sha":"08feded08fc131d7371a85cb79995ecc8a905a1a","user":{"login":"woworks","id":2965982,"node_id":"MDQ6VXNlcjI5NjU5ODI=","avatar_url":"https://avatars0.githubusercontent.com/u/2965982?v=4","gravatar_id":"","url":"https://api.github.com/users/woworks","html_url":"https://github.com/woworks","followers_url":"https://api.github.com/users/woworks/followers","following_url":"https://api.github.com/users/woworks/following{/other_user}","gists_url":"https://api.github.com/users/woworks/gists{/gist_id}","starred_url":"https://api.github.com/users/woworks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/woworks/subscriptions","organizations_url":"https://api.github.com/users/woworks/orgs","repos_url":"https://api.github.com/users/woworks/repos","events_url":"https://api.github.com/users/woworks/events{/privacy}","received_events_url":"https://api.github.com/users/woworks/received_events","type":"User","site_admin":false},"repo":{"id":138933103,"node_id":"MDEwOlJlcG9zaXRvcnkxMzg5MzMxMDM=","name":"otus-spring-2018","full_name":"woworks/otus-spring-2018","owner":{"login":"woworks","id":2965982,"node_id":"MDQ6VXNlcjI5NjU5ODI=","avatar_url":"https://avatars0.githubusercontent.com/u/2965982?v=4","gravatar_id":"","url":"https://api.github.com/users/woworks","html_url":"https://github.com/woworks","followers_url":"https://api.github.com/users/woworks/followers","following_url":"https://api.github.com/users/woworks/following{/other_user}","gists_url":"https://api.github.com/users/woworks/gists{/gist_id}","starred_url":"https://api.github.com/users/woworks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/woworks/subscriptions","organizations_url":"https://api.github.com/users/woworks/orgs","repos_url":"https://api.github.com/users/woworks/repos","events_url":"https://api.github.com/users/woworks/events{/privacy}","received_events_url":"https://api.github.com/users/woworks/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/woworks/otus-spring-2018","description":"Otus spring 2018 course homeworks","fork":false,"url":"https://api.github.com/repos/woworks/otus-spring-2018","forks_url":"https://api.github.com/repos/woworks/otus-spring-2018/forks","keys_url":"https://api.github.com/repos/woworks/otus-spring-2018/keys{/key_id}","collaborators_url":"https://api.github.com/repos/woworks/otus-spring-2018/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/woworks/otus-spring-2018/teams","hooks_url":"https://api.github.com/repos/woworks/otus-spring-2018/hooks","issue_events_url":"https://api.github.com/repos/woworks/otus-spring-2018/issues/events{/number}","events_url":"https://api.github.com/repos/woworks/otus-spring-2018/events","assignees_url":"https://api.github.com/repos/woworks/otus-spring-2018/assignees{/user}","branches_url":"https://api.github.com/repos/woworks/otus-spring-2018/branches{/branch}","tags_url":"https://api.github.com/repos/woworks/otus-spring-2018/tags","blobs_url":"https://api.github.com/repos/woworks/otus-spring-2018/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/woworks/otus-spring-2018/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/woworks/otus-spring-2018/git/refs{/sha}","trees_url":"https://api.github.com/repos/woworks/otus-spring-2018/git/trees{/sha}","statuses_url":"https://api.github.com/repos/woworks/otus-spring-2018/statuses/{sha}","languages_url":"https://api.github.com/repos/woworks/otus-spring-2018/languages","stargazers_url":"https://api.github.com/repos/woworks/otus-spring-2018/stargazers","contributors_url":"https://api.github.com/repos/woworks/otus-spring-2018/contributors","subscribers_url":"https://api.github.com/repos/woworks/otus-spring-2018/subscribers","subscription_url":"https://api.github.com/repos/woworks/otus-spring-2018/subscription","commits_url":"https://api.github.com/repos/woworks/otus-spring-2018/commits{/sha}","git_commits_url":"https://api.github.com/repos/woworks/otus-spring-2018/git/commits{/sha}","comments_url":"https://api.github.com/repos/woworks/otus-spring-2018/comments{/number}","issue_comment_url":"https://api.github.com/repos/woworks/otus-spring-2018/issues/comments{/number}","contents_url":"https://api.github.com/repos/woworks/otus-spring-2018/contents/{+path}","compare_url":"https://api.github.com/repos/woworks/otus-spring-2018/compare/{base}...{head}","merges_url":"https://api.github.com/repos/woworks/otus-spring-2018/merges","archive_url":"https://api.github.com/repos/woworks/otus-spring-2018/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/woworks/otus-spring-2018/downloads","issues_url":"https://api.github.com/repos/woworks/otus-spring-2018/issues{/number}","pulls_url":"https://api.github.com/repos/woworks/otus-spring-2018/pulls{/number}","milestones_url":"https://api.github.com/repos/woworks/otus-spring-2018/milestones{/number}","notifications_url":"https://api.github.com/repos/woworks/otus-spring-2018/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/woworks/otus-spring-2018/labels{/name}","releases_url":"https://api.github.com/repos/woworks/otus-spring-2018/releases{/id}","deployments_url":"https://api.github.com/repos/woworks/otus-spring-2018/deployments","created_at":"2018-06-27T21:06:57Z","updated_at":"2018-06-27T21:06:59Z","pushed_at":"2018-07-01T21:43:56Z","git_url":"git://github.com/woworks/otus-spring-2018.git","ssh_url":"git@github.com:woworks/otus-spring-2018.git","clone_url":"https://github.com/woworks/otus-spring-2018.git","svn_url":"https://github.com/woworks/otus-spring-2018","homepage":null,"size":5,"stargazers_count":0,"watchers_count":0,"language":null,"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":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"woworks:master","ref":"master","sha":"0f636653d77ad8f79001b83c922a1190c4d60fc3","user":{"login":"woworks","id":2965982,"node_id":"MDQ6VXNlcjI5NjU5ODI=","avatar_url":"https://avatars0.githubusercontent.com/u/2965982?v=4","gravatar_id":"","url":"https://api.github.com/users/woworks","html_url":"https://github.com/woworks","followers_url":"https://api.github.com/users/woworks/followers","following_url":"https://api.github.com/users/woworks/following{/other_user}","gists_url":"https://api.github.com/users/woworks/gists{/gist_id}","starred_url":"https://api.github.com/users/woworks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/woworks/subscriptions","organizations_url":"https://api.github.com/users/woworks/orgs","repos_url":"https://api.github.com/users/woworks/repos","events_url":"https://api.github.com/users/woworks/events{/privacy}","received_events_url":"https://api.github.com/users/woworks/received_events","type":"User","site_admin":false},"repo":{"id":138933103,"node_id":"MDEwOlJlcG9zaXRvcnkxMzg5MzMxMDM=","name":"otus-spring-2018","full_name":"woworks/otus-spring-2018","owner":{"login":"woworks","id":2965982,"node_id":"MDQ6VXNlcjI5NjU5ODI=","avatar_url":"https://avatars0.githubusercontent.com/u/2965982?v=4","gravatar_id":"","url":"https://api.github.com/users/woworks","html_url":"https://github.com/woworks","followers_url":"https://api.github.com/users/woworks/followers","following_url":"https://api.github.com/users/woworks/following{/other_user}","gists_url":"https://api.github.com/users/woworks/gists{/gist_id}","starred_url":"https://api.github.com/users/woworks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/woworks/subscriptions","organizations_url":"https://api.github.com/users/woworks/orgs","repos_url":"https://api.github.com/users/woworks/repos","events_url":"https://api.github.com/users/woworks/events{/privacy}","received_events_url":"https://api.github.com/users/woworks/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/woworks/otus-spring-2018","description":"Otus spring 2018 course homeworks","fork":false,"url":"https://api.github.com/repos/woworks/otus-spring-2018","forks_url":"https://api.github.com/repos/woworks/otus-spring-2018/forks","keys_url":"https://api.github.com/repos/woworks/otus-spring-2018/keys{/key_id}","collaborators_url":"https://api.github.com/repos/woworks/otus-spring-2018/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/woworks/otus-spring-2018/teams","hooks_url":"https://api.github.com/repos/woworks/otus-spring-2018/hooks","issue_events_url":"https://api.github.com/repos/woworks/otus-spring-2018/issues/events{/number}","events_url":"https://api.github.com/repos/woworks/otus-spring-2018/events","assignees_url":"https://api.github.com/repos/woworks/otus-spring-2018/assignees{/user}","branches_url":"https://api.github.com/repos/woworks/otus-spring-2018/branches{/branch}","tags_url":"https://api.github.com/repos/woworks/otus-spring-2018/tags","blobs_url":"https://api.github.com/repos/woworks/otus-spring-2018/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/woworks/otus-spring-2018/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/woworks/otus-spring-2018/git/refs{/sha}","trees_url":"https://api.github.com/repos/woworks/otus-spring-2018/git/trees{/sha}","statuses_url":"https://api.github.com/repos/woworks/otus-spring-2018/statuses/{sha}","languages_url":"https://api.github.com/repos/woworks/otus-spring-2018/languages","stargazers_url":"https://api.github.com/repos/woworks/otus-spring-2018/stargazers","contributors_url":"https://api.github.com/repos/woworks/otus-spring-2018/contributors","subscribers_url":"https://api.github.com/repos/woworks/otus-spring-2018/subscribers","subscription_url":"https://api.github.com/repos/woworks/otus-spring-2018/subscription","commits_url":"https://api.github.com/repos/woworks/otus-spring-2018/commits{/sha}","git_commits_url":"https://api.github.com/repos/woworks/otus-spring-2018/git/commits{/sha}","comments_url":"https://api.github.com/repos/woworks/otus-spring-2018/comments{/number}","issue_comment_url":"https://api.github.com/repos/woworks/otus-spring-2018/issues/comments{/number}","contents_url":"https://api.github.com/repos/woworks/otus-spring-2018/contents/{+path}","compare_url":"https://api.github.com/repos/woworks/otus-spring-2018/compare/{base}...{head}","merges_url":"https://api.github.com/repos/woworks/otus-spring-2018/merges","archive_url":"https://api.github.com/repos/woworks/otus-spring-2018/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/woworks/otus-spring-2018/downloads","issues_url":"https://api.github.com/repos/woworks/otus-spring-2018/issues{/number}","pulls_url":"https://api.github.com/repos/woworks/otus-spring-2018/pulls{/number}","milestones_url":"https://api.github.com/repos/woworks/otus-spring-2018/milestones{/number}","notifications_url":"https://api.github.com/repos/woworks/otus-spring-2018/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/woworks/otus-spring-2018/labels{/name}","releases_url":"https://api.github.com/repos/woworks/otus-spring-2018/releases{/id}","deployments_url":"https://api.github.com/repos/woworks/otus-spring-2018/deployments","created_at":"2018-06-27T21:06:57Z","updated_at":"2018-06-27T21:06:59Z","pushed_at":"2018-07-01T21:43:56Z","git_url":"git://github.com/woworks/otus-spring-2018.git","ssh_url":"git@github.com:woworks/otus-spring-2018.git","clone_url":"https://github.com/woworks/otus-spring-2018.git","svn_url":"https://github.com/woworks/otus-spring-2018","homepage":null,"size":5,"stargazers_count":0,"watchers_count":0,"language":null,"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":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/woworks/otus-spring-2018/pulls/1"},"html":{"href":"https://github.com/woworks/otus-spring-2018/pull/1"},"issue":{"href":"https://api.github.com/repos/woworks/otus-spring-2018/issues/1"},"comments":{"href":"https://api.github.com/repos/woworks/otus-spring-2018/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/woworks/otus-spring-2018/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/woworks/otus-spring-2018/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/woworks/otus-spring-2018/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/woworks/otus-spring-2018/statuses/08feded08fc131d7371a85cb79995ecc8a905a1a"}},"author_association":"OWNER"}}
{"actor":{"display_login":"ydvorzhetskiy"}}