{"action":"created","comment":{"url":"https://api.github.com/repos/linagora/james-project/pulls/comments/78326689","id":78326689,"diff_hunk":"@@ -0,0 +1,351 @@\n+/****************************************************************\n+ * Licensed to the Apache Software Foundation (ASF) under one   *\n+ * or more contributor license agreements.  See the NOTICE file *\n+ * distributed with this work for additional information        *\n+ * regarding copyright ownership.  The ASF licenses this file   *\n+ * to you under the Apache License, Version 2.0 (the            *\n+ * \"License\"); you may not use this file except in compliance   *\n+ * with the License.  You may obtain a copy of the License at   *\n+ *                                                              *\n+ *   http://www.apache.org/licenses/LICENSE-2.0                 *\n+ *                                                              *\n+ * Unless required by applicable law or agreed to in writing,   *\n+ * software distributed under the License is distributed on an  *\n+ * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *\n+ * KIND, either express or implied.  See the License for the    *\n+ * specific language governing permissions and limitations      *\n+ * under the License.                                           *\n+ ****************************************************************/\n+\n+package org.apache.james.transport.mailets;\n+\n+import static org.assertj.core.api.Assertions.assertThat;\n+import static org.mockito.Mockito.mock;\n+import static org.mockito.Mockito.when;\n+\n+import java.net.UnknownHostException;\n+import java.util.Properties;\n+\n+import javax.mail.MessagingException;\n+import javax.mail.Session;\n+import javax.mail.internet.MimeMessage;\n+\n+import org.apache.james.dnsservice.api.DNSService;\n+import org.apache.mailet.MailAddress;\n+import org.apache.mailet.base.test.FakeMail;\n+import org.apache.mailet.base.test.FakeMailContext;\n+import org.apache.mailet.base.test.FakeMailetConfig;\n+import org.junit.Before;\n+import org.junit.Rule;\n+import org.junit.Test;\n+import org.junit.rules.ExpectedException;\n+\n+public class RedirectTest {\n+\n+    private static final String MAILET_NAME = \"mailetName\";\n+\n+    @Rule\n+    public ExpectedException expectedException = ExpectedException.none();\n+\n+    private Redirect redirect;\n+    private FakeMailContext fakeMailContext;\n+    private MailAddress postmaster;\n+\n+    @Before\n+    public void setUp() throws Exception {\n+        redirect = new Redirect();\n+        DNSService dnsService = mock(DNSService.class);\n+        redirect.setDNSService(dnsService);\n+        postmaster = new MailAddress(\"postmaster@james.org\");\n+        fakeMailContext = FakeMailContext.builder()\n+                .postmaster(postmaster)\n+                .build();\n+\n+        when(dnsService.getLocalHost()).thenThrow(new UnknownHostException());\n+    }\n+\n+    @Test\n+    public void getMailetInfoShouldReturnValue() {\n+        assertThat(redirect.getMailetInfo()).isEqualTo(\"Redirect Mailet\");\n+    }\n+\n+    @Test\n+    public void initShouldThrowWhenUnkownParameter() throws Exception {\n+        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);\n+        mailetConfig.setProperty(\"unknown\", \"error\");\n+        expectedException.expect(MessagingException.class);\n+\n+        redirect.init(mailetConfig);\n+    }\n+\n+    @Test\n+    public void initShouldNotThrowWhenEveryParameters() throws Exception {\n+        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);\n+        mailetConfig.setProperty(\"static\", \"true\");\n+        mailetConfig.setProperty(\"debug\", \"true\");\n+        mailetConfig.setProperty(\"passThrough\", \"false\");\n+        mailetConfig.setProperty(\"fakeDomainCheck\", \"false\");\n+        mailetConfig.setProperty(\"inline\", \"true\");\n+        mailetConfig.setProperty(\"attachment\", \"true\");\n+        mailetConfig.setProperty(\"message\", \"mess\");\n+        mailetConfig.setProperty(\"recipients\", \"user@james.org, user2@james.org\");\n+        mailetConfig.setProperty(\"to\", \"to@james.org\");\n+        mailetConfig.setProperty(\"replyTo\", \"replyTo@james.org\");\n+        mailetConfig.setProperty(\"replyto\", \"replyto@james.org\");\n+        mailetConfig.setProperty(\"reversePath\", \"reverse@james.org\");\n+        mailetConfig.setProperty(\"sender\", \"sender@james.org\");\n+        mailetConfig.setProperty(\"subject\", \"subj\");\n+        mailetConfig.setProperty(\"prefix\", \"pref\");\n+        mailetConfig.setProperty(\"attachError\", \"true\");\n+        mailetConfig.setProperty(\"isReply\", \"true\");\n+\n+        redirect.init(mailetConfig);\n+    }\n+\n+    @Test\n+    public void initShouldReturnNullWhenNoRecipientsOrToToParameters() throws Exception {","path":"server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/RedirectTest.java","position":106,"original_position":106,"commit_id":"690d4266948159c04a4583702e95373cb11cbb3b","original_commit_id":"ea228053ec1a64039d68eb92ffd02dc126e7bb6b","user":{"login":"aduprat","id":2900528,"avatar_url":"https://avatars.githubusercontent.com/u/2900528?v=3","gravatar_id":"","url":"https://api.github.com/users/aduprat","html_url":"https://github.com/aduprat","followers_url":"https://api.github.com/users/aduprat/followers","following_url":"https://api.github.com/users/aduprat/following{/other_user}","gists_url":"https://api.github.com/users/aduprat/gists{/gist_id}","starred_url":"https://api.github.com/users/aduprat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aduprat/subscriptions","organizations_url":"https://api.github.com/users/aduprat/orgs","repos_url":"https://api.github.com/users/aduprat/repos","events_url":"https://api.github.com/users/aduprat/events{/privacy}","received_events_url":"https://api.github.com/users/aduprat/received_events","type":"User","site_admin":false},"body":"OK","created_at":"2016-09-12T07:45:39Z","updated_at":"2016-09-12T07:45:39Z","html_url":"https://github.com/linagora/james-project/pull/396#discussion_r78326689","pull_request_url":"https://api.github.com/repos/linagora/james-project/pulls/396","_links":{"self":{"href":"https://api.github.com/repos/linagora/james-project/pulls/comments/78326689"},"html":{"href":"https://github.com/linagora/james-project/pull/396#discussion_r78326689"},"pull_request":{"href":"https://api.github.com/repos/linagora/james-project/pulls/396"}}},"pull_request":{"url":"https://api.github.com/repos/linagora/james-project/pulls/396","id":84307379,"html_url":"https://github.com/linagora/james-project/pull/396","diff_url":"https://github.com/linagora/james-project/pull/396.diff","patch_url":"https://github.com/linagora/james-project/pull/396.patch","issue_url":"https://api.github.com/repos/linagora/james-project/issues/396","number":396,"state":"open","locked":false,"title":"MAILET-115 Ensure AbstractNotify/AbstractRedirect has a good coverage and meet new standards","user":{"login":"aduprat","id":2900528,"avatar_url":"https://avatars.githubusercontent.com/u/2900528?v=3","gravatar_id":"","url":"https://api.github.com/users/aduprat","html_url":"https://github.com/aduprat","followers_url":"https://api.github.com/users/aduprat/followers","following_url":"https://api.github.com/users/aduprat/following{/other_user}","gists_url":"https://api.github.com/users/aduprat/gists{/gist_id}","starred_url":"https://api.github.com/users/aduprat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aduprat/subscriptions","organizations_url":"https://api.github.com/users/aduprat/orgs","repos_url":"https://api.github.com/users/aduprat/repos","events_url":"https://api.github.com/users/aduprat/events{/privacy}","received_events_url":"https://api.github.com/users/aduprat/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-09-07T14:10:54Z","updated_at":"2016-09-12T07:45:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f494ee43836194b4447464dbea4620224f9bd589","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/linagora/james-project/pulls/396/commits","review_comments_url":"https://api.github.com/repos/linagora/james-project/pulls/396/comments","review_comment_url":"https://api.github.com/repos/linagora/james-project/pulls/comments{/number}","comments_url":"https://api.github.com/repos/linagora/james-project/issues/396/comments","statuses_url":"https://api.github.com/repos/linagora/james-project/statuses/690d4266948159c04a4583702e95373cb11cbb3b","head":{"label":"aduprat:MAILET-115","ref":"MAILET-115","sha":"690d4266948159c04a4583702e95373cb11cbb3b","user":{"login":"aduprat","id":2900528,"avatar_url":"https://avatars.githubusercontent.com/u/2900528?v=3","gravatar_id":"","url":"https://api.github.com/users/aduprat","html_url":"https://github.com/aduprat","followers_url":"https://api.github.com/users/aduprat/followers","following_url":"https://api.github.com/users/aduprat/following{/other_user}","gists_url":"https://api.github.com/users/aduprat/gists{/gist_id}","starred_url":"https://api.github.com/users/aduprat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aduprat/subscriptions","organizations_url":"https://api.github.com/users/aduprat/orgs","repos_url":"https://api.github.com/users/aduprat/repos","events_url":"https://api.github.com/users/aduprat/events{/privacy}","received_events_url":"https://api.github.com/users/aduprat/received_events","type":"User","site_admin":false},"repo":{"id":39448317,"name":"james-project","full_name":"aduprat/james-project","owner":{"login":"aduprat","id":2900528,"avatar_url":"https://avatars.githubusercontent.com/u/2900528?v=3","gravatar_id":"","url":"https://api.github.com/users/aduprat","html_url":"https://github.com/aduprat","followers_url":"https://api.github.com/users/aduprat/followers","following_url":"https://api.github.com/users/aduprat/following{/other_user}","gists_url":"https://api.github.com/users/aduprat/gists{/gist_id}","starred_url":"https://api.github.com/users/aduprat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aduprat/subscriptions","organizations_url":"https://api.github.com/users/aduprat/orgs","repos_url":"https://api.github.com/users/aduprat/repos","events_url":"https://api.github.com/users/aduprat/events{/privacy}","received_events_url":"https://api.github.com/users/aduprat/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/aduprat/james-project","description":"Mirror of Apache James Project","fork":true,"url":"https://api.github.com/repos/aduprat/james-project","forks_url":"https://api.github.com/repos/aduprat/james-project/forks","keys_url":"https://api.github.com/repos/aduprat/james-project/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aduprat/james-project/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aduprat/james-project/teams","hooks_url":"https://api.github.com/repos/aduprat/james-project/hooks","issue_events_url":"https://api.github.com/repos/aduprat/james-project/issues/events{/number}","events_url":"https://api.github.com/repos/aduprat/james-project/events","assignees_url":"https://api.github.com/repos/aduprat/james-project/assignees{/user}","branches_url":"https://api.github.com/repos/aduprat/james-project/branches{/branch}","tags_url":"https://api.github.com/repos/aduprat/james-project/tags","blobs_url":"https://api.github.com/repos/aduprat/james-project/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aduprat/james-project/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aduprat/james-project/git/refs{/sha}","trees_url":"https://api.github.com/repos/aduprat/james-project/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aduprat/james-project/statuses/{sha}","languages_url":"https://api.github.com/repos/aduprat/james-project/languages","stargazers_url":"https://api.github.com/repos/aduprat/james-project/stargazers","contributors_url":"https://api.github.com/repos/aduprat/james-project/contributors","subscribers_url":"https://api.github.com/repos/aduprat/james-project/subscribers","subscription_url":"https://api.github.com/repos/aduprat/james-project/subscription","commits_url":"https://api.github.com/repos/aduprat/james-project/commits{/sha}","git_commits_url":"https://api.github.com/repos/aduprat/james-project/git/commits{/sha}","comments_url":"https://api.github.com/repos/aduprat/james-project/comments{/number}","issue_comment_url":"https://api.github.com/repos/aduprat/james-project/issues/comments{/number}","contents_url":"https://api.github.com/repos/aduprat/james-project/contents/{+path}","compare_url":"https://api.github.com/repos/aduprat/james-project/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aduprat/james-project/merges","archive_url":"https://api.github.com/repos/aduprat/james-project/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aduprat/james-project/downloads","issues_url":"https://api.github.com/repos/aduprat/james-project/issues{/number}","pulls_url":"https://api.github.com/repos/aduprat/james-project/pulls{/number}","milestones_url":"https://api.github.com/repos/aduprat/james-project/milestones{/number}","notifications_url":"https://api.github.com/repos/aduprat/james-project/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aduprat/james-project/labels{/name}","releases_url":"https://api.github.com/repos/aduprat/james-project/releases{/id}","deployments_url":"https://api.github.com/repos/aduprat/james-project/deployments","created_at":"2015-07-21T13:55:14Z","updated_at":"2016-01-13T10:07:40Z","pushed_at":"2016-09-12T07:19:14Z","git_url":"git://github.com/aduprat/james-project.git","ssh_url":"git@github.com:aduprat/james-project.git","clone_url":"https://github.com/aduprat/james-project.git","svn_url":"https://github.com/aduprat/james-project","homepage":null,"size":14354,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"trunk"}},"base":{"label":"linagora:master","ref":"master","sha":"baae24e231edc543e61a9515eadb98f4bcb57dcb","user":{"login":"linagora","id":1230365,"avatar_url":"https://avatars.githubusercontent.com/u/1230365?v=3","gravatar_id":"","url":"https://api.github.com/users/linagora","html_url":"https://github.com/linagora","followers_url":"https://api.github.com/users/linagora/followers","following_url":"https://api.github.com/users/linagora/following{/other_user}","gists_url":"https://api.github.com/users/linagora/gists{/gist_id}","starred_url":"https://api.github.com/users/linagora/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/linagora/subscriptions","organizations_url":"https://api.github.com/users/linagora/orgs","repos_url":"https://api.github.com/users/linagora/repos","events_url":"https://api.github.com/users/linagora/events{/privacy}","received_events_url":"https://api.github.com/users/linagora/received_events","type":"Organization","site_admin":false},"repo":{"id":39182136,"name":"james-project","full_name":"linagora/james-project","owner":{"login":"linagora","id":1230365,"avatar_url":"https://avatars.githubusercontent.com/u/1230365?v=3","gravatar_id":"","url":"https://api.github.com/users/linagora","html_url":"https://github.com/linagora","followers_url":"https://api.github.com/users/linagora/followers","following_url":"https://api.github.com/users/linagora/following{/other_user}","gists_url":"https://api.github.com/users/linagora/gists{/gist_id}","starred_url":"https://api.github.com/users/linagora/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/linagora/subscriptions","organizations_url":"https://api.github.com/users/linagora/orgs","repos_url":"https://api.github.com/users/linagora/repos","events_url":"https://api.github.com/users/linagora/events{/privacy}","received_events_url":"https://api.github.com/users/linagora/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/linagora/james-project","description":"Mirror of Apache James Project","fork":true,"url":"https://api.github.com/repos/linagora/james-project","forks_url":"https://api.github.com/repos/linagora/james-project/forks","keys_url":"https://api.github.com/repos/linagora/james-project/keys{/key_id}","collaborators_url":"https://api.github.com/repos/linagora/james-project/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/linagora/james-project/teams","hooks_url":"https://api.github.com/repos/linagora/james-project/hooks","issue_events_url":"https://api.github.com/repos/linagora/james-project/issues/events{/number}","events_url":"https://api.github.com/repos/linagora/james-project/events","assignees_url":"https://api.github.com/repos/linagora/james-project/assignees{/user}","branches_url":"https://api.github.com/repos/linagora/james-project/branches{/branch}","tags_url":"https://api.github.com/repos/linagora/james-project/tags","blobs_url":"https://api.github.com/repos/linagora/james-project/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/linagora/james-project/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/linagora/james-project/git/refs{/sha}","trees_url":"https://api.github.com/repos/linagora/james-project/git/trees{/sha}","statuses_url":"https://api.github.com/repos/linagora/james-project/statuses/{sha}","languages_url":"https://api.github.com/repos/linagora/james-project/languages","stargazers_url":"https://api.github.com/repos/linagora/james-project/stargazers","contributors_url":"https://api.github.com/repos/linagora/james-project/contributors","subscribers_url":"https://api.github.com/repos/linagora/james-project/subscribers","subscription_url":"https://api.github.com/repos/linagora/james-project/subscription","commits_url":"https://api.github.com/repos/linagora/james-project/commits{/sha}","git_commits_url":"https://api.github.com/repos/linagora/james-project/git/commits{/sha}","comments_url":"https://api.github.com/repos/linagora/james-project/comments{/number}","issue_comment_url":"https://api.github.com/repos/linagora/james-project/issues/comments{/number}","contents_url":"https://api.github.com/repos/linagora/james-project/contents/{+path}","compare_url":"https://api.github.com/repos/linagora/james-project/compare/{base}...{head}","merges_url":"https://api.github.com/repos/linagora/james-project/merges","archive_url":"https://api.github.com/repos/linagora/james-project/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/linagora/james-project/downloads","issues_url":"https://api.github.com/repos/linagora/james-project/issues{/number}","pulls_url":"https://api.github.com/repos/linagora/james-project/pulls{/number}","milestones_url":"https://api.github.com/repos/linagora/james-project/milestones{/number}","notifications_url":"https://api.github.com/repos/linagora/james-project/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/linagora/james-project/labels{/name}","releases_url":"https://api.github.com/repos/linagora/james-project/releases{/id}","deployments_url":"https://api.github.com/repos/linagora/james-project/deployments","created_at":"2015-07-16T07:04:59Z","updated_at":"2016-07-01T17:37:20Z","pushed_at":"2016-09-12T02:17:55Z","git_url":"git://github.com/linagora/james-project.git","ssh_url":"git@github.com:linagora/james-project.git","clone_url":"https://github.com/linagora/james-project.git","svn_url":"https://github.com/linagora/james-project","homepage":null,"size":16203,"stargazers_count":5,"watchers_count":5,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":27,"forks":8,"open_issues":27,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/linagora/james-project/pulls/396"},"html":{"href":"https://github.com/linagora/james-project/pull/396"},"issue":{"href":"https://api.github.com/repos/linagora/james-project/issues/396"},"comments":{"href":"https://api.github.com/repos/linagora/james-project/issues/396/comments"},"review_comments":{"href":"https://api.github.com/repos/linagora/james-project/pulls/396/comments"},"review_comment":{"href":"https://api.github.com/repos/linagora/james-project/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/linagora/james-project/pulls/396/commits"},"statuses":{"href":"https://api.github.com/repos/linagora/james-project/statuses/690d4266948159c04a4583702e95373cb11cbb3b"}}}}
{"actor":{"display_login":"aduprat"}}