JAMES-2268 Implicitly call FakeMailetContext.Builder::build
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/02f9631d Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/02f9631d Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/02f9631d Branch: refs/heads/master Commit: 02f9631de39df832b7305ea3e12f0906dc759fd3 Parents: 56b1ddc Author: benwa <btell...@linagora.com> Authored: Thu Dec 21 13:55:23 2017 +0700 Committer: benwa <btell...@linagora.com> Committed: Mon Dec 25 11:25:18 2017 +0700 ---------------------------------------------------------------------- .../org/apache/mailet/base/test/FakeMailetConfig.java | 4 ++++ .../transport/mailets/delivery/LocalDeliveryTest.java | 13 +++---------- 2 files changed, 7 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/james-project/blob/02f9631d/mailet/base/src/test/java/org/apache/mailet/base/test/FakeMailetConfig.java ---------------------------------------------------------------------- diff --git a/mailet/base/src/test/java/org/apache/mailet/base/test/FakeMailetConfig.java b/mailet/base/src/test/java/org/apache/mailet/base/test/FakeMailetConfig.java index f0598e5..d86f793 100644 --- a/mailet/base/src/test/java/org/apache/mailet/base/test/FakeMailetConfig.java +++ b/mailet/base/src/test/java/org/apache/mailet/base/test/FakeMailetConfig.java @@ -58,6 +58,10 @@ public class FakeMailetConfig implements MailetConfig { return this; } + public Builder mailetContext(FakeMailContext.Builder mailetContext) { + return mailetContext(mailetContext.build()); + } + public Builder setProperty(String key, String value) { this.properties.setProperty(key, value); return this; http://git-wip-us.apache.org/repos/asf/james-project/blob/02f9631d/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/LocalDeliveryTest.java ---------------------------------------------------------------------- diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/LocalDeliveryTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/LocalDeliveryTest.java index 8b59316..b9ac01d 100644 --- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/LocalDeliveryTest.java +++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/LocalDeliveryTest.java @@ -38,7 +38,6 @@ import org.apache.james.core.MailAddress; import org.apache.james.mailbox.MailboxManager; import org.apache.james.mailbox.MailboxSession; import org.apache.james.mailbox.MessageManager; -import org.apache.james.mailbox.exception.MailboxException; import org.apache.james.mailbox.model.MailboxPath; import org.apache.james.metrics.api.Metric; import org.apache.james.metrics.api.MetricFactory; @@ -53,8 +52,6 @@ import org.junit.Before; import org.junit.Test; import org.slf4j.Logger; -import com.google.common.base.Throwables; - public class LocalDeliveryTest { public static final String RECEIVER_DOMAIN_COM = "recei...@domain.com"; @@ -65,7 +62,7 @@ public class LocalDeliveryTest { private LocalDelivery testee; @Before - public void setUp() { + public void setUp() throws Exception { usersRepository = mock(UsersRepository.class); mailboxManager = mock(MailboxManager.class); @@ -76,16 +73,12 @@ public class LocalDeliveryTest { user = mock(MailboxSession.User.class); MailboxSession session = mock(MailboxSession.class); when(session.getPathDelimiter()).thenReturn('.'); - try { - when(mailboxManager.createSystemSession(any(String.class))).thenReturn(session); - } catch (MailboxException e) { - throw Throwables.propagate(e); - } + when(mailboxManager.createSystemSession(any(String.class))).thenReturn(session); when(session.getUser()).thenReturn(user); config = FakeMailetConfig.builder() .mailetName("Local delivery") - .mailetContext(FakeMailContext.builder().logger(mock(Logger.class)).build()) + .mailetContext(FakeMailContext.builder().logger(mock(Logger.class))) .build(); } --------------------------------------------------------------------- To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org