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 [2/4] - in
/james/jsieve/trunk/src/test/java/org/apache/jsieve: javaxmail/ junit/
parser/address/ samples/james/junit/ util/check/
Modified: james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/ConditionTest.java
URL: http://svn.apache.org/viewvc/james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/ConditionTest.java?rev=578031&r1=578030&r2=578031&view=diff
==============================================================================
--- james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/ConditionTest.java (original)
+++ james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/ConditionTest.java Fri Sep 21 02:22:30 2007
@@ -17,7 +17,6 @@
* under the License. *
****************************************************************/
-
package org.apache.jsieve.junit;
import junit.framework.TestCase;
@@ -32,65 +31,53 @@
import org.apache.jsieve.parser.generated.ParseException;
/**
- * Class <code>ConditionTest</code> tests the conditional commands if, elsif and
- * else.
+ * Class <code>ConditionTest</code> tests the conditional commands if, elsif
+ * and else.
*/
-public class ConditionTest extends TestCase
-{
+public class ConditionTest extends TestCase {
/**
* Constructor for ConditionTest.
+ *
* @param arg0
*/
- public ConditionTest(String arg0)
- {
+ public ConditionTest(String arg0) {
super(arg0);
}
- public static void main(String[] args)
- {
+ public static void main(String[] args) {
junit.swingui.TestRunner.run(ConditionTest.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 Command 'if' with an argument of 'true'
*/
- public void testIfTrue()
- {
+ public void testIfTrue() {
boolean isTestPassed = false;
String script = "if 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);
}
@@ -98,402 +85,273 @@
/**
* Test for Command 'if' with an argument of 'false'
*/
- public void testIfFalse()
- {
+ public void testIfFalse() {
boolean isTestPassed = false;
String script = "if 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 Command 'elsif' with an argument of 'true'
*/
- public void testElsifTrue()
- {
+ public void testElsifTrue() {
boolean isTestPassed = false;
String script = "if false {stop;} elsif 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 Command 'elsif' with an argument of 'false'
*/
- public void testElsifFalse()
- {
+ public void testElsifFalse() {
boolean isTestPassed = false;
String script = "if false {stop;} elsif 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 nested Command 'elsif' with an argument of 'true'
*/
- public void testElsifFalseElsifTrue()
- {
+ public void testElsifFalseElsifTrue() {
boolean isTestPassed = false;
- String script =
- "if false {stop;} elsif false {stop;} elsif true {throwTestException;}";
+ String script = "if false {stop;} elsif false {stop;} elsif 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 Command 'else' after 'elseif'
*/
- public void testElsifFalseElse()
- {
+ public void testElsifFalseElse() {
boolean isTestPassed = false;
String script = "if false {stop;} elsif false {stop;} else {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 Command 'else'
*/
- public void testElse()
- {
+ public void testElse() {
boolean isTestPassed = false;
String script = "if false {stop;} else {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 Command 'else' out of sequence
*/
- public void testOutOfSequenceElse()
- {
+ public void testOutOfSequenceElse() {
boolean isTestPassed = false;
String script = "else {stop;}";
- try
- {
+ try {
JUnitUtils.interpret(JUnitUtils.createMail(), script);
- }
- catch (CommandException e)
- {
+ } catch (CommandException e) {
isTestPassed = true;
- }
- catch (ParseException e)
- {
- }
- catch (SieveException e)
- {
+ } catch (ParseException e) {
+ } catch (SieveException e) {
}
assertTrue(isTestPassed);
}
-
+
/**
* Test for Command 'elsif' out of sequence
*/
- public void testOutOfSequenceElsif()
- {
+ public void testOutOfSequenceElsif() {
boolean isTestPassed = false;
String script = "elsif {stop;}";
- 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);
}
-
+
/**
* Test for Command 'if' without a corresponding Block
*/
- public void testIfMissingBlock()
- {
+ public void testIfMissingBlock() {
boolean isTestPassed = false;
String script = "if true stop;";
- 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);
}
-
+
/**
* Test for Command 'if' without a test
*/
- public void testIfMissingTest()
- {
+ public void testIfMissingTest() {
boolean isTestPassed = false;
String script = "if {stop;}";
- 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);
}
-
+
/**
* Test for Command 'if' without a test
*/
- public void testElsifMissingTest()
- {
+ public void testElsifMissingTest() {
boolean isTestPassed = false;
String script = "if false {stop;} elsif {stop;}";
- 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);
- }
-
+ }
+
/**
* Test for Command 'elsif' without a corresponding Block
*/
- public void testElsifMissingBlock()
- {
+ public void testElsifMissingBlock() {
boolean isTestPassed = false;
String script = "if false {stop;} elsif true stop;";
- 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);
}
-
+
/**
* Test for Command 'else' without a corresponding Block
*/
- public void testElseMissingBlock()
- {
+ public void testElseMissingBlock() {
boolean isTestPassed = false;
String script = "if false {stop;} else stop;";
- 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);
- }
-
+ }
+
/**
* Test for Command 'if' nested in a block
*/
- public void testNestedIf()
- {
+ public void testNestedIf() {
boolean isTestPassed = false;
String script = "if true {if 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 Command 'else' out of sequence nested in a block
*/
- public void testNestedOutOfSequenceElse()
- {
+ public void testNestedOutOfSequenceElse() {
boolean isTestPassed = false;
String script = "if true {else {stop;}}";
- try
- {
+ try {
JUnitUtils.interpret(JUnitUtils.createMail(), script);
- }
- catch (CommandException e)
- {
+ } catch (CommandException e) {
isTestPassed = true;
- }
- catch (ParseException e)
- {
- }
- catch (SieveException e)
- {
+ } catch (ParseException e) {
+ } catch (SieveException e) {
}
assertTrue(isTestPassed);
}
-
+
/**
* Test for Command 'elsif' out of sequence nested in a block
*/
- public void testNestedOutOfSequenceElsif()
- {
+ public void testNestedOutOfSequenceElsif() {
boolean isTestPassed = false;
String script = "if true {elsif true {stop;}}";
- try
- {
+ try {
JUnitUtils.interpret(JUnitUtils.createMail(), script);
- }
- catch (CommandException e)
- {
+ } catch (CommandException 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/ConfigurationManagerTest.java
URL: http://svn.apache.org/viewvc/james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/ConfigurationManagerTest.java?rev=578031&r1=578030&r2=578031&view=diff
==============================================================================
--- james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/ConfigurationManagerTest.java (original)
+++ james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/ConfigurationManagerTest.java Fri Sep 21 02:22:30 2007
@@ -17,7 +17,6 @@
* under the License. *
****************************************************************/
-
package org.apache.jsieve.junit;
import java.util.HashMap;
@@ -32,45 +31,40 @@
/**
* Class ConfigurationManagerTest
*/
-public class ConfigurationManagerTest extends TestCase
-{
+public class ConfigurationManagerTest extends TestCase {
/**
* Constructor for ConfigurationManagerTest.
+ *
* @param arg0
*/
- public ConfigurationManagerTest(String arg0)
- {
+ public ConfigurationManagerTest(String arg0) {
super(arg0);
}
- public static void main(String[] args)
- {
+ public static void main(String[] args) {
junit.swingui.TestRunner.run(ConfigurationManagerTest.class);
}
/**
* @see TestCase#setUp()
*/
- protected void setUp() throws Exception
- {
+ protected void setUp() throws Exception {
super.setUp();
}
/**
* @see TestCase#tearDown()
*/
- protected void tearDown() throws Exception
- {
+ protected void tearDown() throws Exception {
super.tearDown();
}
-
+
/**
- * Test the CommandMap maps 'MUST' and 'SHOULD' be supported commands to the
+ * Test the CommandMap maps 'MUST' and 'SHOULD' be supported commands to the
* correct classes.
*/
- public void testCommandMap()
- {
+ public void testCommandMap() {
Map map = new HashMap();
// Condition Commands
// RFC3082 - Implementations MUST support these:
@@ -80,45 +74,38 @@
map.put("require", "org.apache.jsieve.commands.Require");
map.put("stop", "org.apache.jsieve.commands.Stop");
- // Action Commands
+ // Action Commands
// RFC3082 - Implementations MUST support these:
map.put("keep", "org.apache.jsieve.commands.Keep");
map.put("discard", "org.apache.jsieve.commands.Discard");
map.put("redirect", "org.apache.jsieve.commands.Redirect");
- // RFC3082 - Implementations SHOULD support these:
+ // RFC3082 - Implementations SHOULD support these:
map.put("reject", "org.apache.jsieve.commands.optional.Reject");
map.put("fileinto", "org.apache.jsieve.commands.optional.FileInto");
boolean isTestPassed = false;
- try
- {
+ try {
Map commandMap = ConfigurationManager.getInstance().getCommandMap();
Iterator mapIter = map.entrySet().iterator();
- while (mapIter.hasNext())
- {
+ while (mapIter.hasNext()) {
Map.Entry entry = (Map.Entry) mapIter.next();
- assertTrue(
- "Key: " + entry.getKey(),
- commandMap.containsKey(entry.getKey()));
- assertTrue(
- "Value: " + entry.getValue(),
- commandMap.get(entry.getKey()).equals(entry.getValue()));
+ assertTrue("Key: " + entry.getKey(), commandMap
+ .containsKey(entry.getKey()));
+ assertTrue("Value: " + entry.getValue(), commandMap.get(
+ entry.getKey()).equals(entry.getValue()));
}
isTestPassed = true;
- }
- catch (SieveConfigurationException e)
- {
+ } catch (SieveConfigurationException e) {
}
assertTrue(isTestPassed);
}
-
+
/**
- * Test the TestMap maps 'MUST' and 'SHOULD' be supported tests to the
+ * Test the TestMap maps 'MUST' and 'SHOULD' be supported tests to the
* correct classes.
*/
- public void testTestMap()
- {
+ public void testTestMap() {
Map map = new HashMap();
// RFC3082 - Implementations MUST support these tests:
@@ -136,67 +123,53 @@
map.put("envelope", "org.apache.jsieve.tests.optional.Envelope");
boolean isTestPassed = false;
- try
- {
+ try {
Map testMap = ConfigurationManager.getInstance().getTestMap();
Iterator mapIter = map.entrySet().iterator();
- while (mapIter.hasNext())
- {
+ while (mapIter.hasNext()) {
Map.Entry entry = (Map.Entry) mapIter.next();
- assertTrue(
- "Key: " + entry.getKey(),
- testMap.containsKey(entry.getKey()));
- assertTrue(
- "Value: " + entry.getValue(),
- testMap.get(entry.getKey()).equals(entry.getValue()));
+ assertTrue("Key: " + entry.getKey(), testMap.containsKey(entry
+ .getKey()));
+ assertTrue("Value: " + entry.getValue(), testMap.get(
+ entry.getKey()).equals(entry.getValue()));
}
isTestPassed = true;
- }
- catch (SieveConfigurationException e)
- {
+ } catch (SieveConfigurationException e) {
}
assertTrue(isTestPassed);
- }
-
+ }
+
/**
- * Test the CommparatorMap maps 'MUST' and 'SHOULD' be supported comparators to
- * the correct classes.
+ * Test the CommparatorMap maps 'MUST' and 'SHOULD' be supported comparators
+ * to the correct classes.
*/
- public void testComparatorMap()
- {
+ public void testComparatorMap() {
Map map = new HashMap();
// RFC3082 - Required Comparators
map.put("i;octet", "org.apache.jsieve.comparators.Octet");
- map.put("i;ascii-casemap", "org.apache.jsieve.comparators.AsciiCasemap");
+ map
+ .put("i;ascii-casemap",
+ "org.apache.jsieve.comparators.AsciiCasemap");
boolean isTestPassed = false;
- try
- {
- Map comparatorMap = ConfigurationManager.getInstance().getComparatorMap();
+ try {
+ Map comparatorMap = ConfigurationManager.getInstance()
+ .getComparatorMap();
Iterator mapIter = map.entrySet().iterator();
- while (mapIter.hasNext())
- {
+ while (mapIter.hasNext()) {
Map.Entry entry = (Map.Entry) mapIter.next();
- assertTrue(
- "Key: " + entry.getKey(),
- comparatorMap.containsKey(entry.getKey()));
- assertTrue(
- "Value: " + entry.getValue(),
- comparatorMap.get(entry.getKey()).equals(entry.getValue()));
+ assertTrue("Key: " + entry.getKey(), comparatorMap
+ .containsKey(entry.getKey()));
+ assertTrue("Value: " + entry.getValue(), comparatorMap.get(
+ entry.getKey()).equals(entry.getValue()));
}
isTestPassed = true;
- }
- catch (SieveConfigurationException e)
- {
+ } catch (SieveConfigurationException e) {
}
assertTrue(isTestPassed);
- }
-
-
-
-
+ }
}
Modified: james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/DiscardTest.java
URL: http://svn.apache.org/viewvc/james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/DiscardTest.java?rev=578031&r1=578030&r2=578031&view=diff
==============================================================================
--- james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/DiscardTest.java (original)
+++ james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/DiscardTest.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,123 +32,87 @@
/**
* Class DiscardTest
*/
-public class DiscardTest extends TestCase
-{
+public class DiscardTest extends TestCase {
/**
* Constructor for DiscardTest.
+ *
* @param arg0
*/
- public DiscardTest(String arg0)
- {
+ public DiscardTest(String arg0) {
super(arg0);
}
- public static void main(String[] args)
- {
+ public static void main(String[] args) {
junit.swingui.TestRunner.run(DiscardTest.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 Command 'discard' with invalid arguments
*/
- public void testInvalidArguments()
- {
+ public void testInvalidArguments() {
boolean isTestPassed = false;
String script = "discard 1 ;";
- 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);
}
-
-
/**
* Test for Command 'discard' with an invalid block
*/
- public void testInvalidBlock()
- {
+ public void testInvalidBlock() {
boolean isTestPassed = false;
String script = "discard 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);
- }
-
-
+ }
/*
* Test for Command 'discard'
*/
- public void testDiscard()
- {
+ public void testDiscard() {
boolean isTestPassed = false;
String script = "discard;";
- try
- {
+ try {
MailAdapter mail = JUnitUtils.createMail();
JUnitUtils.interpret(mail, script);
assertTrue(mail.getActions().isEmpty());
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/EnvelopeTest.java
URL: http://svn.apache.org/viewvc/james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/EnvelopeTest.java?rev=578031&r1=578030&r2=578031&view=diff
==============================================================================
--- james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/EnvelopeTest.java (original)
+++ james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/EnvelopeTest.java Fri Sep 21 02:22:30 2007
@@ -17,7 +17,6 @@
* under the License. *
****************************************************************/
-
package org.apache.jsieve.junit;
import junit.framework.TestCase;
@@ -33,801 +32,565 @@
/**
* Class EnvelopeTest
*/
-public class EnvelopeTest extends TestCase
-{
+public class EnvelopeTest extends TestCase {
/**
* Constructor for AddressTest.
+ *
* @param arg0
*/
- public EnvelopeTest(String arg0)
- {
+ public EnvelopeTest(String arg0) {
super(arg0);
}
- public static void main(String[] args)
- {
+ public static void main(String[] args) {
junit.swingui.TestRunner.run(EnvelopeTest.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 'envelope'
*/
- public void testIfEnvelopeAllIsTrue()
- {
+ public void testIfEnvelopeAllIsTrue() {
boolean isTestPassed = false;
String script = "if envelope :all :is \"From\" \"user@domain\" {throwTestException;}";
- try
- {
+ try {
SieveEnvelopeMailAdapter mail = JUnitUtils.createEnvelopeMail();
- mail.setEnvelopeFrom("user@domain");
+ mail.setEnvelopeFrom("user@domain");
JUnitUtils.interpret(mail, 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 'envelope'
*/
- public void testCaseInsensitiveEnvelopeName()
- {
+ public void testCaseInsensitiveEnvelopeName() {
boolean isTestPassed = false;
String script = "if envelope :all :is \"from\" \"user@domain\" {throwTestException;}";
- try
- {
+ try {
SieveEnvelopeMailAdapter mail = JUnitUtils.createEnvelopeMail();
- mail.setEnvelopeFrom("user@domain");
+ mail.setEnvelopeFrom("user@domain");
JUnitUtils.interpret(mail, 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 'envelope'
*/
- public void testOctetComparatorTrue()
- {
+ public void testOctetComparatorTrue() {
boolean isTestPassed = false;
String script = "if envelope :comparator \"i;octet\" :all :is \"From\" \"uSeR@dOmAiN\" {throwTestException;}";
- try
- {
+ try {
SieveEnvelopeMailAdapter mail = JUnitUtils.createEnvelopeMail();
- mail.setEnvelopeFrom("uSeR@dOmAiN");
+ mail.setEnvelopeFrom("uSeR@dOmAiN");
JUnitUtils.interpret(mail, 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 'envelope'
*/
- public void testOctetComparatorFalse()
- {
+ public void testOctetComparatorFalse() {
boolean isTestPassed = false;
String script = "if envelope :comparator \"i;octet\" :all :is \"From\" \"uSeR@dOmAiN\" {throwTestException;}";
- try
- {
+ try {
SieveEnvelopeMailAdapter mail = JUnitUtils.createEnvelopeMail();
- mail.setEnvelopeFrom("user@domain");
+ mail.setEnvelopeFrom("user@domain");
JUnitUtils.interpret(mail, script);
- isTestPassed = true;
- }
- catch (ThrowTestException.TestException e)
- {
- }
- catch (ParseException e)
- {
- }
- catch (SieveException e)
- {
+ isTestPassed = true;
+ } catch (ThrowTestException.TestException e) {
+ } catch (ParseException e) {
+ } catch (SieveException e) {
}
assertTrue(isTestPassed);
- }
-
+ }
+
/**
* Test for Test 'envelope'
*/
- public void testAsciiComparatorTrue()
- {
+ public void testAsciiComparatorTrue() {
boolean isTestPassed = false;
String script = "if envelope :comparator \"i;ascii-casemap\" :all :is \"From\" \"uSeR@dOmAiN\" {throwTestException;}";
- try
- {
+ try {
SieveEnvelopeMailAdapter mail = JUnitUtils.createEnvelopeMail();
- mail.setEnvelopeFrom("user@domain");
+ mail.setEnvelopeFrom("user@domain");
JUnitUtils.interpret(mail, 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 'envelope'
*/
- public void testAsciiComparatorFalse()
- {
+ public void testAsciiComparatorFalse() {
boolean isTestPassed = false;
String script = "if envelope :comparator \"i;ascii-casemap\" :all :is \"From\" \"uSeR@dOmAiN\" {throwTestException;}";
- try
- {
+ try {
SieveEnvelopeMailAdapter mail = JUnitUtils.createEnvelopeMail();
mail.setEnvelopeFrom("user@domain1");
- JUnitUtils.interpret(mail, script);
- isTestPassed = true;
- }
- catch (ThrowTestException.TestException e)
- {
- }
- catch (ParseException e)
- {
- }
- catch (SieveException e)
- {
+ JUnitUtils.interpret(mail, script);
+ isTestPassed = true;
+ } catch (ThrowTestException.TestException e) {
+ } catch (ParseException e) {
+ } catch (SieveException e) {
}
assertTrue(isTestPassed);
- }
-
+ }
+
/**
* Test for Test 'envelope'
*/
- public void testIfEnvelopeAllIsMultiTrue1()
- {
+ public void testIfEnvelopeAllIsMultiTrue1() {
boolean isTestPassed = false;
String script = "if envelope :all :is [\"From\", \"To\"] \"user@domain\" {throwTestException;}";
- try
- {
+ try {
SieveEnvelopeMailAdapter mail = JUnitUtils.createEnvelopeMail();
mail.setEnvelopeFrom("user@domain");
- mail.setEnvelopeTo("user@domain");
+ mail.setEnvelopeTo("user@domain");
JUnitUtils.interpret(mail, 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 'envelope'
*/
- public void testIfEnvelopeAllIsMultiTrue2()
- {
+ public void testIfEnvelopeAllIsMultiTrue2() {
boolean isTestPassed = false;
String script = "if envelope :all :is [\"From\", \"To\"] [\"user@domain\", \"tweety@pie\"] {throwTestException;}";
- try
- {
+ try {
SieveEnvelopeMailAdapter mail = JUnitUtils.createEnvelopeMail();
mail.setEnvelopeFrom("user@domain");
- mail.setEnvelopeTo("user@domain");
+ mail.setEnvelopeTo("user@domain");
JUnitUtils.interpret(mail, 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 'envelope'
*/
- public void testIfEnvelopeAllIsMultiTrue3()
- {
+ public void testIfEnvelopeAllIsMultiTrue3() {
boolean isTestPassed = false;
String script = "if envelope :all :is [\"From\", \"To\"] [\"user@domain\", \"tweety@pie\"] {throwTestException;}";
- try
- {
+ try {
SieveEnvelopeMailAdapter mail = JUnitUtils.createEnvelopeMail();
mail.setEnvelopeFrom("user@domain");
- mail.setEnvelopeTo("tweety@pie");
+ mail.setEnvelopeTo("tweety@pie");
JUnitUtils.interpret(mail, 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 'envelope'
*/
- public void testIfEnvelopeAllIsMultiTrue4()
- {
+ public void testIfEnvelopeAllIsMultiTrue4() {
boolean isTestPassed = false;
String script = "if envelope :all :is [\"From\", \"To\"] [\"user@domain\", \"tweety@pie\"] {throwTestException;}";
- try
- {
+ try {
SieveEnvelopeMailAdapter mail = JUnitUtils.createEnvelopeMail();
mail.setEnvelopeFrom("tweety@pie");
- mail.setEnvelopeTo("tweety@pie");
- JUnitUtils.interpret(mail, script);
- }
- catch (ThrowTestException.TestException e)
- {
+ mail.setEnvelopeTo("tweety@pie");
+ JUnitUtils.interpret(mail, script);
+ } catch (ThrowTestException.TestException e) {
isTestPassed = true;
- }
- catch (ParseException e)
- {
- }
- catch (SieveException e)
- {
+ } catch (ParseException e) {
+ } catch (SieveException e) {
}
assertTrue(isTestPassed);
- }
-
+ }
+
/**
* Test for Test 'envelope'
*/
- public void testIfEnvelopeAllMatchesTrue()
- {
+ public void testIfEnvelopeAllMatchesTrue() {
boolean isTestPassed = false;
String script = "if envelope :all :matches \"From\" \"*@domain\" {throwTestException;}";
- try
- {
+ try {
SieveEnvelopeMailAdapter mail = JUnitUtils.createEnvelopeMail();
- mail.setEnvelopeFrom("user@domain");
+ mail.setEnvelopeFrom("user@domain");
JUnitUtils.interpret(mail, 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 'envelope'
*/
- public void testIfEnvelopeAllContainsTrue()
- {
+ public void testIfEnvelopeAllContainsTrue() {
boolean isTestPassed = false;
String script = "if envelope :all :contains \"From\" \"r@dom\" {throwTestException;}";
- try
- {
+ try {
SieveEnvelopeMailAdapter mail = JUnitUtils.createEnvelopeMail();
- mail.setEnvelopeFrom("user@domain");
+ mail.setEnvelopeFrom("user@domain");
JUnitUtils.interpret(mail, 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 'envelope'
*/
- public void testIfEnvelopeLocalpartIsTrue()
- {
+ public void testIfEnvelopeLocalpartIsTrue() {
boolean isTestPassed = false;
String script = "if envelope :localpart :is \"From\" \"user\" {throwTestException;}";
- try
- {
+ try {
SieveEnvelopeMailAdapter mail = JUnitUtils.createEnvelopeMail();
- mail.setEnvelopeFrom("user@domain");
+ mail.setEnvelopeFrom("user@domain");
JUnitUtils.interpret(mail, 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 'envelope'
*/
- public void testIfEnvelopeLocalpartMatchesTrue()
- {
+ public void testIfEnvelopeLocalpartMatchesTrue() {
boolean isTestPassed = false;
String script = "if envelope :localpart :matches \"From\" \"*er\" {throwTestException;}";
- try
- {
+ try {
SieveEnvelopeMailAdapter mail = JUnitUtils.createEnvelopeMail();
- mail.setEnvelopeFrom("user@domain");
+ mail.setEnvelopeFrom("user@domain");
JUnitUtils.interpret(mail, 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 'envelope'
*/
- public void testIfEnvelopeLocalpartContainsTrue()
- {
+ public void testIfEnvelopeLocalpartContainsTrue() {
boolean isTestPassed = false;
String script = "if envelope :localpart :contains \"From\" \"r\" {throwTestException;}";
- try
- {
+ try {
SieveEnvelopeMailAdapter mail = JUnitUtils.createEnvelopeMail();
- mail.setEnvelopeFrom("user@domain");
+ mail.setEnvelopeFrom("user@domain");
JUnitUtils.interpret(mail, 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 'envelope'
*/
- public void testIfEnvelopeDomainIsTrue()
- {
+ public void testIfEnvelopeDomainIsTrue() {
boolean isTestPassed = false;
String script = "if envelope :domain :is \"From\" \"domain\" {throwTestException;}";
- try
- {
+ try {
SieveEnvelopeMailAdapter mail = JUnitUtils.createEnvelopeMail();
- mail.setEnvelopeFrom("user@domain");
+ mail.setEnvelopeFrom("user@domain");
JUnitUtils.interpret(mail, 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 'envelope'
*/
- public void testIfEnvelopeDomainMatchesTrue()
- {
+ public void testIfEnvelopeDomainMatchesTrue() {
boolean isTestPassed = false;
String script = "if envelope :domain :matches \"From\" \"*main\" {throwTestException;}";
- try
- {
+ try {
SieveEnvelopeMailAdapter mail = JUnitUtils.createEnvelopeMail();
- mail.setEnvelopeFrom("user@domain");
+ mail.setEnvelopeFrom("user@domain");
JUnitUtils.interpret(mail, 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 'envelope'
*/
- public void testIfEnvelopeDomainContainsTrue()
- {
+ public void testIfEnvelopeDomainContainsTrue() {
boolean isTestPassed = false;
String script = "if envelope :domain :contains \"From\" \"dom\" {throwTestException;}";
- try
- {
+ try {
SieveEnvelopeMailAdapter mail = JUnitUtils.createEnvelopeMail();
- mail.setEnvelopeFrom("user@domain");
+ mail.setEnvelopeFrom("user@domain");
JUnitUtils.interpret(mail, 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 'envelope'
*/
- public void testIfEnvelopeAllIsFalse()
- {
+ public void testIfEnvelopeAllIsFalse() {
boolean isTestPassed = false;
String script = "if envelope :all :is \"From\" \"user@domain\" {throwTestException;}";
- try
- {
+ try {
SieveEnvelopeMailAdapter mail = JUnitUtils.createEnvelopeMail();
- mail.setEnvelopeFrom("tweety@pie");
+ mail.setEnvelopeFrom("tweety@pie");
JUnitUtils.interpret(mail, script);
- isTestPassed = true;
- }
- catch (ThrowTestException.TestException e)
- {
- }
- catch (ParseException e)
- {
- }
- catch (SieveException e)
- {
+ isTestPassed = true;
+ } catch (ThrowTestException.TestException e) {
+ } catch (ParseException e) {
+ } catch (SieveException e) {
}
assertTrue(isTestPassed);
}
-
+
/**
* Test for Test 'envelope'
*/
- public void testIfEnvelopeAllMatchesFalse()
- {
+ public void testIfEnvelopeAllMatchesFalse() {
boolean isTestPassed = false;
String script = "if envelope :all :matches \"From\" \"(.*)@domain\" {throwTestException;}";
- try
- {
+ try {
SieveEnvelopeMailAdapter mail = JUnitUtils.createEnvelopeMail();
- mail.setEnvelopeFrom("bugs@bunny");
+ mail.setEnvelopeFrom("bugs@bunny");
JUnitUtils.interpret(mail, script);
- isTestPassed = true;
- }
- catch (ThrowTestException.TestException e)
- {
- }
- catch (ParseException e)
- {
- }
- catch (SieveException e)
- {
+ isTestPassed = true;
+ } catch (ThrowTestException.TestException e) {
+ } catch (ParseException e) {
+ } catch (SieveException e) {
}
assertTrue(isTestPassed);
- }
-
+ }
+
/**
* Test for Test 'envelope'
*/
- public void testIfEnvelopeAllContainsFalse()
- {
+ public void testIfEnvelopeAllContainsFalse() {
boolean isTestPassed = false;
String script = "if envelope :all :contains \"From\" \"r@dom\" {throwTestException;}";
- try
- {
+ try {
SieveEnvelopeMailAdapter mail = JUnitUtils.createEnvelopeMail();
- mail.setEnvelopeFrom("tweety@pie");
+ mail.setEnvelopeFrom("tweety@pie");
JUnitUtils.interpret(mail, script);
- isTestPassed = true;
- }
- catch (ThrowTestException.TestException e)
- {
- }
- catch (ParseException e)
- {
- }
- catch (SieveException e)
- {
+ isTestPassed = true;
+ } catch (ThrowTestException.TestException e) {
+ } catch (ParseException e) {
+ } catch (SieveException e) {
}
assertTrue(isTestPassed);
- }
-
+ }
+
/**
* Test for Test 'envelope'
*/
- public void testIfEnvelopeLocalpartIsFalse()
- {
+ public void testIfEnvelopeLocalpartIsFalse() {
boolean isTestPassed = false;
String script = "if envelope :localpart :is \"From\" \"user\" {throwTestException;}";
- try
- {
+ try {
SieveEnvelopeMailAdapter mail = JUnitUtils.createEnvelopeMail();
- mail.setEnvelopeFrom("tweety@pie");
+ mail.setEnvelopeFrom("tweety@pie");
JUnitUtils.interpret(mail, script);
- isTestPassed = true;
- }
- catch (ThrowTestException.TestException e)
- {
- }
- catch (ParseException e)
- {
- }
- catch (SieveException e)
- {
+ isTestPassed = true;
+ } catch (ThrowTestException.TestException e) {
+ } catch (ParseException e) {
+ } catch (SieveException e) {
}
assertTrue(isTestPassed);
}
-
+
/**
* Test for Test 'envelope'
*/
- public void testIfEnvelopeLocalpartMatchesFalse()
- {
+ public void testIfEnvelopeLocalpartMatchesFalse() {
boolean isTestPassed = false;
String script = "if envelope :localpart :matches \"From\" \"(.*)er\" {throwTestException;}";
- try
- {
+ try {
SieveEnvelopeMailAdapter mail = JUnitUtils.createEnvelopeMail();
- mail.setEnvelopeFrom("tweety@pie");
+ mail.setEnvelopeFrom("tweety@pie");
JUnitUtils.interpret(mail, script);
- isTestPassed = true;
- }
- catch (ThrowTestException.TestException e)
- {
- }
- catch (ParseException e)
- {
- }
- catch (SieveException e)
- {
+ isTestPassed = true;
+ } catch (ThrowTestException.TestException e) {
+ } catch (ParseException e) {
+ } catch (SieveException e) {
}
assertTrue(isTestPassed);
- }
-
+ }
+
/**
* Test for Test 'envelope'
*/
- public void testIfEnvelopeLocalpartContainsFalse()
- {
+ public void testIfEnvelopeLocalpartContainsFalse() {
boolean isTestPassed = false;
String script = "if envelope :localpart :contains \"From\" \"r\" {throwTestException;}";
- try
- {
+ try {
SieveEnvelopeMailAdapter mail = JUnitUtils.createEnvelopeMail();
- mail.setEnvelopeFrom("tweety@pie");
+ mail.setEnvelopeFrom("tweety@pie");
JUnitUtils.interpret(mail, script);
- isTestPassed = true;
- }
- catch (ThrowTestException.TestException e)
- {
- }
- catch (ParseException e)
- {
- }
- catch (SieveException e)
- {
+ isTestPassed = true;
+ } catch (ThrowTestException.TestException e) {
+ } catch (ParseException e) {
+ } catch (SieveException e) {
}
assertTrue(isTestPassed);
- }
-
+ }
+
/**
* Test for Test 'envelope'
*/
- public void testIfEnvelopeDomainIsFalse()
- {
+ public void testIfEnvelopeDomainIsFalse() {
boolean isTestPassed = false;
String script = "if envelope :domain :is \"From\" \"domain\" {throwTestException;}";
- try
- {
+ try {
SieveEnvelopeMailAdapter mail = JUnitUtils.createEnvelopeMail();
- mail.setEnvelopeFrom("tweety@pie");
+ mail.setEnvelopeFrom("tweety@pie");
JUnitUtils.interpret(mail, script);
- isTestPassed = true;
- }
- catch (ThrowTestException.TestException e)
- {
- }
- catch (ParseException e)
- {
- }
- catch (SieveException e)
- {
+ isTestPassed = true;
+ } catch (ThrowTestException.TestException e) {
+ } catch (ParseException e) {
+ } catch (SieveException e) {
}
assertTrue(isTestPassed);
}
-
+
/**
* Test for Test 'envelope'
*/
- public void testIfEnvelopeDomainMatchesFalse()
- {
+ public void testIfEnvelopeDomainMatchesFalse() {
boolean isTestPassed = false;
String script = "if envelope :domain :matches \"From\" \"(.*)main\" {throwTestException;}";
- try
- {
+ try {
SieveEnvelopeMailAdapter mail = JUnitUtils.createEnvelopeMail();
- mail.setEnvelopeFrom("tweety@pie");
+ mail.setEnvelopeFrom("tweety@pie");
JUnitUtils.interpret(mail, script);
- isTestPassed = true;
- }
- catch (ThrowTestException.TestException e)
- {
- }
- catch (ParseException e)
- {
- }
- catch (SieveException e)
- {
+ isTestPassed = true;
+ } catch (ThrowTestException.TestException e) {
+ } catch (ParseException e) {
+ } catch (SieveException e) {
}
assertTrue(isTestPassed);
- }
-
+ }
+
/**
* Test for Test 'envelope'
*/
- public void testIfEnvelopeDomainContainsFalse()
- {
+ public void testIfEnvelopeDomainContainsFalse() {
boolean isTestPassed = false;
String script = "if envelope :domain :contains \"From\" \"dom\" {throwTestException;}";
- try
- {
+ try {
SieveEnvelopeMailAdapter mail = JUnitUtils.createEnvelopeMail();
- mail.setEnvelopeFrom("tweety@pie");
+ mail.setEnvelopeFrom("tweety@pie");
JUnitUtils.interpret(mail, script);
- isTestPassed = true;
- }
- catch (ThrowTestException.TestException e)
- {
- }
- catch (ParseException e)
- {
- }
- catch (SieveException e)
- {
+ isTestPassed = true;
+ } catch (ThrowTestException.TestException e) {
+ } catch (ParseException e) {
+ } catch (SieveException e) {
}
assertTrue(isTestPassed);
}
-
+
/**
* Test for Test 'envelope'
*/
- public void testIfEnvelopeAllIsMultiFalse1()
- {
+ public void testIfEnvelopeAllIsMultiFalse1() {
boolean isTestPassed = false;
String script = "if envelope :all :is [\"From\", \"To\"] \"user@domain\" {throwTestException;}";
- try
- {
+ try {
SieveEnvelopeMailAdapter mail = JUnitUtils.createEnvelopeMail();
mail.setEnvelopeFrom("bugs@bunny");
- mail.setEnvelopeTo("bugs@bunny");
+ mail.setEnvelopeTo("bugs@bunny");
JUnitUtils.interpret(mail, script);
- isTestPassed = true;
- }
- catch (ThrowTestException.TestException e)
- {
- }
- catch (ParseException e)
- {
- }
- catch (SieveException e)
- {
+ isTestPassed = true;
+ } catch (ThrowTestException.TestException e) {
+ } catch (ParseException e) {
+ } catch (SieveException e) {
}
assertTrue(isTestPassed);
- }
-
+ }
+
/**
* Test for Test 'envelope'
*/
- public void testIfEnvelopeAllIsMultiFalse2()
- {
+ public void testIfEnvelopeAllIsMultiFalse2() {
boolean isTestPassed = false;
String script = "if envelope :all :is [\"From\", \"To\"] [\"user@domain\", \"tweety@pie\"] {throwTestException;}";
- try
- {
+ try {
SieveEnvelopeMailAdapter mail = JUnitUtils.createEnvelopeMail();
mail.setEnvelopeFrom("bugs@bunny");
- mail.setEnvelopeTo("bugs@bunny");
+ mail.setEnvelopeTo("bugs@bunny");
JUnitUtils.interpret(mail, script);
- isTestPassed = true;
- }
- catch (ThrowTestException.TestException e)
- {
- }
- catch (ParseException e)
- {
- }
- catch (SieveException e)
- {
+ isTestPassed = true;
+ } catch (ThrowTestException.TestException e) {
+ } catch (ParseException e) {
+ } catch (SieveException e) {
}
assertTrue(isTestPassed);
}
-
- }
+
+}
Modified: james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/ExistsTest.java
URL: http://svn.apache.org/viewvc/james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/ExistsTest.java?rev=578031&r1=578030&r2=578031&view=diff
==============================================================================
--- james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/ExistsTest.java (original)
+++ james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/ExistsTest.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,262 +34,185 @@
/**
* Class ExistsTest
*/
-public class ExistsTest extends TestCase
-{
+public class ExistsTest extends TestCase {
/**
* Constructor for TrueTest.
+ *
* @param arg0
*/
- public ExistsTest(String arg0)
- {
+ public ExistsTest(String arg0) {
super(arg0);
}
- public static void main(String[] args)
- {
+ public static void main(String[] args) {
junit.swingui.TestRunner.run(ExistsTest.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 'exists'
*/
- public void testExistsTrue()
- {
+ public void testExistsTrue() {
boolean isTestPassed = false;
String script = "if exists \"From\" {throwTestException;}";
- try
- {
+ try {
SieveMailAdapter mail = (SieveMailAdapter) JUnitUtils.createMail();
mail.getMessage().addHeader("From", "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 'exists'
*/
- public void testCaseInsensitivity()
- {
+ public void testCaseInsensitivity() {
boolean isTestPassed = false;
String script = "if exists \"From\" {throwTestException;}";
- try
- {
+ try {
SieveMailAdapter mail = (SieveMailAdapter) JUnitUtils.createMail();
mail.getMessage().addHeader("from", "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 'exists'
*/
- public void testExistsTrueTrue()
- {
+ public void testExistsTrueTrue() {
boolean isTestPassed = false;
String script = "if exists [\"From\", \"X-Files\"] {throwTestException;}";
- try
- {
+ try {
SieveMailAdapter mail = (SieveMailAdapter) JUnitUtils.createMail();
mail.getMessage().addHeader("From", "tweety@pie");
- mail.getMessage().addHeader("X-Files", "spooks@everywhere");
+ mail.getMessage().addHeader("X-Files", "spooks@everywhere");
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 'exists'
*/
- public void testExistsTrueFalse()
- {
+ public void testExistsTrueFalse() {
boolean isTestPassed = false;
- String script =
- "if exists [\"From\", \"X-Files\"] {stop;} throwTestException;";
- try
- {
+ String script = "if exists [\"From\", \"X-Files\"] {stop;} throwTestException;";
+ try {
SieveMailAdapter mail = (SieveMailAdapter) JUnitUtils.createMail();
mail.getMessage().addHeader("From", "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 'exists'
*/
- public void testExistsFalse()
- {
+ public void testExistsFalse() {
boolean isTestPassed = false;
String script = "if exists \"From\" {stop;} throwTestException;";
- try
- {
+ try {
SieveMailAdapter mail = (SieveMailAdapter) JUnitUtils.createMail();
JUnitUtils.interpret(mail, 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 'exists'
*/
- public void testExistsFalseFalse()
- {
+ public void testExistsFalseFalse() {
boolean isTestPassed = false;
String script = "if exists [\"From\", \"X-Files\"] {stop;} throwTestException;";
- try
- {
+ try {
SieveMailAdapter mail = (SieveMailAdapter) JUnitUtils.createMail();
JUnitUtils.interpret(mail, 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 'exists' with invalid numeric argument
*/
- public void testInvalidNumericArgument()
- {
+ public void testInvalidNumericArgument() {
boolean isTestPassed = false;
String script = "if exists 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);
}
-
+
/**
* Test for Test 'exists' with invalid test argument
*/
- public void testInvalidTestArgument()
- {
+ public void testInvalidTestArgument() {
boolean isTestPassed = false;
String script = "if exists not {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/FalseTest.java
URL: http://svn.apache.org/viewvc/james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/FalseTest.java?rev=578031&r1=578030&r2=578031&view=diff
==============================================================================
--- james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/FalseTest.java (original)
+++ james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/FalseTest.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,89 +32,69 @@
/**
* Class FalseTest
*/
-public class FalseTest extends TestCase
-{
+public class FalseTest extends TestCase {
/**
* Constructor for TrueTest.
+ *
* @param arg0
*/
- public FalseTest(String arg0)
- {
+ public FalseTest(String arg0) {
super(arg0);
}
- public static void main(String[] args)
- {
+ public static void main(String[] args) {
junit.swingui.TestRunner.run(FalseTest.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 'true'
*/
- public void testIfFalse()
- {
+ public void testIfFalse() {
boolean isTestPassed = false;
String script = "if 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 'true' with invalid argument
*/
- public void testInvalidArgument()
- {
+ public void testInvalidArgument() {
boolean isTestPassed = false;
String script = "if false 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/FileIntoTest.java
URL: http://svn.apache.org/viewvc/james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/FileIntoTest.java?rev=578031&r1=578030&r2=578031&view=diff
==============================================================================
--- james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/FileIntoTest.java (original)
+++ james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/FileIntoTest.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;
@@ -34,196 +33,132 @@
/**
* Class FileIntoTest
*/
-public class FileIntoTest extends TestCase
-{
+public class FileIntoTest extends TestCase {
/**
* Constructor for FileIntoTest.
+ *
* @param arg0
*/
- public FileIntoTest(String arg0)
- {
+ public FileIntoTest(String arg0) {
super(arg0);
}
- public static void main(String[] args)
- {
+ public static void main(String[] args) {
junit.swingui.TestRunner.run(FileIntoTest.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 Command 'fileinto'
*/
- public void testFileInto()
- {
+ public void testFileInto() {
boolean isTestPassed = false;
String script = "fileinto \"INBOX.test1\"; fileinto \"INBOX.test2\";";
- try
- {
+ try {
MailAdapter mail = JUnitUtils.createMail();
JUnitUtils.interpret(mail, script);
assertTrue(mail.getActions().size() == 2);
assertTrue(mail.getActions().get(0) instanceof ActionFileInto);
- assertTrue(
- ((ActionFileInto) mail.getActions().get(0))
- .getDestination()
- .equals(
- "INBOX.test1"));
+ assertTrue(((ActionFileInto) mail.getActions().get(0))
+ .getDestination().equals("INBOX.test1"));
assertTrue(mail.getActions().get(1) instanceof ActionFileInto);
- assertTrue(
- ((ActionFileInto) mail.getActions().get(1))
- .getDestination()
- .equals(
- "INBOX.test2"));
+ assertTrue(((ActionFileInto) mail.getActions().get(1))
+ .getDestination().equals("INBOX.test2"));
isTestPassed = true;
- }
- catch (ParseException e)
- {
- }
- catch (SieveException e)
- {
+ } catch (ParseException e) {
+ } catch (SieveException e) {
}
assertTrue(isTestPassed);
}
/**
- * Test for Command 'fileinto' with duplicate destinations.
- * Only one ActionFileInto should result.
+ * Test for Command 'fileinto' with duplicate destinations. Only one
+ * ActionFileInto should result.
*/
- public void testDuplicateFileInto()
- {
+ public void testDuplicateFileInto() {
boolean isTestPassed = false;
String script = "fileinto \"INBOX.test1\"; fileinto \"INBOX.test1\";";
- try
- {
+ try {
MailAdapter mail = JUnitUtils.createMail();
JUnitUtils.interpret(mail, script);
assertTrue(mail.getActions().size() == 1);
assertTrue(mail.getActions().get(0) instanceof ActionFileInto);
- assertTrue(
- ((ActionFileInto) mail.getActions().get(0))
- .getDestination()
- .equals(
- "INBOX.test1"));
+ assertTrue(((ActionFileInto) mail.getActions().get(0))
+ .getDestination().equals("INBOX.test1"));
isTestPassed = true;
- }
- catch (ParseException e)
- {
- }
- catch (SieveException e)
- {
+ } catch (ParseException e) {
+ } catch (SieveException e) {
}
assertTrue(isTestPassed);
}
-
-
-
-
-
-
-
/**
* Test for Command 'fileinto' with an invalid argument type
*/
- public void testInvalidArgumentType()
- {
+ public void testInvalidArgumentType() {
boolean isTestPassed = false;
String script = "fileinto 1 ;";
- 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);
}
-
+
/**
* Test for Command 'fileinto' with an invalid argument number
*/
- public void testInvalidArgumentNumber()
- {
+ public void testInvalidArgumentNumber() {
boolean isTestPassed = false;
String script = "fileinto [\"INBOX.test\", \"elsewhere\"];";
- 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);
- }
-
-
-
+ }
/**
* Test for Command 'fileinto' with an invalid block
*/
- public void testInvalidBlock()
- {
+ public void testInvalidBlock() {
boolean isTestPassed = false;
String script = "fileinto 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);
- }
-
-
-
-
-
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org