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 2007/09/21 11:22:32 UTC
svn commit: r578031 [1/4] - in
/james/jsieve/trunk/src/test/java/org/apache/jsieve: javaxmail/ junit/
parser/address/ samples/james/junit/ util/check/
Author: bago
Date: Fri Sep 21 02:22:30 2007
New Revision: 578031
URL: http://svn.apache.org/viewvc?rev=578031&view=rev
Log:
Test sources reformatted (JSIEVE-17)
Modified:
james/jsieve/trunk/src/test/java/org/apache/jsieve/javaxmail/MockMimeMessage.java
james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/AddressParseTest.java
james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/AddressTest.java
james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/AllOfTest.java
james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/AllTests.java
james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/AnyOfTest.java
james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/BodyTest.java
james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/ConditionTest.java
james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/ConfigurationManagerTest.java
james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/DiscardTest.java
james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/EnvelopeTest.java
james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/ExistsTest.java
james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/FalseTest.java
james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/FileIntoTest.java
james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/HeaderTest.java
james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/KeepTest.java
james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/LogTest.java
james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/MultipleRequireTest.java
james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/MultipleToTest.java
james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/NotTest.java
james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/OpenedAddress.java
james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/RejectTest.java
james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/RequireTest.java
james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/SizeTest.java
james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/StopTest.java
james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/TrueTest.java
james/jsieve/trunk/src/test/java/org/apache/jsieve/parser/address/SieveAddressBuilderTest.java
james/jsieve/trunk/src/test/java/org/apache/jsieve/samples/james/junit/ActionDispatcherTest.java
james/jsieve/trunk/src/test/java/org/apache/jsieve/samples/james/junit/AllTests.java
james/jsieve/trunk/src/test/java/org/apache/jsieve/util/check/ScriptCheckMailAdapterActionsTest.java
james/jsieve/trunk/src/test/java/org/apache/jsieve/util/check/ScriptCheckMailAdapterHeadersTest.java
james/jsieve/trunk/src/test/java/org/apache/jsieve/util/check/ScriptCheckMailAdapterMailTest.java
james/jsieve/trunk/src/test/java/org/apache/jsieve/util/check/ScriptCheckMailAdapterNoMessageSetTest.java
james/jsieve/trunk/src/test/java/org/apache/jsieve/util/check/ScriptCheckerTestActionsTest.java
Modified: james/jsieve/trunk/src/test/java/org/apache/jsieve/javaxmail/MockMimeMessage.java
URL: http://svn.apache.org/viewvc/james/jsieve/trunk/src/test/java/org/apache/jsieve/javaxmail/MockMimeMessage.java?rev=578031&r1=578030&r2=578031&view=diff
==============================================================================
--- james/jsieve/trunk/src/test/java/org/apache/jsieve/javaxmail/MockMimeMessage.java (original)
+++ james/jsieve/trunk/src/test/java/org/apache/jsieve/javaxmail/MockMimeMessage.java Fri Sep 21 02:22:30 2007
@@ -17,8 +17,6 @@
* under the License. *
****************************************************************/
-
-
package org.apache.jsieve.javaxmail;
import javax.mail.internet.MimeMessage;
@@ -40,30 +38,47 @@
public class MockMimeMessage extends MimeMessage {
private final List m_fromAddresses = new ArrayList();
+
private Address m_senderAddress;
+
private final List m_toRecepients = new ArrayList();
+
private final List m_ccRecepients = new ArrayList();
+
private final List m_bccRecepients = new ArrayList();
+
private final List m_replyToAddresses = new ArrayList();
+
private String m_subject;
+
private int m_iMessageNumber;
+
private boolean m_bIsExpunged;
+
private Object m_content;
+
private Date m_sentDate;
+
private String[] m_contentLanguage;
+
private String m_fileName;
+
private DataHandler m_dataHandler;
+
private HashMap m_contentHeaders = new HashMap();
+
private Flags m_setFlags = new Flags();
+
private boolean m_doMatch;
+
private int m_size = -1;
public MockMimeMessage() throws MessagingException {
- super((Session)null);
+ super((Session) null);
}
public MockMimeMessage(int messageNumber) throws MessagingException {
- super((Session)null);
+ super((Session) null);
m_iMessageNumber = messageNumber;
}
@@ -72,7 +87,7 @@
}
public Address[] getFrom() throws MessagingException {
- return (Address[])m_fromAddresses.toArray();
+ return (Address[]) m_fromAddresses.toArray();
}
public void setFrom(Address address) throws MessagingException {
@@ -97,23 +112,27 @@
m_senderAddress = address;
}
- public Address[] getRecipients(Message.RecipientType recipientType) throws MessagingException {
+ public Address[] getRecipients(Message.RecipientType recipientType)
+ throws MessagingException {
List recipientsList = getRecipientsList(recipientType);
List recipientAddresses = new ArrayList();
for (Iterator iterator = recipientsList.iterator(); iterator.hasNext();) {
String recipient = (String) iterator.next();
recipientAddresses.add(new InternetAddress(recipient));
}
- return (Address[]) (recipientAddresses.toArray(new Address[]{}));
+ return (Address[]) (recipientAddresses.toArray(new Address[] {}));
}
private List getRecipientsList(Message.RecipientType recipientType) {
- if (Message.RecipientType.TO.equals(recipientType)) return m_toRecepients;
- if (Message.RecipientType.CC.equals(recipientType)) return m_ccRecepients;
- if (Message.RecipientType.BCC.equals(recipientType)) return m_bccRecepients;
+ if (Message.RecipientType.TO.equals(recipientType))
+ return m_toRecepients;
+ if (Message.RecipientType.CC.equals(recipientType))
+ return m_ccRecepients;
+ if (Message.RecipientType.BCC.equals(recipientType))
+ return m_bccRecepients;
return null;
}
-
+
public Address[] getAllRecipients() throws MessagingException {
List allRecipients = new ArrayList();
allRecipients.addAll(m_toRecepients);
@@ -122,19 +141,23 @@
return (Address[]) allRecipients.toArray();
}
- public void setRecipients(Message.RecipientType recipientType, Address[] addresses) throws MessagingException {
+ public void setRecipients(Message.RecipientType recipientType,
+ Address[] addresses) throws MessagingException {
getRecipientsList(recipientType).addAll(Arrays.asList(addresses));
}
- public void setRecipients(Message.RecipientType recipientType, String recipient) throws MessagingException {
+ public void setRecipients(Message.RecipientType recipientType,
+ String recipient) throws MessagingException {
getRecipientsList(recipientType).add(recipient);
}
- public void addRecipients(Message.RecipientType recipientType, Address[] addresses) throws MessagingException {
+ public void addRecipients(Message.RecipientType recipientType,
+ Address[] addresses) throws MessagingException {
getRecipientsList(recipientType).addAll(Arrays.asList(addresses));
}
- public void addRecipients(Message.RecipientType recipientType, String recipient) throws MessagingException {
+ public void addRecipients(Message.RecipientType recipientType,
+ String recipient) throws MessagingException {
getRecipientsList(recipientType).add(recipient);
}
@@ -154,9 +177,9 @@
m_subject = subject;
}
- public void setSubject(String subject, String charset) throws MessagingException {
- if (subject == null)
- {
+ public void setSubject(String subject, String charset)
+ throws MessagingException {
+ if (subject == null) {
m_subject = null;
return;
}
@@ -180,7 +203,7 @@
}
public int getSize() throws MessagingException {
- return m_size ; // trivial implementation
+ return m_size; // trivial implementation
}
public int getLineCount() throws MessagingException {
@@ -227,11 +250,12 @@
return getHeader("Content-Description", null);
}
- public void setDescription(String description) throws MessagingException {
+ public void setDescription(String description) throws MessagingException {
setHeader("Content-Description", description);
}
- public void setDescription(String description, String charset) throws MessagingException {
+ public void setDescription(String description, String charset)
+ throws MessagingException {
try {
setDescription(new String(description.getBytes(charset)));
} catch (UnsupportedEncodingException e) {
@@ -243,7 +267,8 @@
return m_contentLanguage;
}
- public void setContentLanguage(String[] contentLanguage) throws MessagingException {
+ public void setContentLanguage(String[] contentLanguage)
+ throws MessagingException {
m_contentLanguage = contentLanguage;
}
@@ -278,7 +303,8 @@
return m_dataHandler;
}
- public synchronized void setDataHandler(DataHandler dataHandler) throws MessagingException {
+ public synchronized void setDataHandler(DataHandler dataHandler)
+ throws MessagingException {
m_dataHandler = dataHandler;
}
@@ -286,17 +312,19 @@
return m_content;
}
- public void setContent(Object object, String mimeType) throws MessagingException {
- m_content = object; // trivial implementation
+ public void setContent(Object object, String mimeType)
+ throws MessagingException {
+ m_content = object; // trivial implementation
}
public void setText(String string) throws MessagingException {
setContent(string, "text/plain");
}
- public void setText(String string, String charset) throws MessagingException {
+ public void setText(String string, String charset)
+ throws MessagingException {
try {
- setContent(new String(string.getBytes(charset)) , "text/plain");
+ setContent(new String(string.getBytes(charset)), "text/plain");
} catch (UnsupportedEncodingException e) {
throw new MessagingException("setting text content failed", e);
}
@@ -310,29 +338,34 @@
return new MockMimeMessage(this); // trivial implementation
}
- public void writeTo(OutputStream outputStream) throws IOException, MessagingException {
+ public void writeTo(OutputStream outputStream) throws IOException,
+ MessagingException {
; // trivial implementation
}
- public void writeTo(OutputStream outputStream, String[] strings) throws IOException, MessagingException {
+ public void writeTo(OutputStream outputStream, String[] strings)
+ throws IOException, MessagingException {
; // trivial implementation
}
public String[] getHeader(String name) throws MessagingException {
Object value = m_contentHeaders.get(name);
- if (value == null) return null;
+ if (value == null)
+ return null;
if (value instanceof String) {
String stringValue = (String) value;
- return new String[] {stringValue};
+ return new String[] { stringValue };
} else {
Collection values = (Collection) value;
return (String[]) values.toArray(new String[values.size()]);
}
}
- public String getHeader(String name, String delimiter) throws MessagingException {
+ public String getHeader(String name, String delimiter)
+ throws MessagingException {
String[] header = getHeader(name);
- if (header == null || header.length == 0) return null;
+ if (header == null || header.length == 0)
+ return null;
return header[0];
}
@@ -345,8 +378,7 @@
Object existingValue = m_contentHeaders.get(name);
if (existingValue == null) {
newValue = value;
- }
- else if (existingValue instanceof String) {
+ } else if (existingValue instanceof String) {
List values = new ArrayList();
values.add(existingValue);
values.add(value);
@@ -374,7 +406,8 @@
// ignore
} else if (value instanceof Collection) {
Collection values = (Collection) value;
- for (Iterator iterValues = values.iterator();iterValues.hasNext();) {
+ for (Iterator iterValues = values.iterator(); iterValues
+ .hasNext();) {
String stringValue = (String) iterValues.next();
results.add(new Header(name, stringValue));
}
@@ -385,38 +418,46 @@
return Collections.enumeration(results);
}
- public Enumeration getMatchingHeaders(String[] names) throws MessagingException {
+ public Enumeration getMatchingHeaders(String[] names)
+ throws MessagingException {
ArrayList matchingHeaders = new ArrayList();
for (int i = 0; i < names.length; i++) {
String name = names[i];
String value = getHeader(name, null);
- if (value == null) continue;
+ if (value == null)
+ continue;
matchingHeaders.add(value);
}
- return Collections.enumeration(matchingHeaders);
+ return Collections.enumeration(matchingHeaders);
}
- public Enumeration getNonMatchingHeaders(String[] names) throws MessagingException {
+ public Enumeration getNonMatchingHeaders(String[] names)
+ throws MessagingException {
List existingHeaders = Arrays.asList(names);
ArrayList nonMatchingHeaders = new ArrayList();
-
+
Iterator iterator = m_contentHeaders.keySet().iterator();
while (iterator.hasNext()) {
String name = (String) iterator.next();
- if (existingHeaders.contains(name)) continue;
+ if (existingHeaders.contains(name))
+ continue;
String value = getHeader(name, null);
- if (value == null) continue;
+ if (value == null)
+ continue;
nonMatchingHeaders.add(value);
}
- return Collections.enumeration(nonMatchingHeaders);
+ return Collections.enumeration(nonMatchingHeaders);
}
public void addHeaderLine(String headerLine) throws MessagingException {
int separatorIndex = headerLine.indexOf(":");
- if (separatorIndex < 0) throw new MessagingException("header line does not conform to standard");
-
- addHeader(headerLine.substring(0,separatorIndex), headerLine.substring(separatorIndex,headerLine.length()));
+ if (separatorIndex < 0)
+ throw new MessagingException(
+ "header line does not conform to standard");
+
+ addHeader(headerLine.substring(0, separatorIndex), headerLine
+ .substring(separatorIndex, headerLine.length()));
}
public Enumeration getAllHeaderLines() throws MessagingException {
@@ -434,44 +475,53 @@
return headerLines;
}
- public Enumeration getMatchingHeaderLines(String[] names) throws MessagingException {
+ public Enumeration getMatchingHeaderLines(String[] names)
+ throws MessagingException {
ArrayList matchingHeaders = new ArrayList();
for (int i = 0; i < names.length; i++) {
String name = names[i];
String value = getHeader(name, null);
- if (value == null) continue;
+ if (value == null)
+ continue;
matchingHeaders.add(name + ":" + value);
}
- return Collections.enumeration(matchingHeaders);
+ return Collections.enumeration(matchingHeaders);
}
- public Enumeration getNonMatchingHeaderLines(String[] names) throws MessagingException {
+ public Enumeration getNonMatchingHeaderLines(String[] names)
+ throws MessagingException {
List existingHeaders = names != null ? Arrays.asList(names) : null;
ArrayList nonMatchingHeaders = new ArrayList();
-
+
Iterator iterator = m_contentHeaders.keySet().iterator();
while (iterator.hasNext()) {
String name = (String) iterator.next();
- if (existingHeaders!=null && existingHeaders.contains(name)) continue;
+ if (existingHeaders != null && existingHeaders.contains(name))
+ continue;
String value = getHeader(name, null);
- if (value == null) continue;
+ if (value == null)
+ continue;
nonMatchingHeaders.add(name + ":" + value);
}
- return Collections.enumeration(nonMatchingHeaders);
+ return Collections.enumeration(nonMatchingHeaders);
}
public synchronized Flags getFlags() throws MessagingException {
return new Flags(m_setFlags);
}
- public synchronized boolean isSet(Flags.Flag flag) throws MessagingException {
+ public synchronized boolean isSet(Flags.Flag flag)
+ throws MessagingException {
return m_setFlags.contains(flag);
}
- public synchronized void setFlags(Flags flags, boolean set) throws MessagingException {
- if (set) m_setFlags.add(flags);
- else m_setFlags.remove(flags);
+ public synchronized void setFlags(Flags flags, boolean set)
+ throws MessagingException {
+ if (set)
+ m_setFlags.add(flags);
+ else
+ m_setFlags.remove(flags);
}
public void saveChanges() throws MessagingException {
@@ -479,24 +529,29 @@
}
protected void updateHeaders() throws MessagingException {
- ; // trivial implementation
+ ; // trivial implementation
}
- protected InternetHeaders createInternetHeaders(InputStream inputStream) throws MessagingException {
+ protected InternetHeaders createInternetHeaders(InputStream inputStream)
+ throws MessagingException {
return new InternetHeaders();
}
- public void setRecipient(Message.RecipientType recipientType, Address address) throws MessagingException {
- setRecipients(recipientType, new Address[]{address});
+ public void setRecipient(Message.RecipientType recipientType,
+ Address address) throws MessagingException {
+ setRecipients(recipientType, new Address[] { address });
}
- public void addRecipient(Message.RecipientType recipientType, Address address) throws MessagingException {
- setRecipients(recipientType, new Address[]{address});
+ public void addRecipient(Message.RecipientType recipientType,
+ Address address) throws MessagingException {
+ setRecipients(recipientType, new Address[] { address });
}
public void setFlag(Flags.Flag flag, boolean set) throws MessagingException {
- if (set) m_setFlags.add(flag);
- else m_setFlags.remove(flag);
+ if (set)
+ m_setFlags.add(flag);
+ else
+ m_setFlags.remove(flag);
}
public int getMessageNumber() {
@@ -522,11 +577,11 @@
public void setShouldMatch(boolean doMatch) {
m_doMatch = doMatch;
}
-
+
public boolean match(SearchTerm searchTerm) throws MessagingException {
- return m_doMatch;
+ return m_doMatch;
}
-
+
public void setSize(int size) {
this.m_size = size;
}
Modified: james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/AddressParseTest.java
URL: http://svn.apache.org/viewvc/james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/AddressParseTest.java?rev=578031&r1=578030&r2=578031&view=diff
==============================================================================
--- james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/AddressParseTest.java (original)
+++ james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/AddressParseTest.java Fri Sep 21 02:22:30 2007
@@ -25,16 +25,15 @@
import org.apache.jsieve.junit.utils.SieveMailAdapter;
public class AddressParseTest extends TestCase {
-
- private static final String MULTIPLE_ADDRESS_VALUES =
- "coyote@desert.example.org, bugs@example.org, elmer@hunters.example.org";
-
- private static final String SOLO_ADDRESS_VALUES =
- "coyote@desert.example.org";
-
+
+ private static final String MULTIPLE_ADDRESS_VALUES = "coyote@desert.example.org, bugs@example.org, elmer@hunters.example.org";
+
+ private static final String SOLO_ADDRESS_VALUES = "coyote@desert.example.org";
+
SieveMailAdapter mail;
+
OpenedAddress address;
-
+
protected void setUp() throws Exception {
super.setUp();
mail = (SieveMailAdapter) JUnitUtils.createMail();
@@ -43,17 +42,25 @@
public void testSingleAddress() throws Exception {
mail.getMessage().addHeader("From", SOLO_ADDRESS_VALUES);
- assertTrue(address.match(mail, ":all", "i;ascii-casemap", ":is", "from", "coyote@desert.example.org"));
- assertFalse(address.match(mail, ":all", "i;ascii-casemap", ":is", "from","elmer@hunters.example.org"));
- assertFalse(address.match(mail, ":all", "i;ascii-casemap", ":is", "from", "bugs@example.org"));
- assertFalse(address.match(mail, ":all", "i;ascii-casemap", ":is", "from", "roadrunner@example.org"));
+ assertTrue(address.match(mail, ":all", "i;ascii-casemap", ":is",
+ "from", "coyote@desert.example.org"));
+ assertFalse(address.match(mail, ":all", "i;ascii-casemap", ":is",
+ "from", "elmer@hunters.example.org"));
+ assertFalse(address.match(mail, ":all", "i;ascii-casemap", ":is",
+ "from", "bugs@example.org"));
+ assertFalse(address.match(mail, ":all", "i;ascii-casemap", ":is",
+ "from", "roadrunner@example.org"));
}
public void testMultipleAddresses() throws Exception {
mail.getMessage().addHeader("From", MULTIPLE_ADDRESS_VALUES);
- assertTrue(address.match(mail, ":all", "i;ascii-casemap", ":is", "from", "coyote@desert.example.org"));
- assertTrue(address.match(mail, ":all", "i;ascii-casemap", ":is", "from","elmer@hunters.example.org"));
- assertTrue(address.match(mail, ":all", "i;ascii-casemap", ":is", "from", "bugs@example.org"));
- assertFalse(address.match(mail, ":all", "i;ascii-casemap", ":is", "from", "roadrunner@example.org"));
+ assertTrue(address.match(mail, ":all", "i;ascii-casemap", ":is",
+ "from", "coyote@desert.example.org"));
+ assertTrue(address.match(mail, ":all", "i;ascii-casemap", ":is",
+ "from", "elmer@hunters.example.org"));
+ assertTrue(address.match(mail, ":all", "i;ascii-casemap", ":is",
+ "from", "bugs@example.org"));
+ assertFalse(address.match(mail, ":all", "i;ascii-casemap", ":is",
+ "from", "roadrunner@example.org"));
}
}
Modified: james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/AddressTest.java
URL: http://svn.apache.org/viewvc/james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/AddressTest.java?rev=578031&r1=578030&r2=578031&view=diff
==============================================================================
--- james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/AddressTest.java (original)
+++ james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/AddressTest.java Fri Sep 21 02:22:30 2007
@@ -17,7 +17,6 @@
* under the License. *
****************************************************************/
-
package org.apache.jsieve.junit;
import javax.mail.MessagingException;
@@ -35,917 +34,613 @@
/**
* Class AddressTest
*/
-public class AddressTest extends TestCase
-{
+public class AddressTest extends TestCase {
/**
* Constructor for AddressTest.
+ *
* @param arg0
*/
- public AddressTest(String arg0)
- {
+ public AddressTest(String arg0) {
super(arg0);
}
- public static void main(String[] args)
- {
+ public static void main(String[] args) {
junit.swingui.TestRunner.run(AddressTest.class);
}
/**
* @see TestCase#setUp()
*/
- protected void setUp() throws Exception
- {
+ protected void setUp() throws Exception {
super.setUp();
CommandManager.resetInstance();
- TestManager.resetInstance();
- }
+ TestManager.resetInstance();
+ }
/**
* @see TestCase#tearDown()
*/
- protected void tearDown() throws Exception
- {
+ protected void tearDown() throws Exception {
super.tearDown();
}
-
+
/**
* Test for Test 'address'
*/
- public void testIfAddressAllIsTrue()
- {
+ public void testIfAddressAllIsTrue() {
boolean isTestPassed = false;
String script = "if address :all :is \"From\" \"user@domain\" {throwTestException;}";
- try
- {
+ try {
SieveMailAdapter mail = (SieveMailAdapter) JUnitUtils.createMail();
- mail.getMessage().addHeader("From", "user@domain");
+ mail.getMessage().addHeader("From", "user@domain");
JUnitUtils.interpret(mail, script);
- }
- catch (MessagingException e)
- {
- }
- catch (ThrowTestException.TestException e)
- {
+ } catch (MessagingException e) {
+ } catch (ThrowTestException.TestException e) {
isTestPassed = true;
- }
- catch (ParseException e)
- {
- }
- catch (SieveException e)
- {
+ } catch (ParseException e) {
+ } catch (SieveException e) {
}
assertTrue(isTestPassed);
}
-
+
/**
* Test for Test 'address'
*/
- public void testCaseInsensitiveHeaderName()
- {
+ public void testCaseInsensitiveHeaderName() {
boolean isTestPassed = false;
String script = "if address :all :is \"from\" \"user@domain\" {throwTestException;}";
- try
- {
+ try {
SieveMailAdapter mail = (SieveMailAdapter) JUnitUtils.createMail();
- mail.getMessage().addHeader("From", "user@domain");
+ mail.getMessage().addHeader("From", "user@domain");
JUnitUtils.interpret(mail, script);
- }
- catch (MessagingException e)
- {
- }
- catch (ThrowTestException.TestException e)
- {
+ } catch (MessagingException e) {
+ } catch (ThrowTestException.TestException e) {
isTestPassed = true;
- }
- catch (ParseException e)
- {
- }
- catch (SieveException e)
- {
+ } catch (ParseException e) {
+ } catch (SieveException e) {
}
assertTrue(isTestPassed);
- }
-
+ }
+
/**
* Test for Test 'address'
*/
- public void testTreatmentOfEmbededSpacesInHeaderName()
- {
+ public void testTreatmentOfEmbededSpacesInHeaderName() {
boolean isTestPassed = false;
String script = "if address :all :is \"From\" \"user@domain\" {throwTestException;}";
- try
- {
+ try {
SieveMailAdapter mail = (SieveMailAdapter) JUnitUtils.createMail();
mail.getMessage().addHeader("From ", "user@domain");
JUnitUtils.interpret(mail, script);
- }
- catch (MessagingException e)
- {
- }
- catch (ThrowTestException.TestException e)
- {
+ } catch (MessagingException e) {
+ } catch (ThrowTestException.TestException e) {
isTestPassed = true;
- }
- catch (ParseException e)
- {
- }
- catch (SieveException e)
- {
+ } catch (ParseException e) {
+ } catch (SieveException e) {
}
assertTrue(isTestPassed);
}
-
+
/**
* Test for Test 'address'
*/
- public void testOctetComparatorTrue()
- {
+ public void testOctetComparatorTrue() {
boolean isTestPassed = false;
String script = "if address :comparator \"i;octet\" :all :is \"From\" \"uSeR@dOmAiN\" {throwTestException;}";
- try
- {
+ try {
SieveMailAdapter mail = (SieveMailAdapter) JUnitUtils.createMail();
- mail.getMessage().addHeader("From ", "uSeR@dOmAiN");
+ mail.getMessage().addHeader("From ", "uSeR@dOmAiN");
JUnitUtils.interpret(mail, script);
- }
- catch (MessagingException e)
- {
- }
- catch (ThrowTestException.TestException e)
- {
+ } catch (MessagingException e) {
+ } catch (ThrowTestException.TestException e) {
isTestPassed = true;
- }
- catch (ParseException e)
- {
- }
- catch (SieveException e)
- {
+ } catch (ParseException e) {
+ } catch (SieveException e) {
}
assertTrue(isTestPassed);
}
-
+
/**
* Test for Test 'address'
*/
- public void testOctetComparatorFalse()
- {
+ public void testOctetComparatorFalse() {
boolean isTestPassed = false;
String script = "if address :comparator \"i;octet\" :all :is \"From\" \"uSeR@dOmAiN\" {throwTestException;}";
- try
- {
+ try {
SieveMailAdapter mail = (SieveMailAdapter) JUnitUtils.createMail();
- mail.getMessage().addHeader("From ", "user@domain");
+ mail.getMessage().addHeader("From ", "user@domain");
JUnitUtils.interpret(mail, script);
- isTestPassed = true;
- }
- catch (MessagingException e)
- {
- }
- catch (ThrowTestException.TestException e)
- {
- }
- catch (ParseException e)
- {
- }
- catch (SieveException e)
- {
+ isTestPassed = true;
+ } catch (MessagingException e) {
+ } catch (ThrowTestException.TestException e) {
+ } catch (ParseException e) {
+ } catch (SieveException e) {
}
assertTrue(isTestPassed);
- }
-
+ }
+
/**
* Test for Test 'address'
*/
- public void testAsciiComparatorTrue()
- {
+ public void testAsciiComparatorTrue() {
boolean isTestPassed = false;
String script = "if address :comparator \"i;ascii-casemap\" :all :is \"From\" \"uSeR@dOmAiN\" {throwTestException;}";
- try
- {
+ try {
SieveMailAdapter mail = (SieveMailAdapter) JUnitUtils.createMail();
- mail.getMessage().addHeader("From ", "user@domain");
+ mail.getMessage().addHeader("From ", "user@domain");
JUnitUtils.interpret(mail, script);
- }
- catch (MessagingException e)
- {
- }
- catch (ThrowTestException.TestException e)
- {
+ } catch (MessagingException e) {
+ } catch (ThrowTestException.TestException e) {
isTestPassed = true;
- }
- catch (ParseException e)
- {
- }
- catch (SieveException e)
- {
+ } catch (ParseException e) {
+ } catch (SieveException e) {
}
assertTrue(isTestPassed);
}
-
+
/**
* Test for Test 'address'
*/
- public void testAsciiComparatorFalse()
- {
+ public void testAsciiComparatorFalse() {
boolean isTestPassed = false;
String script = "if address :comparator \"i;ascii-casemap\" :all :is \"From\" \"uSeR@dOmAiN\" {throwTestException;}";
- try
- {
+ try {
SieveMailAdapter mail = (SieveMailAdapter) JUnitUtils.createMail();
- mail.getMessage().addHeader("From ", "user@domain1");
+ mail.getMessage().addHeader("From ", "user@domain1");
JUnitUtils.interpret(mail, script);
- isTestPassed = true;
- }
- catch (MessagingException e)
- {
- }
- catch (ThrowTestException.TestException e)
- {
- }
- catch (ParseException e)
- {
- }
- catch (SieveException e)
- {
+ isTestPassed = true;
+ } catch (MessagingException e) {
+ } catch (ThrowTestException.TestException e) {
+ } catch (ParseException e) {
+ } catch (SieveException e) {
}
assertTrue(isTestPassed);
- }
-
+ }
+
/**
* Test for Test 'address'
*/
- public void testIfAddressAllIsMultiTrue1()
- {
+ public void testIfAddressAllIsMultiTrue1() {
boolean isTestPassed = false;
String script = "if address :all :is [\"From\", \"To\"] \"user@domain\" {throwTestException;}";
- try
- {
+ try {
SieveMailAdapter mail = (SieveMailAdapter) JUnitUtils.createMail();
- mail.getMessage().addHeader("From", "user@domain");
- mail.getMessage().addHeader("To", "user@domain");
+ mail.getMessage().addHeader("From", "user@domain");
+ mail.getMessage().addHeader("To", "user@domain");
JUnitUtils.interpret(mail, script);
- }
- catch (MessagingException e)
- {
- }
- catch (ThrowTestException.TestException e)
- {
+ } catch (MessagingException e) {
+ } catch (ThrowTestException.TestException e) {
isTestPassed = true;
- }
- catch (ParseException e)
- {
- }
- catch (SieveException e)
- {
+ } catch (ParseException e) {
+ } catch (SieveException e) {
}
assertTrue(isTestPassed);
- }
-
+ }
+
/**
* Test for Test 'address'
*/
- public void testIfAddressAllIsMultiTrue2()
- {
+ public void testIfAddressAllIsMultiTrue2() {
boolean isTestPassed = false;
String script = "if address :all :is [\"From\", \"To\"] [\"user@domain\", \"tweety@pie\"] {throwTestException;}";
- try
- {
+ try {
SieveMailAdapter mail = (SieveMailAdapter) JUnitUtils.createMail();
- mail.getMessage().addHeader("From", "user@domain");
- mail.getMessage().addHeader("To", "user@domain");
+ mail.getMessage().addHeader("From", "user@domain");
+ mail.getMessage().addHeader("To", "user@domain");
JUnitUtils.interpret(mail, script);
- }
- catch (MessagingException e)
- {
- }
- catch (ThrowTestException.TestException e)
- {
+ } catch (MessagingException e) {
+ } catch (ThrowTestException.TestException e) {
isTestPassed = true;
- }
- catch (ParseException e)
- {
- }
- catch (SieveException e)
- {
+ } catch (ParseException e) {
+ } catch (SieveException e) {
}
assertTrue(isTestPassed);
}
-
+
/**
* Test for Test 'address'
*/
- public void testIfAddressAllIsMultiTrue3()
- {
+ public void testIfAddressAllIsMultiTrue3() {
boolean isTestPassed = false;
String script = "if address :all :is [\"From\", \"To\"] [\"user@domain\", \"tweety@pie\"] {throwTestException;}";
- try
- {
+ try {
SieveMailAdapter mail = (SieveMailAdapter) JUnitUtils.createMail();
- mail.getMessage().addHeader("From", "user@domain");
- mail.getMessage().addHeader("To", "tweety@pie");
+ mail.getMessage().addHeader("From", "user@domain");
+ mail.getMessage().addHeader("To", "tweety@pie");
JUnitUtils.interpret(mail, script);
- }
- catch (MessagingException e)
- {
- }
- catch (ThrowTestException.TestException e)
- {
+ } catch (MessagingException e) {
+ } catch (ThrowTestException.TestException e) {
isTestPassed = true;
- }
- catch (ParseException e)
- {
- }
- catch (SieveException e)
- {
+ } catch (ParseException e) {
+ } catch (SieveException e) {
}
assertTrue(isTestPassed);
}
-
+
/**
* Test for Test 'address'
*/
- public void testIfAddressAllIsMultiTrue4()
- {
+ public void testIfAddressAllIsMultiTrue4() {
boolean isTestPassed = false;
String script = "if address :all :is [\"From\", \"To\"] [\"user@domain\", \"tweety@pie\"] {throwTestException;}";
- try
- {
+ try {
SieveMailAdapter mail = (SieveMailAdapter) JUnitUtils.createMail();
- mail.getMessage().addHeader("From", "tweety@pie");
- mail.getMessage().addHeader("To", "tweety@pie");
+ mail.getMessage().addHeader("From", "tweety@pie");
+ mail.getMessage().addHeader("To", "tweety@pie");
JUnitUtils.interpret(mail, script);
- }
- catch (MessagingException e)
- {
- }
- catch (ThrowTestException.TestException e)
- {
+ } catch (MessagingException e) {
+ } catch (ThrowTestException.TestException e) {
isTestPassed = true;
- }
- catch (ParseException e)
- {
- }
- catch (SieveException e)
- {
+ } catch (ParseException e) {
+ } catch (SieveException e) {
}
assertTrue(isTestPassed);
- }
-
+ }
+
/**
* Test for Test 'address'
*/
- public void testIfAddressAllMatchesTrue()
- {
+ public void testIfAddressAllMatchesTrue() {
boolean isTestPassed = false;
String script = "if address :all :matches \"From\" \"*@domain\" {throwTestException;}";
- try
- {
+ try {
SieveMailAdapter mail = (SieveMailAdapter) JUnitUtils.createMail();
- mail.getMessage().addHeader("From", "user@domain");
+ mail.getMessage().addHeader("From", "user@domain");
JUnitUtils.interpret(mail, script);
- }
- catch (MessagingException e)
- {
- }
- catch (ThrowTestException.TestException e)
- {
+ } catch (MessagingException e) {
+ } catch (ThrowTestException.TestException e) {
isTestPassed = true;
- }
- catch (ParseException e)
- {
- }
- catch (SieveException e)
- {
+ } catch (ParseException e) {
+ } catch (SieveException e) {
}
assertTrue(isTestPassed);
- }
-
+ }
+
/**
* Test for Test 'address'
*/
- public void testIfAddressAllContainsTrue()
- {
+ public void testIfAddressAllContainsTrue() {
boolean isTestPassed = false;
String script = "if address :all :contains \"From\" \"r@dom\" {throwTestException;}";
- try
- {
+ try {
SieveMailAdapter mail = (SieveMailAdapter) JUnitUtils.createMail();
- mail.getMessage().addHeader("From", "user@domain");
+ mail.getMessage().addHeader("From", "user@domain");
JUnitUtils.interpret(mail, script);
- }
- catch (MessagingException e)
- {
- }
- catch (ThrowTestException.TestException e)
- {
+ } catch (MessagingException e) {
+ } catch (ThrowTestException.TestException e) {
isTestPassed = true;
- }
- catch (ParseException e)
- {
- }
- catch (SieveException e)
- {
+ } catch (ParseException e) {
+ } catch (SieveException e) {
}
assertTrue(isTestPassed);
- }
-
+ }
+
/**
* Test for Test 'address'
*/
- public void testIfAddressLocalpartIsTrue()
- {
+ public void testIfAddressLocalpartIsTrue() {
boolean isTestPassed = false;
String script = "if address :localpart :is \"From\" \"user\" {throwTestException;}";
- try
- {
+ try {
SieveMailAdapter mail = (SieveMailAdapter) JUnitUtils.createMail();
- mail.getMessage().addHeader("From", "user@domain");
+ mail.getMessage().addHeader("From", "user@domain");
JUnitUtils.interpret(mail, script);
- }
- catch (MessagingException e)
- {
- }
- catch (ThrowTestException.TestException e)
- {
+ } catch (MessagingException e) {
+ } catch (ThrowTestException.TestException e) {
isTestPassed = true;
- }
- catch (ParseException e)
- {
- }
- catch (SieveException e)
- {
+ } catch (ParseException e) {
+ } catch (SieveException e) {
}
assertTrue(isTestPassed);
}
-
+
/**
* Test for Test 'address'
*/
- public void testIfAddressLocalpartMatchesTrue()
- {
+ public void testIfAddressLocalpartMatchesTrue() {
boolean isTestPassed = false;
String script = "if address :localpart :matches \"From\" \"*er\" {throwTestException;}";
- try
- {
+ try {
SieveMailAdapter mail = (SieveMailAdapter) JUnitUtils.createMail();
- mail.getMessage().addHeader("From", "user@domain");
+ mail.getMessage().addHeader("From", "user@domain");
JUnitUtils.interpret(mail, script);
- }
- catch (MessagingException e)
- {
- }
- catch (ThrowTestException.TestException e)
- {
+ } catch (MessagingException e) {
+ } catch (ThrowTestException.TestException e) {
isTestPassed = true;
- }
- catch (ParseException e)
- {
- }
- catch (SieveException e)
- {
+ } catch (ParseException e) {
+ } catch (SieveException e) {
}
assertTrue(isTestPassed);
- }
-
+ }
+
/**
* Test for Test 'address'
*/
- public void testIfAddressLocalpartContainsTrue()
- {
+ public void testIfAddressLocalpartContainsTrue() {
boolean isTestPassed = false;
String script = "if address :localpart :contains \"From\" \"r\" {throwTestException;}";
- try
- {
+ try {
SieveMailAdapter mail = (SieveMailAdapter) JUnitUtils.createMail();
- mail.getMessage().addHeader("From", "user@domain");
+ mail.getMessage().addHeader("From", "user@domain");
JUnitUtils.interpret(mail, script);
- }
- catch (MessagingException e)
- {
- }
- catch (ThrowTestException.TestException e)
- {
+ } catch (MessagingException e) {
+ } catch (ThrowTestException.TestException e) {
isTestPassed = true;
- }
- catch (ParseException e)
- {
- }
- catch (SieveException e)
- {
+ } catch (ParseException e) {
+ } catch (SieveException e) {
}
assertTrue(isTestPassed);
- }
-
+ }
+
/**
* Test for Test 'address'
*/
- public void testIfAddressDomainIsTrue()
- {
+ public void testIfAddressDomainIsTrue() {
boolean isTestPassed = false;
String script = "if address :domain :is \"From\" \"domain\" {throwTestException;}";
- try
- {
+ try {
SieveMailAdapter mail = (SieveMailAdapter) JUnitUtils.createMail();
- mail.getMessage().addHeader("From", "user@domain");
+ mail.getMessage().addHeader("From", "user@domain");
JUnitUtils.interpret(mail, script);
- }
- catch (MessagingException e)
- {
- }
- catch (ThrowTestException.TestException e)
- {
+ } catch (MessagingException e) {
+ } catch (ThrowTestException.TestException e) {
isTestPassed = true;
- }
- catch (ParseException e)
- {
- }
- catch (SieveException e)
- {
+ } catch (ParseException e) {
+ } catch (SieveException e) {
}
assertTrue(isTestPassed);
}
-
+
/**
* Test for Test 'address'
*/
- public void testIfAddressDomainMatchesTrue()
- {
+ public void testIfAddressDomainMatchesTrue() {
boolean isTestPassed = false;
String script = "if address :domain :matches \"From\" \"*main\" {throwTestException;}";
- try
- {
+ try {
SieveMailAdapter mail = (SieveMailAdapter) JUnitUtils.createMail();
- mail.getMessage().addHeader("From", "user@domain");
+ mail.getMessage().addHeader("From", "user@domain");
JUnitUtils.interpret(mail, script);
- }
- catch (MessagingException e)
- {
- }
- catch (ThrowTestException.TestException e)
- {
+ } catch (MessagingException e) {
+ } catch (ThrowTestException.TestException e) {
isTestPassed = true;
- }
- catch (ParseException e)
- {
- }
- catch (SieveException e)
- {
+ } catch (ParseException e) {
+ } catch (SieveException e) {
}
assertTrue(isTestPassed);
- }
-
+ }
+
/**
* Test for Test 'address'
*/
- public void testIfAddressDomainContainsTrue()
- {
+ public void testIfAddressDomainContainsTrue() {
boolean isTestPassed = false;
String script = "if address :domain :contains \"From\" \"dom\" {throwTestException;}";
- try
- {
+ try {
SieveMailAdapter mail = (SieveMailAdapter) JUnitUtils.createMail();
- mail.getMessage().addHeader("From", "user@domain");
+ mail.getMessage().addHeader("From", "user@domain");
JUnitUtils.interpret(mail, script);
- }
- catch (MessagingException e)
- {
- }
- catch (ThrowTestException.TestException e)
- {
+ } catch (MessagingException e) {
+ } catch (ThrowTestException.TestException e) {
isTestPassed = true;
- }
- catch (ParseException e)
- {
- }
- catch (SieveException e)
- {
+ } catch (ParseException e) {
+ } catch (SieveException e) {
}
assertTrue(isTestPassed);
}
-
+
/**
* Test for Test 'address'
*/
- public void testIfAddressAllIsFalse()
- {
+ public void testIfAddressAllIsFalse() {
boolean isTestPassed = false;
String script = "if address :all :is \"From\" \"user@domain\" {throwTestException;}";
- try
- {
+ try {
SieveMailAdapter mail = (SieveMailAdapter) JUnitUtils.createMail();
- mail.getMessage().addHeader("From", "tweety@pie");
+ mail.getMessage().addHeader("From", "tweety@pie");
JUnitUtils.interpret(mail, script);
- isTestPassed = true;
- }
- catch (MessagingException e)
- {
- }
- catch (ThrowTestException.TestException e)
- {
- }
- catch (ParseException e)
- {
- }
- catch (SieveException e)
- {
+ isTestPassed = true;
+ } catch (MessagingException e) {
+ } catch (ThrowTestException.TestException e) {
+ } catch (ParseException e) {
+ } catch (SieveException e) {
}
assertTrue(isTestPassed);
}
-
+
/**
* Test for Test 'address'
*/
- public void testIfAddressAllMatchesFalse()
- {
+ public void testIfAddressAllMatchesFalse() {
boolean isTestPassed = false;
String script = "if address :all :matches \"From\" \"(.*)@domain\" {throwTestException;}";
- try
- {
+ try {
SieveMailAdapter mail = (SieveMailAdapter) JUnitUtils.createMail();
- mail.getMessage().addHeader("From", "tweety@pie");
+ mail.getMessage().addHeader("From", "tweety@pie");
JUnitUtils.interpret(mail, script);
- isTestPassed = true;
- }
- catch (MessagingException e)
- {
- }
- catch (ThrowTestException.TestException e)
- {
- }
- catch (ParseException e)
- {
- }
- catch (SieveException e)
- {
+ isTestPassed = true;
+ } catch (MessagingException e) {
+ } catch (ThrowTestException.TestException e) {
+ } catch (ParseException e) {
+ } catch (SieveException e) {
}
assertTrue(isTestPassed);
- }
-
+ }
+
/**
* Test for Test 'address'
*/
- public void testIfAddressAllContainsFalse()
- {
+ public void testIfAddressAllContainsFalse() {
boolean isTestPassed = false;
String script = "if address :all :contains \"From\" \"r@dom\" {throwTestException;}";
- try
- {
+ try {
SieveMailAdapter mail = (SieveMailAdapter) JUnitUtils.createMail();
- mail.getMessage().addHeader("From", "tweety@pie");
+ mail.getMessage().addHeader("From", "tweety@pie");
JUnitUtils.interpret(mail, script);
- isTestPassed = true;
- }
- catch (MessagingException e)
- {
- }
- catch (ThrowTestException.TestException e)
- {
- }
- catch (ParseException e)
- {
- }
- catch (SieveException e)
- {
+ isTestPassed = true;
+ } catch (MessagingException e) {
+ } catch (ThrowTestException.TestException e) {
+ } catch (ParseException e) {
+ } catch (SieveException e) {
}
assertTrue(isTestPassed);
- }
-
+ }
+
/**
* Test for Test 'address'
*/
- public void testIfAddressLocalpartIsFalse()
- {
+ public void testIfAddressLocalpartIsFalse() {
boolean isTestPassed = false;
String script = "if address :localpart :is \"From\" \"user\" {throwTestException;}";
- try
- {
+ try {
SieveMailAdapter mail = (SieveMailAdapter) JUnitUtils.createMail();
- mail.getMessage().addHeader("From", "tweety@pie");
+ mail.getMessage().addHeader("From", "tweety@pie");
JUnitUtils.interpret(mail, script);
- isTestPassed = true;
- }
- catch (MessagingException e)
- {
- }
- catch (ThrowTestException.TestException e)
- {
- }
- catch (ParseException e)
- {
- }
- catch (SieveException e)
- {
+ isTestPassed = true;
+ } catch (MessagingException e) {
+ } catch (ThrowTestException.TestException e) {
+ } catch (ParseException e) {
+ } catch (SieveException e) {
}
assertTrue(isTestPassed);
}
-
+
/**
* Test for Test 'address'
*/
- public void testIfAddressLocalpartMatchesFalse()
- {
+ public void testIfAddressLocalpartMatchesFalse() {
boolean isTestPassed = false;
String script = "if address :localpart :matches \"From\" \"(.*)er\" {throwTestException;}";
- try
- {
+ try {
SieveMailAdapter mail = (SieveMailAdapter) JUnitUtils.createMail();
- mail.getMessage().addHeader("From", "tweety@pie");
+ mail.getMessage().addHeader("From", "tweety@pie");
JUnitUtils.interpret(mail, script);
- isTestPassed = true;
- }
- catch (MessagingException e)
- {
- }
- catch (ThrowTestException.TestException e)
- {
- }
- catch (ParseException e)
- {
- }
- catch (SieveException e)
- {
+ isTestPassed = true;
+ } catch (MessagingException e) {
+ } catch (ThrowTestException.TestException e) {
+ } catch (ParseException e) {
+ } catch (SieveException e) {
}
assertTrue(isTestPassed);
- }
-
+ }
+
/**
* Test for Test 'address'
*/
- public void testIfAddressLocalpartContainsFalse()
- {
+ public void testIfAddressLocalpartContainsFalse() {
boolean isTestPassed = false;
String script = "if address :localpart :contains \"From\" \"r\" {throwTestException;}";
- try
- {
+ try {
SieveMailAdapter mail = (SieveMailAdapter) JUnitUtils.createMail();
- mail.getMessage().addHeader("From", "tweety@pie");
+ mail.getMessage().addHeader("From", "tweety@pie");
JUnitUtils.interpret(mail, script);
- isTestPassed = true;
- }
- catch (MessagingException e)
- {
- }
- catch (ThrowTestException.TestException e)
- {
- }
- catch (ParseException e)
- {
- }
- catch (SieveException e)
- {
+ isTestPassed = true;
+ } catch (MessagingException e) {
+ } catch (ThrowTestException.TestException e) {
+ } catch (ParseException e) {
+ } catch (SieveException e) {
}
assertTrue(isTestPassed);
- }
-
+ }
+
/**
* Test for Test 'address'
*/
- public void testIfAddressDomainIsFalse()
- {
+ public void testIfAddressDomainIsFalse() {
boolean isTestPassed = false;
String script = "if address :domain :is \"From\" \"domain\" {throwTestException;}";
- try
- {
+ try {
SieveMailAdapter mail = (SieveMailAdapter) JUnitUtils.createMail();
- mail.getMessage().addHeader("From", "tweety@pie");
+ mail.getMessage().addHeader("From", "tweety@pie");
JUnitUtils.interpret(mail, script);
- isTestPassed = true;
- }
- catch (MessagingException e)
- {
- }
- catch (ThrowTestException.TestException e)
- {
- }
- catch (ParseException e)
- {
- }
- catch (SieveException e)
- {
+ isTestPassed = true;
+ } catch (MessagingException e) {
+ } catch (ThrowTestException.TestException e) {
+ } catch (ParseException e) {
+ } catch (SieveException e) {
}
assertTrue(isTestPassed);
}
-
+
/**
* Test for Test 'address'
*/
- public void testIfAddressDomainMatchesFalse()
- {
+ public void testIfAddressDomainMatchesFalse() {
boolean isTestPassed = false;
String script = "if address :domain :matches \"From\" \"(.*)main\" {throwTestException;}";
- try
- {
+ try {
SieveMailAdapter mail = (SieveMailAdapter) JUnitUtils.createMail();
- mail.getMessage().addHeader("From", "tweety@pie");
+ mail.getMessage().addHeader("From", "tweety@pie");
JUnitUtils.interpret(mail, script);
- isTestPassed = true;
- }
- catch (MessagingException e)
- {
- }
- catch (ThrowTestException.TestException e)
- {
- }
- catch (ParseException e)
- {
- }
- catch (SieveException e)
- {
+ isTestPassed = true;
+ } catch (MessagingException e) {
+ } catch (ThrowTestException.TestException e) {
+ } catch (ParseException e) {
+ } catch (SieveException e) {
}
assertTrue(isTestPassed);
- }
-
+ }
+
/**
* Test for Test 'address'
*/
- public void testIfAddressDomainContainsFalse()
- {
+ public void testIfAddressDomainContainsFalse() {
boolean isTestPassed = false;
String script = "if address :domain :contains \"From\" \"dom\" {throwTestException;}";
- try
- {
+ try {
SieveMailAdapter mail = (SieveMailAdapter) JUnitUtils.createMail();
- mail.getMessage().addHeader("From", "tweety@pie");
+ mail.getMessage().addHeader("From", "tweety@pie");
JUnitUtils.interpret(mail, script);
- isTestPassed = true;
- }
- catch (MessagingException e)
- {
- }
- catch (ThrowTestException.TestException e)
- {
- }
- catch (ParseException e)
- {
- }
- catch (SieveException e)
- {
+ isTestPassed = true;
+ } catch (MessagingException e) {
+ } catch (ThrowTestException.TestException e) {
+ } catch (ParseException e) {
+ } catch (SieveException e) {
}
assertTrue(isTestPassed);
}
-
+
/**
* Test for Test 'address'
*/
- public void testIfAddressAllIsMultiFalse1()
- {
+ public void testIfAddressAllIsMultiFalse1() {
boolean isTestPassed = false;
String script = "if address :all :is [\"From\", \"To\"] \"user@domain\" {throwTestException;}";
- try
- {
+ try {
SieveMailAdapter mail = (SieveMailAdapter) JUnitUtils.createMail();
- mail.getMessage().addHeader("From", "bugs@bunny");
- mail.getMessage().addHeader("To", "bugs@bunny");
+ mail.getMessage().addHeader("From", "bugs@bunny");
+ mail.getMessage().addHeader("To", "bugs@bunny");
JUnitUtils.interpret(mail, script);
- isTestPassed = true;
- }
- catch (MessagingException e)
- {
- }
- catch (ThrowTestException.TestException e)
- {
- }
- catch (ParseException e)
- {
- }
- catch (SieveException e)
- {
+ isTestPassed = true;
+ } catch (MessagingException e) {
+ } catch (ThrowTestException.TestException e) {
+ } catch (ParseException e) {
+ } catch (SieveException e) {
}
assertTrue(isTestPassed);
- }
-
+ }
+
/**
* Test for Test 'address'
*/
- public void testIfAddressAllIsMultiFalse2()
- {
+ public void testIfAddressAllIsMultiFalse2() {
boolean isTestPassed = false;
String script = "if address :all :is [\"From\", \"To\"] [\"user@domain\", \"tweety@pie\"] {throwTestException;}";
- try
- {
+ try {
SieveMailAdapter mail = (SieveMailAdapter) JUnitUtils.createMail();
- mail.getMessage().addHeader("From", "bugs@bunny");
- mail.getMessage().addHeader("To", "bugs@bunny");
+ mail.getMessage().addHeader("From", "bugs@bunny");
+ mail.getMessage().addHeader("To", "bugs@bunny");
JUnitUtils.interpret(mail, script);
- isTestPassed = true;
- }
- catch (MessagingException e)
- {
- }
- catch (ThrowTestException.TestException e)
- {
- }
- catch (ParseException e)
- {
- }
- catch (SieveException e)
- {
+ isTestPassed = true;
+ } catch (MessagingException e) {
+ } catch (ThrowTestException.TestException e) {
+ } catch (ParseException e) {
+ } catch (SieveException e) {
}
assertTrue(isTestPassed);
}
-
- }
+
+}
Modified: james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/AllOfTest.java
URL: http://svn.apache.org/viewvc/james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/AllOfTest.java?rev=578031&r1=578030&r2=578031&view=diff
==============================================================================
--- james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/AllOfTest.java (original)
+++ james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/AllOfTest.java Fri Sep 21 02:22:30 2007
@@ -17,7 +17,6 @@
* under the License. *
****************************************************************/
-
package org.apache.jsieve.junit;
import org.apache.jsieve.CommandManager;
@@ -33,164 +32,120 @@
/**
* Class AllOfTest
*/
-public class AllOfTest extends TestCase
-{
+public class AllOfTest extends TestCase {
/**
* Constructor for TrueTest.
+ *
* @param arg0
*/
- public AllOfTest(String arg0)
- {
+ public AllOfTest(String arg0) {
super(arg0);
}
- public static void main(String[] args)
- {
+ public static void main(String[] args) {
junit.swingui.TestRunner.run(AllOfTest.class);
}
/**
* @see TestCase#setUp()
*/
- protected void setUp() throws Exception
- {
+ protected void setUp() throws Exception {
super.setUp();
CommandManager.resetInstance();
- TestManager.resetInstance();
- }
+ TestManager.resetInstance();
+ }
/**
* @see TestCase#tearDown()
*/
- protected void tearDown() throws Exception
- {
+ protected void tearDown() throws Exception {
super.tearDown();
}
-
+
/**
* Test for Test 'allof'
*/
- public void testIfAllOfFalseTrue()
- {
+ public void testIfAllOfFalseTrue() {
boolean isTestPassed = false;
String script = "if allof (false, true) {stop;} throwTestException;";
- try
- {
+ try {
JUnitUtils.interpret(JUnitUtils.createMail(), script);
- }
- catch (ThrowTestException.TestException e)
- {
+ } catch (ThrowTestException.TestException e) {
isTestPassed = true;
- }
- catch (ParseException e)
- {
- }
- catch (SieveException e)
- {
+ } catch (ParseException e) {
+ } catch (SieveException e) {
}
assertTrue(isTestPassed);
}
-
+
/**
* Test for Test 'allof'
*/
- public void testIfAllOfTrueTrue()
- {
+ public void testIfAllOfTrueTrue() {
boolean isTestPassed = false;
String script = "if allof (true, true) {throwTestException;}";
- try
- {
+ try {
JUnitUtils.interpret(JUnitUtils.createMail(), script);
- }
- catch (ThrowTestException.TestException e)
- {
+ } catch (ThrowTestException.TestException e) {
isTestPassed = true;
- }
- catch (ParseException e)
- {
- }
- catch (SieveException e)
- {
+ } catch (ParseException e) {
+ } catch (SieveException e) {
}
assertTrue(isTestPassed);
}
-
+
/**
* Test for Test 'allof'
*/
- public void testIfAllOfFalseFalse()
- {
+ public void testIfAllOfFalseFalse() {
boolean isTestPassed = false;
String script = "if allof (false, false) {stop;} throwTestException;";
- try
- {
+ try {
JUnitUtils.interpret(JUnitUtils.createMail(), script);
- }
- catch (ThrowTestException.TestException e)
- {
+ } catch (ThrowTestException.TestException e) {
isTestPassed = true;
- }
- catch (ParseException e)
- {
- }
- catch (SieveException e)
- {
+ } catch (ParseException e) {
+ } catch (SieveException e) {
}
assertTrue(isTestPassed);
- }
-
+ }
+
/**
* Test for Test 'allof'
*/
- public void testIfAllOfTrueFalse()
- {
+ public void testIfAllOfTrueFalse() {
boolean isTestPassed = false;
String script = "if allof (true, false) {stop;} throwTestException;";
- try
- {
+ try {
JUnitUtils.interpret(JUnitUtils.createMail(), script);
- }
- catch (ThrowTestException.TestException e)
- {
+ } catch (ThrowTestException.TestException e) {
isTestPassed = true;
- }
- catch (ParseException e)
- {
- }
- catch (SieveException e)
- {
+ } catch (ParseException e) {
+ } catch (SieveException e) {
}
assertTrue(isTestPassed);
- }
-
+ }
+
/**
* Test for Test 'anyof' with invalid argument
*/
- public void testInvalidArgument()
- {
+ public void testInvalidArgument() {
boolean isTestPassed = false;
String script = "if anyof 1 {throwTestException;}";
- try
- {
+ try {
JUnitUtils.interpret(JUnitUtils.createMail(), script);
- }
- catch (SyntaxException e)
- {
+ } catch (SyntaxException e) {
isTestPassed = true;
- }
- catch (ParseException e)
- {
- }
- catch (SieveException e)
- {
+ } catch (ParseException e) {
+ } catch (SieveException e) {
}
assertTrue(isTestPassed);
- }
+ }
}
Modified: james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/AllTests.java
URL: http://svn.apache.org/viewvc/james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/AllTests.java?rev=578031&r1=578030&r2=578031&view=diff
==============================================================================
--- james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/AllTests.java (original)
+++ james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/AllTests.java Fri Sep 21 02:22:30 2007
@@ -17,7 +17,6 @@
* under the License. *
****************************************************************/
-
package org.apache.jsieve.junit;
import junit.framework.Test;
@@ -26,27 +25,24 @@
/**
* Class AllTests
*/
-public class AllTests
-{
+public class AllTests {
- public static void main(String[] args)
- {
+ public static void main(String[] args) {
junit.swingui.TestRunner.run(AllTests.class);
}
- public static Test suite()
- {
+ public static Test suite() {
TestSuite suite = new TestSuite("Test for org.apache.jsieve.junit");
- //$JUnit-BEGIN$
- suite.addTest(new TestSuite(ConfigurationManagerTest.class));
+ // $JUnit-BEGIN$
+ suite.addTest(new TestSuite(ConfigurationManagerTest.class));
suite.addTest(new TestSuite(ConditionTest.class));
suite.addTest(new TestSuite(RequireTest.class));
suite.addTest(new TestSuite(StopTest.class));
- suite.addTest(new TestSuite(KeepTest.class));
+ suite.addTest(new TestSuite(KeepTest.class));
suite.addTest(new TestSuite(DiscardTest.class));
suite.addTest(new TestSuite(FileIntoTest.class));
suite.addTest(new TestSuite(RejectTest.class));
- suite.addTest(new TestSuite(TrueTest.class));
+ suite.addTest(new TestSuite(TrueTest.class));
suite.addTest(new TestSuite(FalseTest.class));
suite.addTest(new TestSuite(NotTest.class));
suite.addTest(new TestSuite(AnyOfTest.class));
@@ -54,10 +50,10 @@
suite.addTest(new TestSuite(ExistsTest.class));
suite.addTest(new TestSuite(AddressTest.class));
suite.addTest(new TestSuite(HeaderTest.class));
- suite.addTest(new TestSuite(SizeTest.class));
+ suite.addTest(new TestSuite(SizeTest.class));
suite.addTest(new TestSuite(EnvelopeTest.class));
- suite.addTest(new TestSuite(LogTest.class));
- //$JUnit-END$
+ suite.addTest(new TestSuite(LogTest.class));
+ // $JUnit-END$
return suite;
}
}
Modified: james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/AnyOfTest.java
URL: http://svn.apache.org/viewvc/james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/AnyOfTest.java?rev=578031&r1=578030&r2=578031&view=diff
==============================================================================
--- james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/AnyOfTest.java (original)
+++ james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/AnyOfTest.java Fri Sep 21 02:22:30 2007
@@ -17,7 +17,6 @@
* under the License. *
****************************************************************/
-
package org.apache.jsieve.junit;
import org.apache.jsieve.CommandManager;
@@ -33,164 +32,120 @@
/**
* Class AnyOfTest
*/
-public class AnyOfTest extends TestCase
-{
+public class AnyOfTest extends TestCase {
/**
* Constructor for TrueTest.
+ *
* @param arg0
*/
- public AnyOfTest(String arg0)
- {
+ public AnyOfTest(String arg0) {
super(arg0);
}
- public static void main(String[] args)
- {
+ public static void main(String[] args) {
junit.swingui.TestRunner.run(AnyOfTest.class);
}
/**
* @see TestCase#setUp()
*/
- protected void setUp() throws Exception
- {
+ protected void setUp() throws Exception {
super.setUp();
CommandManager.resetInstance();
- TestManager.resetInstance();
- }
+ TestManager.resetInstance();
+ }
/**
* @see TestCase#tearDown()
*/
- protected void tearDown() throws Exception
- {
+ protected void tearDown() throws Exception {
super.tearDown();
}
-
+
/**
* Test for Test 'anyof'
*/
- public void testIfAnyOfFalseTrue()
- {
+ public void testIfAnyOfFalseTrue() {
boolean isTestPassed = false;
String script = "if anyof (false, true) {throwTestException;}";
- try
- {
+ try {
JUnitUtils.interpret(JUnitUtils.createMail(), script);
- }
- catch (ThrowTestException.TestException e)
- {
+ } catch (ThrowTestException.TestException e) {
isTestPassed = true;
- }
- catch (ParseException e)
- {
- }
- catch (SieveException e)
- {
+ } catch (ParseException e) {
+ } catch (SieveException e) {
}
assertTrue(isTestPassed);
}
-
+
/**
* Test for Test 'anyof'
*/
- public void testIfAnyOfTrueTrue()
- {
+ public void testIfAnyOfTrueTrue() {
boolean isTestPassed = false;
String script = "if anyof (true, true) {throwTestException;}";
- try
- {
+ try {
JUnitUtils.interpret(JUnitUtils.createMail(), script);
- }
- catch (ThrowTestException.TestException e)
- {
+ } catch (ThrowTestException.TestException e) {
isTestPassed = true;
- }
- catch (ParseException e)
- {
- }
- catch (SieveException e)
- {
+ } catch (ParseException e) {
+ } catch (SieveException e) {
}
assertTrue(isTestPassed);
}
-
+
/**
* Test for Test 'anyof'
*/
- public void testIfAnyOfFalseFalse()
- {
+ public void testIfAnyOfFalseFalse() {
boolean isTestPassed = false;
String script = "if anyof (false, false) {stop;} throwTestException;";
- try
- {
+ try {
JUnitUtils.interpret(JUnitUtils.createMail(), script);
- }
- catch (ThrowTestException.TestException e)
- {
+ } catch (ThrowTestException.TestException e) {
isTestPassed = true;
- }
- catch (ParseException e)
- {
- }
- catch (SieveException e)
- {
+ } catch (ParseException e) {
+ } catch (SieveException e) {
}
assertTrue(isTestPassed);
- }
-
+ }
+
/**
* Test for Test 'anyof'
*/
- public void testIfAnyOfTrueFalse()
- {
+ public void testIfAnyOfTrueFalse() {
boolean isTestPassed = false;
String script = "if anyof (true, false) {throwTestException;}";
- try
- {
+ try {
JUnitUtils.interpret(JUnitUtils.createMail(), script);
- }
- catch (ThrowTestException.TestException e)
- {
+ } catch (ThrowTestException.TestException e) {
isTestPassed = true;
- }
- catch (ParseException e)
- {
- }
- catch (SieveException e)
- {
+ } catch (ParseException e) {
+ } catch (SieveException e) {
}
assertTrue(isTestPassed);
- }
-
+ }
+
/**
* Test for Test 'anyof' with invalid argument
*/
- public void testInvalidArgument()
- {
+ public void testInvalidArgument() {
boolean isTestPassed = false;
String script = "if anyof 1 {throwTestException;}";
- try
- {
+ try {
JUnitUtils.interpret(JUnitUtils.createMail(), script);
- }
- catch (SyntaxException e)
- {
+ } catch (SyntaxException e) {
isTestPassed = true;
- }
- catch (ParseException e)
- {
- }
- catch (SieveException e)
- {
+ } catch (ParseException e) {
+ } catch (SieveException e) {
}
assertTrue(isTestPassed);
- }
+ }
}
Modified: james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/BodyTest.java
URL: http://svn.apache.org/viewvc/james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/BodyTest.java?rev=578031&r1=578030&r2=578031&view=diff
==============================================================================
--- james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/BodyTest.java (original)
+++ james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/BodyTest.java Fri Sep 21 02:22:30 2007
@@ -17,7 +17,6 @@
* under the License. *
****************************************************************/
-
package org.apache.jsieve.junit;
import javax.mail.MessagingException;
@@ -31,175 +30,131 @@
import org.apache.jsieve.junit.utils.*;
import org.apache.jsieve.parser.generated.ParseException;
-
/**
* Class BodyTest
*/
-public class BodyTest extends TestCase
-{
+public class BodyTest extends TestCase {
/**
* Constructor for BodyTest.
+ *
* @param arg0
*/
- public BodyTest(String arg0)
- {
+ public BodyTest(String arg0) {
super(arg0);
}
- public static void main(String[] args)
- {
+ public static void main(String[] args) {
junit.swingui.TestRunner.run(BodyTest.class);
}
/**
* @see TestCase#setUp()
*/
- protected void setUp() throws Exception
- {
+ protected void setUp() throws Exception {
super.setUp();
CommandManager.resetInstance();
- TestManager.resetInstance();
- }
+ TestManager.resetInstance();
+ }
/**
* @see TestCase#tearDown()
*/
- protected void tearDown() throws Exception
- {
+ protected void tearDown() throws Exception {
super.tearDown();
}
-
- protected SieveMailAdapter textMail()
- throws MessagingException
- {
+ protected SieveMailAdapter textMail() throws MessagingException {
SieveMailAdapter mail = (SieveMailAdapter) JUnitUtils.createMail();
- mail.getMessage().setContent("Wibble\n\n" +
- "Wibble\n", "text/plain");
+ mail.getMessage().setContent("Wibble\n\n" + "Wibble\n", "text/plain");
return mail;
}
- protected SieveMailAdapter nonTextMail()
- throws MessagingException, SieveException
- {
+ protected SieveMailAdapter nonTextMail() throws MessagingException,
+ SieveException {
SieveMailAdapter mail = (SieveMailAdapter) JUnitUtils.createMail();
// FIXME: This doesn't work
mail.getMessage().setContent(new MimeMultipart("image/png"));
return mail;
}
-
/**
* Test for Test 'header'
*/
- public void testBasic()
- {
+ public void testBasic() {
boolean isTestPassed = false;
String script = "if body :contains [\"Wibble\"] {throwTestException;}";
- try
- {
+ try {
JUnitUtils.interpret(textMail(), script);
- }
- catch (MessagingException e)
- {
- }
- catch (ThrowTestException.TestException e)
- {
+ } catch (MessagingException e) {
+ } catch (ThrowTestException.TestException e) {
isTestPassed = true;
- }
- catch (ParseException e)
- {
- }
- catch (SieveException e)
- {
+ } catch (ParseException e) {
+ } catch (SieveException e) {
}
assertTrue(isTestPassed);
}
-
/**
* Test for Test 'body'
*/
- public void testBodyCaseInsensitivity()
- {
+ public void testBodyCaseInsensitivity() {
boolean isTestPassed = false;
String script = "if body :contains [\"wibble\"] {throwTestException;}";
- try
- {
+ try {
JUnitUtils.interpret(textMail(), script);
- }
- catch (MessagingException e)
- {
- }
- catch (ThrowTestException.TestException e)
- {
+ } catch (MessagingException e) {
+ } catch (ThrowTestException.TestException e) {
isTestPassed = true;
- }
- catch (ParseException e)
- {
- }
- catch (SieveException e)
- {
+ } catch (ParseException e) {
+ } catch (SieveException e) {
}
assertTrue(isTestPassed);
- }
+ }
/**
* Test for Test 'body'
*/
- public void testBodyNoContains()
- {
+ public void testBodyNoContains() {
boolean isTestPassed = false;
String script = "if body [\"wibble\"] {throwTestException;}";
- try
- {
+ try {
JUnitUtils.interpret(textMail(), script);
- }
- catch (MessagingException e)
- {
- }
- catch (ThrowTestException.TestException e)
- {
- }
- catch (ParseException e)
- {
- }
- catch (SieveException e)
- {
+ } catch (MessagingException e) {
+ } catch (ThrowTestException.TestException e) {
+ } catch (ParseException e) {
+ } catch (SieveException e) {
isTestPassed = true;
}
assertTrue(isTestPassed);
- }
-
+ }
/**
* Test for Test 'body'
*/
// FIXME: I can't find a method of forcing the mime type, so this test
// always fails ...
-// public void testBodyNonText()
-// {
-// boolean isTestPassed = false;
-// String script = "if body :contains [\"wibble\"] {throwTestException;}";
-// try
-// {
-// JUnitUtils.interpret(nonTextMail(), script);
-// }
-// catch (MessagingException e)
-// {
-// }
-// catch (ThrowTestException.TestException e)
-// {
-// }
-// catch (ParseException e)
-// {
-// }
-// catch (SieveException e)
-// {
-// isTestPassed = true;
-// }
-// assertTrue(isTestPassed);
-// }
-
+ // public void testBodyNonText()
+ // {
+ // boolean isTestPassed = false;
+ // String script = "if body :contains [\"wibble\"] {throwTestException;}";
+ // try
+ // {
+ // JUnitUtils.interpret(nonTextMail(), script);
+ // }
+ // catch (MessagingException e)
+ // {
+ // }
+ // catch (ThrowTestException.TestException e)
+ // {
+ // }
+ // catch (ParseException e)
+ // {
+ // }
+ // catch (SieveException e)
+ // {
+ // isTestPassed = true;
+ // }
+ // assertTrue(isTestPassed);
+ // }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org