{"action":"created","comment":{"url":"https://api.github.com/repos/codingmentor/homework/pulls/comments/59964754","id":59964754,"diff_hunk":"@@ -0,0 +1,93 @@\n+package test;\n+\n+import hu.codingmentor.dto.UserDTO;\n+import java.util.Set;\n+import javax.validation.ConstraintViolation;\n+import javax.validation.Validation;\n+import javax.validation.Validator;\n+import javax.validation.ValidatorFactory;\n+import org.junit.Assert;\n+import org.junit.Test;\n+\n+public class UserTest {\n+\n+    @Test\n+    public void shouldNotRaiseException() {\n+        UserDTO user = new UserDTO(\"TestUsername\", \"Pdsad5=\", \"TestFirst\", \"TestLast\", \"1995-11-12\", \"2013-12-12\");\n+        ValidatorFactory vf = Validation.buildDefaultValidatorFactory();\n+        Validator validatior = vf.getValidator();\n+        vf.close();\n+        Set<ConstraintViolation<UserDTO>> violations = validatior.validate(user);\n+        Assert.assertEquals(0, violations.size());\n+    }\n+\n+    @Test\n+    public void shouldRaiseExceptionNullUsername() {\n+        UserDTO user = new UserDTO(null, \"Pdsad5=\", \"TestFirst\", \"TestLast\", \"1995-11-12\", \"2013-12-12\");\n+        ValidatorFactory vf = Validation.buildDefaultValidatorFactory();\n+        Validator validatior = vf.getValidator();\n+        vf.close();\n+        Set<ConstraintViolation<UserDTO>> violations = validatior.validate(user);\n+        Assert.assertEquals(1, violations.size());\n+    }\n+\n+    @Test\n+    public void shouldRaiseExceptionShortUsername() {\n+        UserDTO user = new UserDTO(\"ab\", \"Pdsad5=\", \"TestFirst\", \"TestLast\", \"1995-11-12\", \"2013-12-12\");\n+        ValidatorFactory vf = Validation.buildDefaultValidatorFactory();\n+        Validator validatior = vf.getValidator();\n+        vf.close();\n+        Set<ConstraintViolation<UserDTO>> violations = validatior.validate(user);\n+        Assert.assertEquals(1, violations.size());\n+    }\n+\n+    @Test\n+    public void shouldNotRaiseExceptionBadPassword() {\n+        UserDTO user = new UserDTO(\"TestUsername\", \"password\", \"TestFirst\", \"TestLast\", \"1995-11-12\", \"2013-12-12\");\n+        ValidatorFactory vf = Validation.buildDefaultValidatorFactory();\n+        Validator validatior = vf.getValidator();\n+        vf.close();\n+        Set<ConstraintViolation<UserDTO>> violations = validatior.validate(user);\n+        Assert.assertEquals(3, violations.size());\n+    }\n+\n+    @Test\n+    public void shouldNotRaiseExceptionNullPassword() {\n+        UserDTO user = new UserDTO(\"TestUsername\", null, \"TestFirst\", \"TestLast\", \"1995-11-12\", \"2013-12-12\");\n+        ValidatorFactory vf = Validation.buildDefaultValidatorFactory();\n+        Validator validatior = vf.getValidator();\n+        vf.close();\n+        Set<ConstraintViolation<UserDTO>> violations = validatior.validate(user);\n+        Assert.assertEquals(1, violations.size());\n+    }\n+\n+    @Test\n+    public void shouldRaiseExceptionNullFirstName() {\n+        UserDTO user = new UserDTO(\"TestUsername\", \"Pdsad5=\", null, \"TestLast\", \"1995-11-12\", \"2013-12-12\");\n+        ValidatorFactory vf = Validation.buildDefaultValidatorFactory();\n+        Validator validatior = vf.getValidator();\n+        vf.close();\n+        Set<ConstraintViolation<UserDTO>> violations = validatior.validate(user);\n+        Assert.assertEquals(1, violations.size());\n+    }\n+\n+    @Test\n+    public void shouldNotRaiseExceptionNullLastName() {\n+        UserDTO user = new UserDTO(\"TestUsername\", \"Pdsad5=\", \"TestFirst\", null, \"1995-11-12\", \"2013-12-12\");\n+        ValidatorFactory vf = Validation.buildDefaultValidatorFactory();\n+        Validator validatior = vf.getValidator();\n+        vf.close();\n+        Set<ConstraintViolation<UserDTO>> violations = validatior.validate(user);\n+        Assert.assertEquals(1, violations.size());","path":"homework_webshop/WebShop/WebShop-ejb/src/test/java/test/UserTest.java","position":31,"original_position":81,"commit_id":"818462ba00a24de055d75b3a579b8f8d8777cf12","original_commit_id":"818462ba00a24de055d75b3a579b8f8d8777cf12","user":{"login":"deneslaszlo","id":16327999,"avatar_url":"https://avatars.githubusercontent.com/u/16327999?v=3","gravatar_id":"","url":"https://api.github.com/users/deneslaszlo","html_url":"https://github.com/deneslaszlo","followers_url":"https://api.github.com/users/deneslaszlo/followers","following_url":"https://api.github.com/users/deneslaszlo/following{/other_user}","gists_url":"https://api.github.com/users/deneslaszlo/gists{/gist_id}","starred_url":"https://api.github.com/users/deneslaszlo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deneslaszlo/subscriptions","organizations_url":"https://api.github.com/users/deneslaszlo/orgs","repos_url":"https://api.github.com/users/deneslaszlo/repos","events_url":"https://api.github.com/users/deneslaszlo/events{/privacy}","received_events_url":"https://api.github.com/users/deneslaszlo/received_events","type":"User","site_admin":false},"body":"nem elég leellenőrizni, hogy 1 violation keletkezett, meg kell győződni róla, hogy az tényleg az a violation, amire számítottál","created_at":"2016-04-16T08:47:23Z","updated_at":"2016-04-16T08:47:23Z","html_url":"https://github.com/codingmentor/homework/pull/67#discussion_r59964754","pull_request_url":"https://api.github.com/repos/codingmentor/homework/pulls/67","_links":{"self":{"href":"https://api.github.com/repos/codingmentor/homework/pulls/comments/59964754"},"html":{"href":"https://github.com/codingmentor/homework/pull/67#discussion_r59964754"},"pull_request":{"href":"https://api.github.com/repos/codingmentor/homework/pulls/67"}}},"pull_request":{"url":"https://api.github.com/repos/codingmentor/homework/pulls/67","id":66696045,"html_url":"https://github.com/codingmentor/homework/pull/67","diff_url":"https://github.com/codingmentor/homework/pull/67.diff","patch_url":"https://github.com/codingmentor/homework/pull/67.patch","issue_url":"https://api.github.com/repos/codingmentor/homework/issues/67","number":67,"state":"open","locked":false,"title":"Peter.torma","user":{"login":"petertorma","id":17648362,"avatar_url":"https://avatars.githubusercontent.com/u/17648362?v=3","gravatar_id":"","url":"https://api.github.com/users/petertorma","html_url":"https://github.com/petertorma","followers_url":"https://api.github.com/users/petertorma/followers","following_url":"https://api.github.com/users/petertorma/following{/other_user}","gists_url":"https://api.github.com/users/petertorma/gists{/gist_id}","starred_url":"https://api.github.com/users/petertorma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/petertorma/subscriptions","organizations_url":"https://api.github.com/users/petertorma/orgs","repos_url":"https://api.github.com/users/petertorma/repos","events_url":"https://api.github.com/users/petertorma/events{/privacy}","received_events_url":"https://api.github.com/users/petertorma/received_events","type":"User","site_admin":false},"body":"homework: \r\n-async call\r\n-webshop\r\n-database","created_at":"2016-04-15T19:55:21Z","updated_at":"2016-04-16T08:47:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cd2944ccf1b873c023f03a61b99356ad233f162c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/codingmentor/homework/pulls/67/commits","review_comments_url":"https://api.github.com/repos/codingmentor/homework/pulls/67/comments","review_comment_url":"https://api.github.com/repos/codingmentor/homework/pulls/comments{/number}","comments_url":"https://api.github.com/repos/codingmentor/homework/issues/67/comments","statuses_url":"https://api.github.com/repos/codingmentor/homework/statuses/818462ba00a24de055d75b3a579b8f8d8777cf12","head":{"label":"petertorma:peter.torma","ref":"peter.torma","sha":"818462ba00a24de055d75b3a579b8f8d8777cf12","user":{"login":"petertorma","id":17648362,"avatar_url":"https://avatars.githubusercontent.com/u/17648362?v=3","gravatar_id":"","url":"https://api.github.com/users/petertorma","html_url":"https://github.com/petertorma","followers_url":"https://api.github.com/users/petertorma/followers","following_url":"https://api.github.com/users/petertorma/following{/other_user}","gists_url":"https://api.github.com/users/petertorma/gists{/gist_id}","starred_url":"https://api.github.com/users/petertorma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/petertorma/subscriptions","organizations_url":"https://api.github.com/users/petertorma/orgs","repos_url":"https://api.github.com/users/petertorma/repos","events_url":"https://api.github.com/users/petertorma/events{/privacy}","received_events_url":"https://api.github.com/users/petertorma/received_events","type":"User","site_admin":false},"repo":{"id":54324636,"name":"homework","full_name":"petertorma/homework","owner":{"login":"petertorma","id":17648362,"avatar_url":"https://avatars.githubusercontent.com/u/17648362?v=3","gravatar_id":"","url":"https://api.github.com/users/petertorma","html_url":"https://github.com/petertorma","followers_url":"https://api.github.com/users/petertorma/followers","following_url":"https://api.github.com/users/petertorma/following{/other_user}","gists_url":"https://api.github.com/users/petertorma/gists{/gist_id}","starred_url":"https://api.github.com/users/petertorma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/petertorma/subscriptions","organizations_url":"https://api.github.com/users/petertorma/orgs","repos_url":"https://api.github.com/users/petertorma/repos","events_url":"https://api.github.com/users/petertorma/events{/privacy}","received_events_url":"https://api.github.com/users/petertorma/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/petertorma/homework","description":"","fork":true,"url":"https://api.github.com/repos/petertorma/homework","forks_url":"https://api.github.com/repos/petertorma/homework/forks","keys_url":"https://api.github.com/repos/petertorma/homework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/petertorma/homework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/petertorma/homework/teams","hooks_url":"https://api.github.com/repos/petertorma/homework/hooks","issue_events_url":"https://api.github.com/repos/petertorma/homework/issues/events{/number}","events_url":"https://api.github.com/repos/petertorma/homework/events","assignees_url":"https://api.github.com/repos/petertorma/homework/assignees{/user}","branches_url":"https://api.github.com/repos/petertorma/homework/branches{/branch}","tags_url":"https://api.github.com/repos/petertorma/homework/tags","blobs_url":"https://api.github.com/repos/petertorma/homework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/petertorma/homework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/petertorma/homework/git/refs{/sha}","trees_url":"https://api.github.com/repos/petertorma/homework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/petertorma/homework/statuses/{sha}","languages_url":"https://api.github.com/repos/petertorma/homework/languages","stargazers_url":"https://api.github.com/repos/petertorma/homework/stargazers","contributors_url":"https://api.github.com/repos/petertorma/homework/contributors","subscribers_url":"https://api.github.com/repos/petertorma/homework/subscribers","subscription_url":"https://api.github.com/repos/petertorma/homework/subscription","commits_url":"https://api.github.com/repos/petertorma/homework/commits{/sha}","git_commits_url":"https://api.github.com/repos/petertorma/homework/git/commits{/sha}","comments_url":"https://api.github.com/repos/petertorma/homework/comments{/number}","issue_comment_url":"https://api.github.com/repos/petertorma/homework/issues/comments{/number}","contents_url":"https://api.github.com/repos/petertorma/homework/contents/{+path}","compare_url":"https://api.github.com/repos/petertorma/homework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/petertorma/homework/merges","archive_url":"https://api.github.com/repos/petertorma/homework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/petertorma/homework/downloads","issues_url":"https://api.github.com/repos/petertorma/homework/issues{/number}","pulls_url":"https://api.github.com/repos/petertorma/homework/pulls{/number}","milestones_url":"https://api.github.com/repos/petertorma/homework/milestones{/number}","notifications_url":"https://api.github.com/repos/petertorma/homework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/petertorma/homework/labels{/name}","releases_url":"https://api.github.com/repos/petertorma/homework/releases{/id}","deployments_url":"https://api.github.com/repos/petertorma/homework/deployments","created_at":"2016-03-20T15:18:55Z","updated_at":"2016-03-20T15:18:07Z","pushed_at":"2016-04-16T00:09:45Z","git_url":"git://github.com/petertorma/homework.git","ssh_url":"git@github.com:petertorma/homework.git","clone_url":"https://github.com/petertorma/homework.git","svn_url":"https://github.com/petertorma/homework","homepage":null,"size":2817,"stargazers_count":0,"watchers_count":0,"language":null,"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":"codingmentor:peter.torma","ref":"peter.torma","sha":"32cd664ce761f97aa56ba558bb20b4cee3face3d","user":{"login":"codingmentor","id":17640460,"avatar_url":"https://avatars.githubusercontent.com/u/17640460?v=3","gravatar_id":"","url":"https://api.github.com/users/codingmentor","html_url":"https://github.com/codingmentor","followers_url":"https://api.github.com/users/codingmentor/followers","following_url":"https://api.github.com/users/codingmentor/following{/other_user}","gists_url":"https://api.github.com/users/codingmentor/gists{/gist_id}","starred_url":"https://api.github.com/users/codingmentor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codingmentor/subscriptions","organizations_url":"https://api.github.com/users/codingmentor/orgs","repos_url":"https://api.github.com/users/codingmentor/repos","events_url":"https://api.github.com/users/codingmentor/events{/privacy}","received_events_url":"https://api.github.com/users/codingmentor/received_events","type":"Organization","site_admin":false},"repo":{"id":54324567,"name":"homework","full_name":"codingmentor/homework","owner":{"login":"codingmentor","id":17640460,"avatar_url":"https://avatars.githubusercontent.com/u/17640460?v=3","gravatar_id":"","url":"https://api.github.com/users/codingmentor","html_url":"https://github.com/codingmentor","followers_url":"https://api.github.com/users/codingmentor/followers","following_url":"https://api.github.com/users/codingmentor/following{/other_user}","gists_url":"https://api.github.com/users/codingmentor/gists{/gist_id}","starred_url":"https://api.github.com/users/codingmentor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codingmentor/subscriptions","organizations_url":"https://api.github.com/users/codingmentor/orgs","repos_url":"https://api.github.com/users/codingmentor/repos","events_url":"https://api.github.com/users/codingmentor/events{/privacy}","received_events_url":"https://api.github.com/users/codingmentor/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/codingmentor/homework","description":"","fork":false,"url":"https://api.github.com/repos/codingmentor/homework","forks_url":"https://api.github.com/repos/codingmentor/homework/forks","keys_url":"https://api.github.com/repos/codingmentor/homework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/codingmentor/homework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/codingmentor/homework/teams","hooks_url":"https://api.github.com/repos/codingmentor/homework/hooks","issue_events_url":"https://api.github.com/repos/codingmentor/homework/issues/events{/number}","events_url":"https://api.github.com/repos/codingmentor/homework/events","assignees_url":"https://api.github.com/repos/codingmentor/homework/assignees{/user}","branches_url":"https://api.github.com/repos/codingmentor/homework/branches{/branch}","tags_url":"https://api.github.com/repos/codingmentor/homework/tags","blobs_url":"https://api.github.com/repos/codingmentor/homework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/codingmentor/homework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/codingmentor/homework/git/refs{/sha}","trees_url":"https://api.github.com/repos/codingmentor/homework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/codingmentor/homework/statuses/{sha}","languages_url":"https://api.github.com/repos/codingmentor/homework/languages","stargazers_url":"https://api.github.com/repos/codingmentor/homework/stargazers","contributors_url":"https://api.github.com/repos/codingmentor/homework/contributors","subscribers_url":"https://api.github.com/repos/codingmentor/homework/subscribers","subscription_url":"https://api.github.com/repos/codingmentor/homework/subscription","commits_url":"https://api.github.com/repos/codingmentor/homework/commits{/sha}","git_commits_url":"https://api.github.com/repos/codingmentor/homework/git/commits{/sha}","comments_url":"https://api.github.com/repos/codingmentor/homework/comments{/number}","issue_comment_url":"https://api.github.com/repos/codingmentor/homework/issues/comments{/number}","contents_url":"https://api.github.com/repos/codingmentor/homework/contents/{+path}","compare_url":"https://api.github.com/repos/codingmentor/homework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/codingmentor/homework/merges","archive_url":"https://api.github.com/repos/codingmentor/homework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/codingmentor/homework/downloads","issues_url":"https://api.github.com/repos/codingmentor/homework/issues{/number}","pulls_url":"https://api.github.com/repos/codingmentor/homework/pulls{/number}","milestones_url":"https://api.github.com/repos/codingmentor/homework/milestones{/number}","notifications_url":"https://api.github.com/repos/codingmentor/homework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/codingmentor/homework/labels{/name}","releases_url":"https://api.github.com/repos/codingmentor/homework/releases{/id}","deployments_url":"https://api.github.com/repos/codingmentor/homework/deployments","created_at":"2016-03-20T15:18:07Z","updated_at":"2016-04-13T21:05:43Z","pushed_at":"2016-04-16T08:05:29Z","git_url":"git://github.com/codingmentor/homework.git","ssh_url":"git@github.com:codingmentor/homework.git","clone_url":"https://github.com/codingmentor/homework.git","svn_url":"https://github.com/codingmentor/homework","homepage":null,"size":12278,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":13,"mirror_url":null,"open_issues_count":7,"forks":13,"open_issues":7,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/codingmentor/homework/pulls/67"},"html":{"href":"https://github.com/codingmentor/homework/pull/67"},"issue":{"href":"https://api.github.com/repos/codingmentor/homework/issues/67"},"comments":{"href":"https://api.github.com/repos/codingmentor/homework/issues/67/comments"},"review_comments":{"href":"https://api.github.com/repos/codingmentor/homework/pulls/67/comments"},"review_comment":{"href":"https://api.github.com/repos/codingmentor/homework/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/codingmentor/homework/pulls/67/commits"},"statuses":{"href":"https://api.github.com/repos/codingmentor/homework/statuses/818462ba00a24de055d75b3a579b8f8d8777cf12"}}}}