james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nor...@apache.org
Subject svn commit: r416218 - in /james/server/trunk/src/test/org/apache/james/transport/matchers: AbstractHasMailAttributeTest.java HasMailAttributeTest.java HasMailAttributeWithValueRegexTest.java HasMailAttributeWithValueTest.java
Date Thu, 22 Jun 2006 02:19:11 GMT
Author: norman
Date: Wed Jun 21 19:19:10 2006
New Revision: 416218

URL: http://svn.apache.org/viewvc?rev=416218&view=rev
Log:
-Add more generic code to the abstract class. 
-Code cleanup

Modified:
    james/server/trunk/src/test/org/apache/james/transport/matchers/AbstractHasMailAttributeTest.java
    james/server/trunk/src/test/org/apache/james/transport/matchers/HasMailAttributeTest.java
    james/server/trunk/src/test/org/apache/james/transport/matchers/HasMailAttributeWithValueRegexTest.java
    james/server/trunk/src/test/org/apache/james/transport/matchers/HasMailAttributeWithValueTest.java

Modified: james/server/trunk/src/test/org/apache/james/transport/matchers/AbstractHasMailAttributeTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/test/org/apache/james/transport/matchers/AbstractHasMailAttributeTest.java?rev=416218&r1=416217&r2=416218&view=diff
==============================================================================
--- james/server/trunk/src/test/org/apache/james/transport/matchers/AbstractHasMailAttributeTest.java
(original)
+++ james/server/trunk/src/test/org/apache/james/transport/matchers/AbstractHasMailAttributeTest.java
Wed Jun 21 19:19:10 2006
@@ -15,7 +15,6 @@
  * permissions and limitations under the License.                      *
  ***********************************************************************/
 
-
 package org.apache.james.transport.matchers;
 
 import java.io.Serializable;
@@ -36,11 +35,17 @@
 
 public abstract class AbstractHasMailAttributeTest extends TestCase {
     protected MimeMessage mockedMimeMessage;
+
     protected MockMail mockedMail;
+
     protected Matcher matcher;
+
     protected final String MAIL_ATTRIBUTE_NAME = "org.apache.james.test.junit";
+
     protected final String MAIL_ATTRIBUTE_VALUE = "true";
+
     protected String mailAttributeName = "org.apache.james";
+
     protected String mailAttributeValue = "false";
 
     public AbstractHasMailAttributeTest() {
@@ -68,9 +73,8 @@
 
     protected void setupMatcher() throws MessagingException {
         matcher = createMatcher();
-        MockMatcherConfig mci = new MockMatcherConfig("HasMailAttribute="
-                + getHasMailAttribute(),
-                new MockMailContext());
+        MockMatcherConfig mci = new MockMatcherConfig(getConfigOption()
+                + getHasMailAttribute(), new MockMailContext());
         matcher.init(mci);
     }
 
@@ -109,4 +113,6 @@
     protected abstract String getHasMailAttribute();
 
     protected abstract Matcher createMatcher();
+
+    protected abstract String getConfigOption();
 }

Modified: james/server/trunk/src/test/org/apache/james/transport/matchers/HasMailAttributeTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/test/org/apache/james/transport/matchers/HasMailAttributeTest.java?rev=416218&r1=416217&r2=416218&view=diff
==============================================================================
--- james/server/trunk/src/test/org/apache/james/transport/matchers/HasMailAttributeTest.java
(original)
+++ james/server/trunk/src/test/org/apache/james/transport/matchers/HasMailAttributeTest.java
Wed Jun 21 19:19:10 2006
@@ -17,31 +17,24 @@
 
 package org.apache.james.transport.matchers;
 
-import org.apache.james.test.mock.mailet.MockMailContext;
-import org.apache.james.test.mock.mailet.MockMatcherConfig;
 import org.apache.mailet.Matcher;
 
-import javax.mail.MessagingException;
-
 public class HasMailAttributeTest extends AbstractHasMailAttributeTest {
 
     public HasMailAttributeTest() {
         super();
     }
 
-    protected void setupMatcher() throws MessagingException {
-        matcher = createMatcher();
-        MockMatcherConfig mci = new MockMatcherConfig("HasMailAttribute="
-                + getHasMailAttribute(), new MockMailContext());
-        matcher.init(mci);
-    }
-
     protected Matcher createMatcher() {
         return new HasMailAttribute();
     }
 
     protected String getHasMailAttribute() {
         return MAIL_ATTRIBUTE_NAME;
+    }
+
+    protected String getConfigOption() {
+        return "HasMailAttribute=";
     }
 
 }

Modified: james/server/trunk/src/test/org/apache/james/transport/matchers/HasMailAttributeWithValueRegexTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/test/org/apache/james/transport/matchers/HasMailAttributeWithValueRegexTest.java?rev=416218&r1=416217&r2=416218&view=diff
==============================================================================
--- james/server/trunk/src/test/org/apache/james/transport/matchers/HasMailAttributeWithValueRegexTest.java
(original)
+++ james/server/trunk/src/test/org/apache/james/transport/matchers/HasMailAttributeWithValueRegexTest.java
Wed Jun 21 19:19:10 2006
@@ -22,7 +22,8 @@
 import javax.mail.MessagingException;
 import java.util.Collection;
 
-public class HasMailAttributeWithValueRegexTest extends AbstractHasMailAttributeTest {
+public class HasMailAttributeWithValueRegexTest extends
+        AbstractHasMailAttributeTest {
 
     private String regex = ".*";
 
@@ -42,7 +43,7 @@
         return new HasMailAttributeWithValueRegex();
     }
 
-// test if the mail attribute was matched
+    // test if the mail attribute was matched
     public void testAttributeIsMatched() throws MessagingException {
         init();
         setRegex(".*");
@@ -86,5 +87,9 @@
         assertNull(matchedRecipients);
         assertEquals(regexException, exception);
 
+    }
+
+    protected String getConfigOption() {
+        return "HasMailAttributeWithValueRegex=";
     }
 }

Modified: james/server/trunk/src/test/org/apache/james/transport/matchers/HasMailAttributeWithValueTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/test/org/apache/james/transport/matchers/HasMailAttributeWithValueTest.java?rev=416218&r1=416217&r2=416218&view=diff
==============================================================================
--- james/server/trunk/src/test/org/apache/james/transport/matchers/HasMailAttributeWithValueTest.java
(original)
+++ james/server/trunk/src/test/org/apache/james/transport/matchers/HasMailAttributeWithValueTest.java
Wed Jun 21 19:19:10 2006
@@ -46,4 +46,8 @@
 
         assertNull(matchedRecipients);
     }
+
+    protected String getConfigOption() {
+        return "HasMailAttributeWithValue=";
+    }
 }



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


Mime
View raw message