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 ba...@apache.org on 2008/08/21 20:22:50 UTC

svn commit: r687821 - in /james/server/trunk/mailets-function/src/test/java/org/apache/james/transport/matchers: HasMailAttributeWithValueRegexTest.java RecipientIsRegexTest.java

Author: bago
Date: Thu Aug 21 11:22:50 2008
New Revision: 687821

URL: http://svn.apache.org/viewvc?rev=687821&view=rev
Log:
Fix junit tests in case the project is built/run against java5+ (regexp exception is a bit different)

Modified:
    james/server/trunk/mailets-function/src/test/java/org/apache/james/transport/matchers/HasMailAttributeWithValueRegexTest.java
    james/server/trunk/mailets-function/src/test/java/org/apache/james/transport/matchers/RecipientIsRegexTest.java

Modified: james/server/trunk/mailets-function/src/test/java/org/apache/james/transport/matchers/HasMailAttributeWithValueRegexTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailets-function/src/test/java/org/apache/james/transport/matchers/HasMailAttributeWithValueRegexTest.java?rev=687821&r1=687820&r2=687821&view=diff
==============================================================================
--- james/server/trunk/mailets-function/src/test/java/org/apache/james/transport/matchers/HasMailAttributeWithValueRegexTest.java (original)
+++ james/server/trunk/mailets-function/src/test/java/org/apache/james/transport/matchers/HasMailAttributeWithValueRegexTest.java Thu Aug 21 11:22:50 2008
@@ -25,6 +25,8 @@
 import javax.mail.MessagingException;
 import java.util.Collection;
 
+import junit.framework.AssertionFailedError;
+
 public class HasMailAttributeWithValueRegexTest extends
         AbstractHasMailAttributeTest {
 
@@ -74,8 +76,6 @@
 
         String invalidRegex = "(!(";
         String regexException = null;
-        // NOTE the expected exception changes when the project is built/run
-        // against non java 1.4 jvm. 
         String exception = "Malformed pattern: " + invalidRegex;
 
         setRegex(invalidRegex);
@@ -90,8 +90,14 @@
         Collection matchedRecipients = matcher.match(mockedMail);
 
         assertNull(matchedRecipients);
-        assertEquals(regexException, exception);
-
+        
+        try {
+            assertEquals(exception, regexException);
+        } catch (AssertionFailedError e) {
+            // NOTE the expected exception changes when the project is built/run
+            // against non java 1.4 jvm. 
+            assertEquals(exception+" (org.apache.oro.text.regex.MalformedPatternException: Unmatched parentheses.", regexException);
+        }
     }
 
     protected String getConfigOption() {

Modified: james/server/trunk/mailets-function/src/test/java/org/apache/james/transport/matchers/RecipientIsRegexTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailets-function/src/test/java/org/apache/james/transport/matchers/RecipientIsRegexTest.java?rev=687821&r1=687820&r2=687821&view=diff
==============================================================================
--- james/server/trunk/mailets-function/src/test/java/org/apache/james/transport/matchers/RecipientIsRegexTest.java (original)
+++ james/server/trunk/mailets-function/src/test/java/org/apache/james/transport/matchers/RecipientIsRegexTest.java Thu Aug 21 11:22:50 2008
@@ -25,6 +25,8 @@
 
 import javax.mail.MessagingException;
 
+import junit.framework.AssertionFailedError;
+
 import org.apache.mailet.MailAddress;
 import org.apache.mailet.Matcher;
 
@@ -90,8 +92,6 @@
         Collection matchedRecipients = null;
         String invalidRegex = "(!(";
         String regexException = null;
-        // NOTE the expected exception changes when the project is built/run
-        // against non java 1.4 jvm. 
         String exception = "Malformed pattern: " + invalidRegex;
 
         setRecipients(new MailAddress[] {
@@ -107,7 +107,13 @@
         }
 
         assertNull(matchedRecipients);
-        assertEquals(regexException, exception);
+        try {
+            assertEquals(exception, regexException);
+        } catch (AssertionFailedError e) {
+            // NOTE the expected exception changes when the project is built/run
+            // against non java 1.4 jvm. 
+            assertEquals(exception+" (org.apache.oro.text.regex.MalformedPatternException: Unmatched parentheses.", regexException);
+        }
 
     }
 



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