{"action":"created","comment":{"url":"https://api.github.com/repos/clouway-incubator/servlets/pulls/comments/43005928","id":43005928,"diff_hunk":"@@ -0,0 +1,103 @@\n+package com.clouway.servlets.task5.Http;\n+\n+\n+import javax.servlet.http.HttpServletRequest;\n+import javax.servlet.http.HttpServletResponse;\n+\n+import com.clouway.servlets.task5.core.JettyServer;\n+import org.jmock.Expectations;\n+import org.jmock.auto.Mock;\n+import org.jmock.integration.junit4.JUnitRuleMockery;\n+import org.junit.Before;\n+import org.junit.Rule;\n+import org.junit.Test;\n+\n+import java.io.PrintWriter;\n+\n+\n+/**\n+ * Created by clouway on 15-10-26.\n+ */\n+public class LoginServletTest {\n+\n+    private LoginServlet loginServlet;\n+\n+\n+    @Rule\n+    public JUnitRuleMockery context = new JUnitRuleMockery();\n+\n+    @Mock\n+    private HttpServletResponse response = null;\n+\n+    @Mock\n+    private HttpServletRequest request = null;\n+\n+\n+\n+    @Before\n+    public void setUp() {\n+\n+        loginServlet = new LoginServlet();\n+\n+\n+\n+    }\n+\n+\n+    @Test\n+    public void loginWithExistingUser() throws Exception {\n+        JettyServer jettyServer = new JettyServer();\n+        final RequestUser requestUser = new RequestUser(\"koko\",\"123789\");\n+\n+\n+        context.checking(new Expectations() {{\n+\n+            oneOf(response).setContentType(\"text/html\");\n+\n+            oneOf(request).getParameter(\"user\");\n+            will(returnValue(requestUser.user));\n+\n+\n+            oneOf(request).getParameter(\"password\");\n+            will(returnValue(requestUser.password));\n+\n+            oneOf(request).getRequestDispatcher(\"welcomeServlet\");\n+\n+\n+        }\n+        });\n+\n+        loginServlet.doGet(request, response);\n+    }\n+\n+    @Test\n+    public void loginWithNotExistingUser() throws Exception {\n+        JettyServer jettyServer = new JettyServer();","path":"test/com/clouway/servlets/task5/Http/LoginServletTest.java","position":75,"original_position":75,"commit_id":"31a221612ad7c73225349faa0d41b7ac8237addd","original_commit_id":"31a221612ad7c73225349faa0d41b7ac8237addd","user":{"login":"mgenov","id":209223,"avatar_url":"https://avatars.githubusercontent.com/u/209223?v=3","gravatar_id":"","url":"https://api.github.com/users/mgenov","html_url":"https://github.com/mgenov","followers_url":"https://api.github.com/users/mgenov/followers","following_url":"https://api.github.com/users/mgenov/following{/other_user}","gists_url":"https://api.github.com/users/mgenov/gists{/gist_id}","starred_url":"https://api.github.com/users/mgenov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mgenov/subscriptions","organizations_url":"https://api.github.com/users/mgenov/orgs","repos_url":"https://api.github.com/users/mgenov/repos","events_url":"https://api.github.com/users/mgenov/events{/privacy}","received_events_url":"https://api.github.com/users/mgenov/received_events","type":"User","site_admin":false},"body":"Yeah, but you are using mocks for testing here. ","created_at":"2015-10-26T15:14:57Z","updated_at":"2015-10-26T15:14:57Z","html_url":"https://github.com/clouway-incubator/servlets/pull/4#discussion_r43005928","pull_request_url":"https://api.github.com/repos/clouway-incubator/servlets/pulls/4","_links":{"self":{"href":"https://api.github.com/repos/clouway-incubator/servlets/pulls/comments/43005928"},"html":{"href":"https://github.com/clouway-incubator/servlets/pull/4#discussion_r43005928"},"pull_request":{"href":"https://api.github.com/repos/clouway-incubator/servlets/pulls/4"}}},"pull_request":{"url":"https://api.github.com/repos/clouway-incubator/servlets/pulls/4","id":48729625,"html_url":"https://github.com/clouway-incubator/servlets/pull/4","diff_url":"https://github.com/clouway-incubator/servlets/pull/4.diff","patch_url":"https://github.com/clouway-incubator/servlets/pull/4.patch","issue_url":"https://api.github.com/repos/clouway-incubator/servlets/issues/4","number":4,"state":"open","locked":false,"title":"task 5","user":{"login":"Zornica","id":11094032,"avatar_url":"https://avatars.githubusercontent.com/u/11094032?v=3","gravatar_id":"","url":"https://api.github.com/users/Zornica","html_url":"https://github.com/Zornica","followers_url":"https://api.github.com/users/Zornica/followers","following_url":"https://api.github.com/users/Zornica/following{/other_user}","gists_url":"https://api.github.com/users/Zornica/gists{/gist_id}","starred_url":"https://api.github.com/users/Zornica/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Zornica/subscriptions","organizations_url":"https://api.github.com/users/Zornica/orgs","repos_url":"https://api.github.com/users/Zornica/repos","events_url":"https://api.github.com/users/Zornica/events{/privacy}","received_events_url":"https://api.github.com/users/Zornica/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-10-26T11:50:19Z","updated_at":"2015-10-26T15:14:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9992a2f17c0aa152bdfc28888371180650a70202","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/clouway-incubator/servlets/pulls/4/commits","review_comments_url":"https://api.github.com/repos/clouway-incubator/servlets/pulls/4/comments","review_comment_url":"https://api.github.com/repos/clouway-incubator/servlets/pulls/comments{/number}","comments_url":"https://api.github.com/repos/clouway-incubator/servlets/issues/4/comments","statuses_url":"https://api.github.com/repos/clouway-incubator/servlets/statuses/31a221612ad7c73225349faa0d41b7ac8237addd","head":{"label":"Zornica:master","ref":"master","sha":"31a221612ad7c73225349faa0d41b7ac8237addd","user":{"login":"Zornica","id":11094032,"avatar_url":"https://avatars.githubusercontent.com/u/11094032?v=3","gravatar_id":"","url":"https://api.github.com/users/Zornica","html_url":"https://github.com/Zornica","followers_url":"https://api.github.com/users/Zornica/followers","following_url":"https://api.github.com/users/Zornica/following{/other_user}","gists_url":"https://api.github.com/users/Zornica/gists{/gist_id}","starred_url":"https://api.github.com/users/Zornica/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Zornica/subscriptions","organizations_url":"https://api.github.com/users/Zornica/orgs","repos_url":"https://api.github.com/users/Zornica/repos","events_url":"https://api.github.com/users/Zornica/events{/privacy}","received_events_url":"https://api.github.com/users/Zornica/received_events","type":"User","site_admin":false},"repo":{"id":44366096,"name":"servlets","full_name":"Zornica/servlets","owner":{"login":"Zornica","id":11094032,"avatar_url":"https://avatars.githubusercontent.com/u/11094032?v=3","gravatar_id":"","url":"https://api.github.com/users/Zornica","html_url":"https://github.com/Zornica","followers_url":"https://api.github.com/users/Zornica/followers","following_url":"https://api.github.com/users/Zornica/following{/other_user}","gists_url":"https://api.github.com/users/Zornica/gists{/gist_id}","starred_url":"https://api.github.com/users/Zornica/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Zornica/subscriptions","organizations_url":"https://api.github.com/users/Zornica/orgs","repos_url":"https://api.github.com/users/Zornica/repos","events_url":"https://api.github.com/users/Zornica/events{/privacy}","received_events_url":"https://api.github.com/users/Zornica/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Zornica/servlets","description":"Servlets ","fork":true,"url":"https://api.github.com/repos/Zornica/servlets","forks_url":"https://api.github.com/repos/Zornica/servlets/forks","keys_url":"https://api.github.com/repos/Zornica/servlets/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Zornica/servlets/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Zornica/servlets/teams","hooks_url":"https://api.github.com/repos/Zornica/servlets/hooks","issue_events_url":"https://api.github.com/repos/Zornica/servlets/issues/events{/number}","events_url":"https://api.github.com/repos/Zornica/servlets/events","assignees_url":"https://api.github.com/repos/Zornica/servlets/assignees{/user}","branches_url":"https://api.github.com/repos/Zornica/servlets/branches{/branch}","tags_url":"https://api.github.com/repos/Zornica/servlets/tags","blobs_url":"https://api.github.com/repos/Zornica/servlets/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Zornica/servlets/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Zornica/servlets/git/refs{/sha}","trees_url":"https://api.github.com/repos/Zornica/servlets/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Zornica/servlets/statuses/{sha}","languages_url":"https://api.github.com/repos/Zornica/servlets/languages","stargazers_url":"https://api.github.com/repos/Zornica/servlets/stargazers","contributors_url":"https://api.github.com/repos/Zornica/servlets/contributors","subscribers_url":"https://api.github.com/repos/Zornica/servlets/subscribers","subscription_url":"https://api.github.com/repos/Zornica/servlets/subscription","commits_url":"https://api.github.com/repos/Zornica/servlets/commits{/sha}","git_commits_url":"https://api.github.com/repos/Zornica/servlets/git/commits{/sha}","comments_url":"https://api.github.com/repos/Zornica/servlets/comments{/number}","issue_comment_url":"https://api.github.com/repos/Zornica/servlets/issues/comments{/number}","contents_url":"https://api.github.com/repos/Zornica/servlets/contents/{+path}","compare_url":"https://api.github.com/repos/Zornica/servlets/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Zornica/servlets/merges","archive_url":"https://api.github.com/repos/Zornica/servlets/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Zornica/servlets/downloads","issues_url":"https://api.github.com/repos/Zornica/servlets/issues{/number}","pulls_url":"https://api.github.com/repos/Zornica/servlets/pulls{/number}","milestones_url":"https://api.github.com/repos/Zornica/servlets/milestones{/number}","notifications_url":"https://api.github.com/repos/Zornica/servlets/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Zornica/servlets/labels{/name}","releases_url":"https://api.github.com/repos/Zornica/servlets/releases{/id}","created_at":"2015-10-16T06:17:57Z","updated_at":"2015-10-16T06:27:15Z","pushed_at":"2015-10-26T14:42:11Z","git_url":"git://github.com/Zornica/servlets.git","ssh_url":"git@github.com:Zornica/servlets.git","clone_url":"https://github.com/Zornica/servlets.git","svn_url":"https://github.com/Zornica/servlets","homepage":null,"size":112,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"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":"clouway-incubator:zornica","ref":"zornica","sha":"467bf47d2cc04e4b0f14df297213a423c4c59ce2","user":{"login":"clouway-incubator","id":10173098,"avatar_url":"https://avatars.githubusercontent.com/u/10173098?v=3","gravatar_id":"","url":"https://api.github.com/users/clouway-incubator","html_url":"https://github.com/clouway-incubator","followers_url":"https://api.github.com/users/clouway-incubator/followers","following_url":"https://api.github.com/users/clouway-incubator/following{/other_user}","gists_url":"https://api.github.com/users/clouway-incubator/gists{/gist_id}","starred_url":"https://api.github.com/users/clouway-incubator/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clouway-incubator/subscriptions","organizations_url":"https://api.github.com/users/clouway-incubator/orgs","repos_url":"https://api.github.com/users/clouway-incubator/repos","events_url":"https://api.github.com/users/clouway-incubator/events{/privacy}","received_events_url":"https://api.github.com/users/clouway-incubator/received_events","type":"Organization","site_admin":false},"repo":{"id":44299216,"name":"servlets","full_name":"clouway-incubator/servlets","owner":{"login":"clouway-incubator","id":10173098,"avatar_url":"https://avatars.githubusercontent.com/u/10173098?v=3","gravatar_id":"","url":"https://api.github.com/users/clouway-incubator","html_url":"https://github.com/clouway-incubator","followers_url":"https://api.github.com/users/clouway-incubator/followers","following_url":"https://api.github.com/users/clouway-incubator/following{/other_user}","gists_url":"https://api.github.com/users/clouway-incubator/gists{/gist_id}","starred_url":"https://api.github.com/users/clouway-incubator/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clouway-incubator/subscriptions","organizations_url":"https://api.github.com/users/clouway-incubator/orgs","repos_url":"https://api.github.com/users/clouway-incubator/repos","events_url":"https://api.github.com/users/clouway-incubator/events{/privacy}","received_events_url":"https://api.github.com/users/clouway-incubator/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/clouway-incubator/servlets","description":"Servlets ","fork":false,"url":"https://api.github.com/repos/clouway-incubator/servlets","forks_url":"https://api.github.com/repos/clouway-incubator/servlets/forks","keys_url":"https://api.github.com/repos/clouway-incubator/servlets/keys{/key_id}","collaborators_url":"https://api.github.com/repos/clouway-incubator/servlets/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/clouway-incubator/servlets/teams","hooks_url":"https://api.github.com/repos/clouway-incubator/servlets/hooks","issue_events_url":"https://api.github.com/repos/clouway-incubator/servlets/issues/events{/number}","events_url":"https://api.github.com/repos/clouway-incubator/servlets/events","assignees_url":"https://api.github.com/repos/clouway-incubator/servlets/assignees{/user}","branches_url":"https://api.github.com/repos/clouway-incubator/servlets/branches{/branch}","tags_url":"https://api.github.com/repos/clouway-incubator/servlets/tags","blobs_url":"https://api.github.com/repos/clouway-incubator/servlets/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/clouway-incubator/servlets/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/clouway-incubator/servlets/git/refs{/sha}","trees_url":"https://api.github.com/repos/clouway-incubator/servlets/git/trees{/sha}","statuses_url":"https://api.github.com/repos/clouway-incubator/servlets/statuses/{sha}","languages_url":"https://api.github.com/repos/clouway-incubator/servlets/languages","stargazers_url":"https://api.github.com/repos/clouway-incubator/servlets/stargazers","contributors_url":"https://api.github.com/repos/clouway-incubator/servlets/contributors","subscribers_url":"https://api.github.com/repos/clouway-incubator/servlets/subscribers","subscription_url":"https://api.github.com/repos/clouway-incubator/servlets/subscription","commits_url":"https://api.github.com/repos/clouway-incubator/servlets/commits{/sha}","git_commits_url":"https://api.github.com/repos/clouway-incubator/servlets/git/commits{/sha}","comments_url":"https://api.github.com/repos/clouway-incubator/servlets/comments{/number}","issue_comment_url":"https://api.github.com/repos/clouway-incubator/servlets/issues/comments{/number}","contents_url":"https://api.github.com/repos/clouway-incubator/servlets/contents/{+path}","compare_url":"https://api.github.com/repos/clouway-incubator/servlets/compare/{base}...{head}","merges_url":"https://api.github.com/repos/clouway-incubator/servlets/merges","archive_url":"https://api.github.com/repos/clouway-incubator/servlets/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/clouway-incubator/servlets/downloads","issues_url":"https://api.github.com/repos/clouway-incubator/servlets/issues{/number}","pulls_url":"https://api.github.com/repos/clouway-incubator/servlets/pulls{/number}","milestones_url":"https://api.github.com/repos/clouway-incubator/servlets/milestones{/number}","notifications_url":"https://api.github.com/repos/clouway-incubator/servlets/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/clouway-incubator/servlets/labels{/name}","releases_url":"https://api.github.com/repos/clouway-incubator/servlets/releases{/id}","created_at":"2015-10-15T06:53:35Z","updated_at":"2015-10-15T06:53:35Z","pushed_at":"2015-10-26T14:42:11Z","git_url":"git://github.com/clouway-incubator/servlets.git","ssh_url":"git@github.com:clouway-incubator/servlets.git","clone_url":"https://github.com/clouway-incubator/servlets.git","svn_url":"https://github.com/clouway-incubator/servlets","homepage":null,"size":180,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/clouway-incubator/servlets/pulls/4"},"html":{"href":"https://github.com/clouway-incubator/servlets/pull/4"},"issue":{"href":"https://api.github.com/repos/clouway-incubator/servlets/issues/4"},"comments":{"href":"https://api.github.com/repos/clouway-incubator/servlets/issues/4/comments"},"review_comments":{"href":"https://api.github.com/repos/clouway-incubator/servlets/pulls/4/comments"},"review_comment":{"href":"https://api.github.com/repos/clouway-incubator/servlets/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/clouway-incubator/servlets/pulls/4/commits"},"statuses":{"href":"https://api.github.com/repos/clouway-incubator/servlets/statuses/31a221612ad7c73225349faa0d41b7ac8237addd"}}}}