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 no...@apache.org on 2006/06/22 19:55:17 UTC

svn commit: r416433 - in /james/server/trunk/src/test/org/apache/james/transport/matchers: SMTPAuthSuccessfulTest.java SMTPAuthUserIsTest.java

Author: norman
Date: Thu Jun 22 10:55:17 2006
New Revision: 416433

URL: http://svn.apache.org/viewvc?rev=416433&view=rev
Log:
Add junit test for SMTPAuthUserIs matcher

Added:
    james/server/trunk/src/test/org/apache/james/transport/matchers/SMTPAuthUserIsTest.java
Modified:
    james/server/trunk/src/test/org/apache/james/transport/matchers/SMTPAuthSuccessfulTest.java

Modified: james/server/trunk/src/test/org/apache/james/transport/matchers/SMTPAuthSuccessfulTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/test/org/apache/james/transport/matchers/SMTPAuthSuccessfulTest.java?rev=416433&r1=416432&r2=416433&view=diff
==============================================================================
--- james/server/trunk/src/test/org/apache/james/transport/matchers/SMTPAuthSuccessfulTest.java (original)
+++ james/server/trunk/src/test/org/apache/james/transport/matchers/SMTPAuthSuccessfulTest.java Thu Jun 22 10:55:17 2006
@@ -31,8 +31,7 @@
         return new SMTPAuthSuccessful();
     }
 
-    protected String getConfigOption() {
-        
+    protected String getConfigOption() {   
         return "SMTPAuthSuccessful";
     }
     

Added: james/server/trunk/src/test/org/apache/james/transport/matchers/SMTPAuthUserIsTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/test/org/apache/james/transport/matchers/SMTPAuthUserIsTest.java?rev=416433&view=auto
==============================================================================
--- james/server/trunk/src/test/org/apache/james/transport/matchers/SMTPAuthUserIsTest.java (added)
+++ james/server/trunk/src/test/org/apache/james/transport/matchers/SMTPAuthUserIsTest.java Thu Jun 22 10:55:17 2006
@@ -0,0 +1,59 @@
+/***********************************************************************
+ * Copyright (c) 2006 The Apache Software Foundation.                  *
+ * All rights reserved.                                                *
+ * ------------------------------------------------------------------- *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you *
+ * may not use this file except in compliance with the License. You    *
+ * may obtain a copy of the License at:                                *
+ *                                                                     *
+ *     http://www.apache.org/licenses/LICENSE-2.0                      *
+ *                                                                     *
+ * Unless required by applicable law or agreed to in writing, software *
+ * distributed under the License is distributed on an "AS IS" BASIS,   *
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or     *
+ * implied.  See the License for the specific language governing       *
+ * permissions and limitations under the License.                      *
+ ***********************************************************************/
+
+package org.apache.james.transport.matchers;
+
+import java.util.Collection;
+
+import javax.mail.MessagingException;
+
+import org.apache.mailet.GenericMatcher;
+
+public class SMTPAuthUserIsTest extends AbstractHasMailAttributeTest {
+    
+    private final String SMTP_AUTH_USER_ATTRIBUTE_NAME = "org.apache.james.SMTPAuthUser";
+
+    protected String getHasMailAttribute() {
+        return "test@james.apache.org";
+    }
+
+    protected GenericMatcher createMatcher() {
+        return new SMTPAuthUserIs();
+    }
+
+    protected String getConfigOption() {   
+        return "SMTPAuthUserIs=";
+    }
+    
+    protected void init() {
+        super.init();
+        setMailAttributeName(SMTP_AUTH_USER_ATTRIBUTE_NAME);
+        setMailAttributeValue("test@james.apache.org");
+    }
+    
+    
+    // test if the mail attribute was not matched
+    public void testAttributeIsNotMatched() throws MessagingException {
+        setupAll();
+        setMailAttributeValue("notmatched@james.apache.org");
+
+        Collection matchedRecipients = matcher.match(mockedMail);
+
+        assertNull(matchedRecipients);
+    }
+
+}



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