james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r797000 - /james/jsieve/trunk/main/src/test/java/org/apache/jsieve/RejectTest.java
Date Thu, 23 Jul 2009 10:17:46 GMT
Author: rdonkin
Date: Thu Jul 23 10:17:46 2009
New Revision: 797000

URL: http://svn.apache.org/viewvc?rev=797000&view=rev
Log:
Improve test coverage

Modified:
    james/jsieve/trunk/main/src/test/java/org/apache/jsieve/RejectTest.java

Modified: james/jsieve/trunk/main/src/test/java/org/apache/jsieve/RejectTest.java
URL: http://svn.apache.org/viewvc/james/jsieve/trunk/main/src/test/java/org/apache/jsieve/RejectTest.java?rev=797000&r1=796999&r2=797000&view=diff
==============================================================================
--- james/jsieve/trunk/main/src/test/java/org/apache/jsieve/RejectTest.java (original)
+++ james/jsieve/trunk/main/src/test/java/org/apache/jsieve/RejectTest.java Thu Jul 23 10:17:46
2009
@@ -88,6 +88,26 @@
     }
 
     /**
+     * Tests that the message is correctly passed
+     */
+    public void testRejectMessage() throws Exception {
+        String message = "Spam not consumed here!";
+        String script = "reject \"" + message + "\";";
+        ActionReject rejection = runRejectScript(script);        
+        assertEquals(message, rejection.getMessage());
+    }
+
+    private ActionReject runRejectScript(String script) throws SieveException, ParseException
{
+        MailAdapter mail = JUnitUtils.createMail();
+        JUnitUtils.interpret(mail, script);
+        assertTrue(mail.getActions().size() == 1);
+        Object action = mail.getActions().get(0);
+        assertTrue(action instanceof ActionReject);
+        ActionReject rejection = (ActionReject) action;
+        return rejection;
+    }
+    
+    /**
      * Test for Command 'reject'
      */
     public void testRejectMissingMessage() {



---------------------------------------------------------------------
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