You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by bt...@apache.org on 2018/01/30 08:12:14 UTC

[03/16] james-project git commit: JAMES-2285 Rely on mocks to avoid test specific MailQueue implementation

JAMES-2285 Rely on mocks to avoid test specific MailQueue implementation


Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/48f089fa
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/48f089fa
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/48f089fa

Branch: refs/heads/master
Commit: 48f089faa07201c6da8ff1297ae80c5f2d80ade0
Parents: b0685f2
Author: benwa <bt...@linagora.com>
Authored: Sat Jan 20 08:44:48 2018 +0700
Committer: benwa <bt...@linagora.com>
Committed: Tue Jan 30 15:09:29 2018 +0700

----------------------------------------------------------------------
 .../library/AbstractMailQueueFactoryTest.java   | 55 ++------------------
 1 file changed, 3 insertions(+), 52 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/48f089fa/server/queue/queue-jms/src/test/java/org/apache/james/queue/library/AbstractMailQueueFactoryTest.java
----------------------------------------------------------------------
diff --git a/server/queue/queue-jms/src/test/java/org/apache/james/queue/library/AbstractMailQueueFactoryTest.java b/server/queue/queue-jms/src/test/java/org/apache/james/queue/library/AbstractMailQueueFactoryTest.java
index 77efab3..a0e312e 100644
--- a/server/queue/queue-jms/src/test/java/org/apache/james/queue/library/AbstractMailQueueFactoryTest.java
+++ b/server/queue/queue-jms/src/test/java/org/apache/james/queue/library/AbstractMailQueueFactoryTest.java
@@ -25,15 +25,12 @@ import static org.mockito.Mockito.doThrow;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.verify;
 
-import java.util.concurrent.TimeUnit;
-
 import javax.management.InstanceNotFoundException;
 import javax.management.MBeanServer;
 import javax.management.ObjectName;
 
 import org.apache.james.queue.api.MailQueue;
 import org.apache.james.queue.api.ManageableMailQueue;
-import org.apache.mailet.Mail;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -48,56 +45,10 @@ public class AbstractMailQueueFactoryTest {
     @Before
     public void setUp() {
         mBeanServer = mock(MBeanServer.class);
-        abstractMailQueueFactory = new AbstractMailQueueFactory<MailQueue>() {
+        abstractMailQueueFactory = new AbstractMailQueueFactory<ManageableMailQueue>() {
             @Override
-            protected MailQueue createMailQueue(String name) {
-                return new ManageableMailQueue() {
-
-                    @Override
-                    public String getName() {
-                        return "name";
-                    }
-
-                    @Override
-                    public void enQueue(Mail mail, long delay, TimeUnit unit) throws MailQueueException {
-
-                    }
-
-                    @Override
-                    public void enQueue(Mail mail) throws MailQueueException {
-
-                    }
-
-                    @Override
-                    public MailQueueItem deQueue() throws MailQueueException {
-                        return null;
-                    }
-
-                    @Override
-                    public long getSize() throws MailQueueException {
-                        return 0;
-                    }
-
-                    @Override
-                    public long flush() throws MailQueueException {
-                        return 0;
-                    }
-
-                    @Override
-                    public long clear() throws MailQueueException {
-                        return 0;
-                    }
-
-                    @Override
-                    public long remove(Type type, String value) throws MailQueueException {
-                        return 0;
-                    }
-
-                    @Override
-                    public MailQueueIterator browse() throws MailQueueException {
-                        return null;
-                    }
-                };
+            protected ManageableMailQueue createMailQueue(String name) {
+                return mock(ManageableMailQueue.class);
             }
         };
         abstractMailQueueFactory.setMbeanServer(mBeanServer);


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org