{"action":"created","comment":{"url":"https://api.github.com/repos/codingmentor/homeworks/pulls/comments/71339104","id":71339104,"diff_hunk":"@@ -0,0 +1,166 @@\n+package com.norbertschmelhaus.eehomework1.beans;\n+\n+import java.util.Calendar;\n+import java.util.Date;\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.AfterClass;\n+import org.junit.Before;\n+import org.junit.BeforeClass;\n+import org.junit.Test;\n+import org.junit.Assert;\n+\n+/**\n+ *\n+ * @author norbeee\n+ */\n+public class UserDTOTest {\n+\n+    private static ValidatorFactory vf;\n+    private static Validator validator;\n+    private static Calendar cal;\n+    private static Date now;\n+    private static Date dateOfBirthValid;\n+    private static Date dateOfBirthInvalid;\n+\n+    @BeforeClass\n+    public static void setUpClass() {\n+        vf = Validation.buildDefaultValidatorFactory();\n+        validator = vf.getValidator();\n+        cal = Calendar.getInstance();\n+    }\n+\n+    @AfterClass\n+    public static void close() {\n+        vf.close();\n+    }\n+\n+    @Before\n+    public void setUp() {\n+        now = new Date();\n+        cal.set(1995, 10, 10);\n+        dateOfBirthValid = cal.getTime();\n+        cal.set(2016, 10, 10);\n+        dateOfBirthInvalid = cal.getTime();\n+    }\n+\n+    @Test\n+    public void shouldRaiseConstraintViolationCauseValidPassword() {\n+        UserDTO user = new UserDTO(\"Janos45\", \"Ezajelszo>\", \"email@email.hu\", now);\n+        Set<ConstraintViolation<UserDTO>> violations = validator.validate(user);\n+        Assert.assertEquals(0, violations.size());\n+    }\n+\n+    @Test\n+    public void shouldRaiseConstraintViolationCauseInvalidPassword() {\n+        UserDTO user = new UserDTO(\"Janos45\", \"dummyPassword\", \"email@email.hu\", now);\n+        Set<ConstraintViolation<UserDTO>> violations = validator.validate(user);\n+        Assert.assertEquals(1, violations.size());\n+        Assert.assertEquals(\"invalid password, must have lowwercase,uppercase & number or scpec caracter and min size 6\",\n+                violations.iterator().next().getMessage());\n+        Assert.assertEquals(\"dummyPassword\", violations.iterator().next().getInvalidValue());\n+        Assert.assertEquals(\"{Password.message}\", violations.iterator().next().getMessageTemplate());\n+    }\n+\n+    @Test\n+    public void shouldRaiseConstraintViolationCauseValidAddress() {\n+        UserDTO user = new UserDTO(\"Janos45\", \"Valid541\", \"email@email.hu\", now);\n+        user.setAddress(\"8500 Valahol Jó utca 15.\");\n+        Set<ConstraintViolation<UserDTO>> violations = validator.validate(user);\n+        Assert.assertEquals(0, violations.size());\n+    }\n+\n+    @Test\n+    public void shouldRaiseConstraintViolationCauseInvalidAddress() {\n+        UserDTO user = new UserDTO(\"Janos45\", \"Valid541\", \"email@email.hu\", now);\n+        user.setAddress(\"dummyAddress\");\n+        Set<ConstraintViolation<UserDTO>> violations = validator.validate(user);\n+        Assert.assertEquals(1, violations.size());\n+        Assert.assertEquals(\"invalid address must be start with 4 numbers\",\n+                violations.iterator().next().getMessage());\n+        Assert.assertEquals(\"dummyAddress\", violations.iterator().next().getInvalidValue());\n+        Assert.assertEquals(\"{Address.message}\", violations.iterator().next().getMessageTemplate());\n+    }\n+\n+    @Test\n+    public void shouldRaiseConstraintViolationCauseValidPhone() {\n+        UserDTO user = new UserDTO(\"Janos45\", \"Valid541\", \"email@email.hu\", now);\n+        user.setPhone(\"+36123456789\");\n+        Set<ConstraintViolation<UserDTO>> violations = validator.validate(user);\n+        Assert.assertEquals(0, violations.size());\n+    }\n+\n+    @Test\n+    public void shouldRaiseConstraintViolationCauseInvalidPhone() {\n+        UserDTO user = new UserDTO(\"Janos45\", \"Valid541\", \"email@email.hu\", now);\n+        user.setPhone(\"061234567890\");\n+        Set<ConstraintViolation<UserDTO>> violations = validator.validate(user);\n+        Assert.assertEquals(1, violations.size());\n+        Assert.assertEquals(\"invalid phone number must be start with +36 or 06 and then 9 numbers\",\n+                violations.iterator().next().getMessage());\n+        Assert.assertEquals(\"061234567890\", violations.iterator().next().getInvalidValue());\n+        Assert.assertEquals(\"{Phone.message}\", violations.iterator().next().getMessageTemplate());\n+    }\n+\n+    @Test\n+    public void shouldRaiseConstraintViolationCauseValidEmail() {","path":"norbert.schmelhaus/1-hazi/EE-Homework1-Norbert-Schmlehaus/src/test/java/com/norbertschmelhaus/eehomework1/beans/UserDTOTest.java","position":109,"original_position":109,"commit_id":"3925628455831189f98b481b7d43b616581e1e94","original_commit_id":"3925628455831189f98b481b7d43b616581e1e94","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":"metódusnevet fogalmazd át :)","created_at":"2016-07-19T13:37:27Z","updated_at":"2016-07-19T13:37:27Z","html_url":"https://github.com/codingmentor/homeworks/pull/12#discussion_r71339104","pull_request_url":"https://api.github.com/repos/codingmentor/homeworks/pulls/12","_links":{"self":{"href":"https://api.github.com/repos/codingmentor/homeworks/pulls/comments/71339104"},"html":{"href":"https://github.com/codingmentor/homeworks/pull/12#discussion_r71339104"},"pull_request":{"href":"https://api.github.com/repos/codingmentor/homeworks/pulls/12"}}},"pull_request":{"url":"https://api.github.com/repos/codingmentor/homeworks/pulls/12","id":77972035,"html_url":"https://github.com/codingmentor/homeworks/pull/12","diff_url":"https://github.com/codingmentor/homeworks/pull/12.diff","patch_url":"https://github.com/codingmentor/homeworks/pull/12.patch","issue_url":"https://api.github.com/repos/codingmentor/homeworks/issues/12","number":12,"state":"open","locked":false,"title":"Add my first homework","user":{"login":"schnorbeee","id":20253897,"avatar_url":"https://avatars.githubusercontent.com/u/20253897?v=3","gravatar_id":"","url":"https://api.github.com/users/schnorbeee","html_url":"https://github.com/schnorbeee","followers_url":"https://api.github.com/users/schnorbeee/followers","following_url":"https://api.github.com/users/schnorbeee/following{/other_user}","gists_url":"https://api.github.com/users/schnorbeee/gists{/gist_id}","starred_url":"https://api.github.com/users/schnorbeee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schnorbeee/subscriptions","organizations_url":"https://api.github.com/users/schnorbeee/orgs","repos_url":"https://api.github.com/users/schnorbeee/repos","events_url":"https://api.github.com/users/schnorbeee/events{/privacy}","received_events_url":"https://api.github.com/users/schnorbeee/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-07-19T13:04:57Z","updated_at":"2016-07-19T13:37:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"83f5cc0e0be1e618047caeded49e6f5c77c7c587","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/codingmentor/homeworks/pulls/12/commits","review_comments_url":"https://api.github.com/repos/codingmentor/homeworks/pulls/12/comments","review_comment_url":"https://api.github.com/repos/codingmentor/homeworks/pulls/comments{/number}","comments_url":"https://api.github.com/repos/codingmentor/homeworks/issues/12/comments","statuses_url":"https://api.github.com/repos/codingmentor/homeworks/statuses/3925628455831189f98b481b7d43b616581e1e94","head":{"label":"schnorbeee:EE-1","ref":"EE-1","sha":"3925628455831189f98b481b7d43b616581e1e94","user":{"login":"schnorbeee","id":20253897,"avatar_url":"https://avatars.githubusercontent.com/u/20253897?v=3","gravatar_id":"","url":"https://api.github.com/users/schnorbeee","html_url":"https://github.com/schnorbeee","followers_url":"https://api.github.com/users/schnorbeee/followers","following_url":"https://api.github.com/users/schnorbeee/following{/other_user}","gists_url":"https://api.github.com/users/schnorbeee/gists{/gist_id}","starred_url":"https://api.github.com/users/schnorbeee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schnorbeee/subscriptions","organizations_url":"https://api.github.com/users/schnorbeee/orgs","repos_url":"https://api.github.com/users/schnorbeee/repos","events_url":"https://api.github.com/users/schnorbeee/events{/privacy}","received_events_url":"https://api.github.com/users/schnorbeee/received_events","type":"User","site_admin":false},"repo":{"id":63486514,"name":"homeworks","full_name":"schnorbeee/homeworks","owner":{"login":"schnorbeee","id":20253897,"avatar_url":"https://avatars.githubusercontent.com/u/20253897?v=3","gravatar_id":"","url":"https://api.github.com/users/schnorbeee","html_url":"https://github.com/schnorbeee","followers_url":"https://api.github.com/users/schnorbeee/followers","following_url":"https://api.github.com/users/schnorbeee/following{/other_user}","gists_url":"https://api.github.com/users/schnorbeee/gists{/gist_id}","starred_url":"https://api.github.com/users/schnorbeee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schnorbeee/subscriptions","organizations_url":"https://api.github.com/users/schnorbeee/orgs","repos_url":"https://api.github.com/users/schnorbeee/repos","events_url":"https://api.github.com/users/schnorbeee/events{/privacy}","received_events_url":"https://api.github.com/users/schnorbeee/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/schnorbeee/homeworks","description":"Homeworks of codingmentor training","fork":true,"url":"https://api.github.com/repos/schnorbeee/homeworks","forks_url":"https://api.github.com/repos/schnorbeee/homeworks/forks","keys_url":"https://api.github.com/repos/schnorbeee/homeworks/keys{/key_id}","collaborators_url":"https://api.github.com/repos/schnorbeee/homeworks/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/schnorbeee/homeworks/teams","hooks_url":"https://api.github.com/repos/schnorbeee/homeworks/hooks","issue_events_url":"https://api.github.com/repos/schnorbeee/homeworks/issues/events{/number}","events_url":"https://api.github.com/repos/schnorbeee/homeworks/events","assignees_url":"https://api.github.com/repos/schnorbeee/homeworks/assignees{/user}","branches_url":"https://api.github.com/repos/schnorbeee/homeworks/branches{/branch}","tags_url":"https://api.github.com/repos/schnorbeee/homeworks/tags","blobs_url":"https://api.github.com/repos/schnorbeee/homeworks/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/schnorbeee/homeworks/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/schnorbeee/homeworks/git/refs{/sha}","trees_url":"https://api.github.com/repos/schnorbeee/homeworks/git/trees{/sha}","statuses_url":"https://api.github.com/repos/schnorbeee/homeworks/statuses/{sha}","languages_url":"https://api.github.com/repos/schnorbeee/homeworks/languages","stargazers_url":"https://api.github.com/repos/schnorbeee/homeworks/stargazers","contributors_url":"https://api.github.com/repos/schnorbeee/homeworks/contributors","subscribers_url":"https://api.github.com/repos/schnorbeee/homeworks/subscribers","subscription_url":"https://api.github.com/repos/schnorbeee/homeworks/subscription","commits_url":"https://api.github.com/repos/schnorbeee/homeworks/commits{/sha}","git_commits_url":"https://api.github.com/repos/schnorbeee/homeworks/git/commits{/sha}","comments_url":"https://api.github.com/repos/schnorbeee/homeworks/comments{/number}","issue_comment_url":"https://api.github.com/repos/schnorbeee/homeworks/issues/comments{/number}","contents_url":"https://api.github.com/repos/schnorbeee/homeworks/contents/{+path}","compare_url":"https://api.github.com/repos/schnorbeee/homeworks/compare/{base}...{head}","merges_url":"https://api.github.com/repos/schnorbeee/homeworks/merges","archive_url":"https://api.github.com/repos/schnorbeee/homeworks/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/schnorbeee/homeworks/downloads","issues_url":"https://api.github.com/repos/schnorbeee/homeworks/issues{/number}","pulls_url":"https://api.github.com/repos/schnorbeee/homeworks/pulls{/number}","milestones_url":"https://api.github.com/repos/schnorbeee/homeworks/milestones{/number}","notifications_url":"https://api.github.com/repos/schnorbeee/homeworks/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/schnorbeee/homeworks/labels{/name}","releases_url":"https://api.github.com/repos/schnorbeee/homeworks/releases{/id}","deployments_url":"https://api.github.com/repos/schnorbeee/homeworks/deployments","created_at":"2016-07-16T14:26:27Z","updated_at":"2016-07-16T14:00:02Z","pushed_at":"2016-07-19T13:00:59Z","git_url":"git://github.com/schnorbeee/homeworks.git","ssh_url":"git@github.com:schnorbeee/homeworks.git","clone_url":"https://github.com/schnorbeee/homeworks.git","svn_url":"https://github.com/schnorbeee/homeworks","homepage":null,"size":0,"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:norbert.schmelhaus","ref":"norbert.schmelhaus","sha":"046245d3dfcc32035b8d4d13406439d42120587d","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":63485226,"name":"homeworks","full_name":"codingmentor/homeworks","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/homeworks","description":"Homeworks of codingmentor training","fork":false,"url":"https://api.github.com/repos/codingmentor/homeworks","forks_url":"https://api.github.com/repos/codingmentor/homeworks/forks","keys_url":"https://api.github.com/repos/codingmentor/homeworks/keys{/key_id}","collaborators_url":"https://api.github.com/repos/codingmentor/homeworks/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/codingmentor/homeworks/teams","hooks_url":"https://api.github.com/repos/codingmentor/homeworks/hooks","issue_events_url":"https://api.github.com/repos/codingmentor/homeworks/issues/events{/number}","events_url":"https://api.github.com/repos/codingmentor/homeworks/events","assignees_url":"https://api.github.com/repos/codingmentor/homeworks/assignees{/user}","branches_url":"https://api.github.com/repos/codingmentor/homeworks/branches{/branch}","tags_url":"https://api.github.com/repos/codingmentor/homeworks/tags","blobs_url":"https://api.github.com/repos/codingmentor/homeworks/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/codingmentor/homeworks/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/codingmentor/homeworks/git/refs{/sha}","trees_url":"https://api.github.com/repos/codingmentor/homeworks/git/trees{/sha}","statuses_url":"https://api.github.com/repos/codingmentor/homeworks/statuses/{sha}","languages_url":"https://api.github.com/repos/codingmentor/homeworks/languages","stargazers_url":"https://api.github.com/repos/codingmentor/homeworks/stargazers","contributors_url":"https://api.github.com/repos/codingmentor/homeworks/contributors","subscribers_url":"https://api.github.com/repos/codingmentor/homeworks/subscribers","subscription_url":"https://api.github.com/repos/codingmentor/homeworks/subscription","commits_url":"https://api.github.com/repos/codingmentor/homeworks/commits{/sha}","git_commits_url":"https://api.github.com/repos/codingmentor/homeworks/git/commits{/sha}","comments_url":"https://api.github.com/repos/codingmentor/homeworks/comments{/number}","issue_comment_url":"https://api.github.com/repos/codingmentor/homeworks/issues/comments{/number}","contents_url":"https://api.github.com/repos/codingmentor/homeworks/contents/{+path}","compare_url":"https://api.github.com/repos/codingmentor/homeworks/compare/{base}...{head}","merges_url":"https://api.github.com/repos/codingmentor/homeworks/merges","archive_url":"https://api.github.com/repos/codingmentor/homeworks/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/codingmentor/homeworks/downloads","issues_url":"https://api.github.com/repos/codingmentor/homeworks/issues{/number}","pulls_url":"https://api.github.com/repos/codingmentor/homeworks/pulls{/number}","milestones_url":"https://api.github.com/repos/codingmentor/homeworks/milestones{/number}","notifications_url":"https://api.github.com/repos/codingmentor/homeworks/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/codingmentor/homeworks/labels{/name}","releases_url":"https://api.github.com/repos/codingmentor/homeworks/releases{/id}","deployments_url":"https://api.github.com/repos/codingmentor/homeworks/deployments","created_at":"2016-07-16T13:54:09Z","updated_at":"2016-07-16T14:00:02Z","pushed_at":"2016-07-19T13:04:57Z","git_url":"git://github.com/codingmentor/homeworks.git","ssh_url":"git@github.com:codingmentor/homeworks.git","clone_url":"https://github.com/codingmentor/homeworks.git","svn_url":"https://github.com/codingmentor/homeworks","homepage":null,"size":8,"stargazers_count":1,"watchers_count":1,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":12,"mirror_url":null,"open_issues_count":1,"forks":12,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/codingmentor/homeworks/pulls/12"},"html":{"href":"https://github.com/codingmentor/homeworks/pull/12"},"issue":{"href":"https://api.github.com/repos/codingmentor/homeworks/issues/12"},"comments":{"href":"https://api.github.com/repos/codingmentor/homeworks/issues/12/comments"},"review_comments":{"href":"https://api.github.com/repos/codingmentor/homeworks/pulls/12/comments"},"review_comment":{"href":"https://api.github.com/repos/codingmentor/homeworks/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/codingmentor/homeworks/pulls/12/commits"},"statuses":{"href":"https://api.github.com/repos/codingmentor/homeworks/statuses/3925628455831189f98b481b7d43b616581e1e94"}}}}
{"actor":{"display_login":"deneslaszlo"}}