JUNIT-92 Moved all tests to junit-4
git-svn-id: https://svn.apache.org/repos/asf/james/jsieve/trunk@1425738 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/core/src/main/java/org/apache/jsieve/BaseSieveContext.java b/core/src/main/java/org/apache/jsieve/BaseSieveContext.java
index 3949f1d..8edc597 100644
--- a/core/src/main/java/org/apache/jsieve/BaseSieveContext.java
+++ b/core/src/main/java/org/apache/jsieve/BaseSieveContext.java
@@ -23,7 +23,6 @@
/**
* Bean based implementation of context.
- *
*/
public class BaseSieveContext extends SieveContext {
@@ -42,8 +41,8 @@
private final Log log;
public BaseSieveContext(final CommandManager commandManager,
- final ComparatorManager comparatorManager,
- final TestManager testManager, final Log log) {
+ final ComparatorManager comparatorManager,
+ final TestManager testManager, final Log log) {
this.commandStateManager = new CommandStateManager();
this.conditionManager = new ConditionManager();
this.testManager = testManager;
@@ -54,7 +53,7 @@
/**
* Gets the script position of the current operation.
- *
+ *
* @return <code>ScriptCoordinate</code>, not null
*/
@Override
@@ -64,9 +63,8 @@
/**
* Sets the script position of the current operation.
- *
- * @param coordinate
- * <code>ScriptCoordinate</code>, not null
+ *
+ * @param coordinate <code>ScriptCoordinate</code>, not null
*/
@Override
public void setCoordinate(ScriptCoordinate coordinate) {
@@ -131,6 +129,4 @@
public TestManager getTestManager() {
return testManager;
}
-
-
}
diff --git a/core/src/test/java/org/apache/jsieve/AddressParseTest.java b/core/src/test/java/org/apache/jsieve/AddressParseTest.java
index c4c4527..4d6e405 100644
--- a/core/src/test/java/org/apache/jsieve/AddressParseTest.java
+++ b/core/src/test/java/org/apache/jsieve/AddressParseTest.java
@@ -19,15 +19,15 @@
package org.apache.jsieve;
-import junit.framework.TestCase;
-
import org.apache.commons.logging.LogFactory;
-import org.apache.jsieve.BaseSieveContext;
-import org.apache.jsieve.ConfigurationManager;
import org.apache.jsieve.utils.JUnitUtils;
import org.apache.jsieve.utils.SieveMailAdapter;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import org.junit.Before;
+import org.junit.Test;
-public class AddressParseTest extends TestCase {
+public class AddressParseTest {
private static final String MULTIPLE_ADDRESS_VALUES = "coyote@desert.example.org, bugs@example.org, elmer@hunters.example.org";
@@ -39,18 +39,19 @@
OpenedAddress address;
- protected void setUp() throws Exception {
- super.setUp();
+ @Before
+ public void setUp() throws Exception {
ConfigurationManager configurationManager = new ConfigurationManager();
context = new BaseSieveContext(
configurationManager.getCommandManager(), configurationManager
- .getComparatorManager(), configurationManager
- .getTestManager(), LogFactory
- .getLog(AddressParseTest.class));
+ .getComparatorManager(), configurationManager
+ .getTestManager(), LogFactory
+ .getLog(AddressParseTest.class));
mail = (SieveMailAdapter) JUnitUtils.createMail();
address = new OpenedAddress();
}
+ @Test
public void testSingleAddress() throws Exception {
mail.getMessage().addHeader("From", SOLO_ADDRESS_VALUES);
assertTrue(address.match(mail, ":all", "i;ascii-casemap", ":is",
@@ -63,6 +64,7 @@
"from", "roadrunner@example.org", context));
}
+ @Test
public void testMultipleAddresses() throws Exception {
mail.getMessage().addHeader("From", MULTIPLE_ADDRESS_VALUES);
assertTrue(address.match(mail, ":all", "i;ascii-casemap", ":is",
diff --git a/core/src/test/java/org/apache/jsieve/AddressTest.java b/core/src/test/java/org/apache/jsieve/AddressTest.java
index 5387fcd..51991c8 100644
--- a/core/src/test/java/org/apache/jsieve/AddressTest.java
+++ b/core/src/test/java/org/apache/jsieve/AddressTest.java
@@ -19,24 +19,22 @@
package org.apache.jsieve;
-import javax.mail.MessagingException;
-
-import junit.framework.TestCase;
-
import org.apache.jsieve.commands.ThrowTestException;
import org.apache.jsieve.exception.SieveException;
import org.apache.jsieve.parser.generated.ParseException;
import org.apache.jsieve.utils.JUnitUtils;
import org.apache.jsieve.utils.SieveMailAdapter;
+import org.junit.Assert;
+import org.junit.Test;
+
+import javax.mail.MessagingException;
/**
* Class AddressTest
*/
-public class AddressTest extends TestCase {
+public class AddressTest {
- /**
- * Test for Test 'address'
- */
+ @Test
public void testIfAddressAllIsTrue() {
boolean isTestPassed = false;
String script = "if address :all :is \"From\" \"user@domain\" {throwTestException;}";
@@ -50,12 +48,10 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
- /**
- * Test for Test 'address'
- */
+ @Test
public void testCaseInsensitiveHeaderName() {
boolean isTestPassed = false;
String script = "if address :all :is \"from\" \"user@domain\" {throwTestException;}";
@@ -69,12 +65,10 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
- /**
- * Test for Test 'address'
- */
+ @Test
public void testTreatmentOfEmbededSpacesInHeaderName() {
boolean isTestPassed = false;
String script = "if address :all :is \"From\" \"user@domain\" {throwTestException;}";
@@ -88,12 +82,10 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
- /**
- * Test for Test 'address'
- */
+ @Test
public void testOctetComparatorTrue() {
boolean isTestPassed = false;
String script = "if address :comparator \"i;octet\" :all :is \"From\" \"uSeR@dOmAiN\" {throwTestException;}";
@@ -107,12 +99,10 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
- /**
- * Test for Test 'address'
- */
+ @Test
public void testOctetComparatorFalse() {
boolean isTestPassed = false;
String script = "if address :comparator \"i;octet\" :all :is \"From\" \"uSeR@dOmAiN\" {throwTestException;}";
@@ -126,12 +116,10 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
- /**
- * Test for Test 'address'
- */
+ @Test
public void testAsciiComparatorTrue() {
boolean isTestPassed = false;
String script = "if address :comparator \"i;ascii-casemap\" :all :is \"From\" \"uSeR@dOmAiN\" {throwTestException;}";
@@ -145,12 +133,10 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
- /**
- * Test for Test 'address'
- */
+ @Test
public void testAsciiComparatorFalse() {
boolean isTestPassed = false;
String script = "if address :comparator \"i;ascii-casemap\" :all :is \"From\" \"uSeR@dOmAiN\" {throwTestException;}";
@@ -164,12 +150,10 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
- /**
- * Test for Test 'address'
- */
+ @Test
public void testIfAddressAllIsMultiTrue1() {
boolean isTestPassed = false;
String script = "if address :all :is [\"From\", \"To\"] \"user@domain\" {throwTestException;}";
@@ -184,12 +168,10 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
- /**
- * Test for Test 'address'
- */
+ @Test
public void testIfAddressAllIsMultiTrue2() {
boolean isTestPassed = false;
String script = "if address :all :is [\"From\", \"To\"] [\"user@domain\", \"tweety@pie\"] {throwTestException;}";
@@ -204,12 +186,10 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
- /**
- * Test for Test 'address'
- */
+ @Test
public void testIfAddressAllIsMultiTrue3() {
boolean isTestPassed = false;
String script = "if address :all :is [\"From\", \"To\"] [\"user@domain\", \"tweety@pie\"] {throwTestException;}";
@@ -224,12 +204,10 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
- /**
- * Test for Test 'address'
- */
+ @Test
public void testIfAddressAllIsMultiTrue4() {
boolean isTestPassed = false;
String script = "if address :all :is [\"From\", \"To\"] [\"user@domain\", \"tweety@pie\"] {throwTestException;}";
@@ -244,12 +222,10 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
- /**
- * Test for Test 'address'
- */
+ @Test
public void testIfAddressAllMatchesTrue() {
boolean isTestPassed = false;
String script = "if address :all :matches \"From\" \"*@domain\" {throwTestException;}";
@@ -263,12 +239,10 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
- /**
- * Test for Test 'address'
- */
+ @Test
public void testIfAddressAllContainsTrue() {
boolean isTestPassed = false;
String script = "if address :all :contains \"From\" \"r@dom\" {throwTestException;}";
@@ -282,12 +256,10 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
- /**
- * Test for Test 'address'
- */
+ @Test
public void testIfAddressLocalpartIsTrue() {
boolean isTestPassed = false;
String script = "if address :localpart :is \"From\" \"user\" {throwTestException;}";
@@ -301,12 +273,10 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
- /**
- * Test for Test 'address'
- */
+ @Test
public void testIfAddressLocalpartMatchesTrue() {
boolean isTestPassed = false;
String script = "if address :localpart :matches \"From\" \"*er\" {throwTestException;}";
@@ -320,12 +290,10 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
- /**
- * Test for Test 'address'
- */
+ @Test
public void testIfAddressLocalpartContainsTrue() {
boolean isTestPassed = false;
String script = "if address :localpart :contains \"From\" \"r\" {throwTestException;}";
@@ -339,12 +307,10 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
- /**
- * Test for Test 'address'
- */
+ @Test
public void testIfAddressDomainIsTrue() {
boolean isTestPassed = false;
String script = "if address :domain :is \"From\" \"domain\" {throwTestException;}";
@@ -359,12 +325,10 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
- /**
- * Test for Test 'address'
- */
+ @Test
public void testIfAddressDomainMatchesTrue() {
boolean isTestPassed = false;
String script = "if address :domain :matches \"From\" \"*main\" {throwTestException;}";
@@ -378,12 +342,10 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
- /**
- * Test for Test 'address'
- */
+ @Test
public void testIfAddressDomainContainsTrue() {
boolean isTestPassed = false;
String script = "if address :domain :contains \"From\" \"dom\" {throwTestException;}";
@@ -397,12 +359,10 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
- /**
- * Test for Test 'address'
- */
+ @Test
public void testIfAddressAllIsFalse() {
boolean isTestPassed = false;
String script = "if address :all :is \"From\" \"user@domain\" {throwTestException;}";
@@ -416,12 +376,10 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
- /**
- * Test for Test 'address'
- */
+ @Test
public void testIfAddressAllMatchesFalse() {
boolean isTestPassed = false;
String script = "if address :all :matches \"From\" \"(.*)@domain\" {throwTestException;}";
@@ -435,12 +393,10 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
- /**
- * Test for Test 'address'
- */
+ @Test
public void testIfAddressAllContainsFalse() {
boolean isTestPassed = false;
String script = "if address :all :contains \"From\" \"r@dom\" {throwTestException;}";
@@ -454,12 +410,10 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
- /**
- * Test for Test 'address'
- */
+ @Test
public void testIfAddressLocalpartIsFalse() {
boolean isTestPassed = false;
String script = "if address :localpart :is \"From\" \"user\" {throwTestException;}";
@@ -473,12 +427,10 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
- /**
- * Test for Test 'address'
- */
+ @Test
public void testIfAddressLocalpartMatchesFalse() {
boolean isTestPassed = false;
String script = "if address :localpart :matches \"From\" \"(.*)er\" {throwTestException;}";
@@ -492,12 +444,10 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
- /**
- * Test for Test 'address'
- */
+ @Test
public void testIfAddressLocalpartContainsFalse() {
boolean isTestPassed = false;
String script = "if address :localpart :contains \"From\" \"r\" {throwTestException;}";
@@ -511,12 +461,10 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
- /**
- * Test for Test 'address'
- */
+ @Test
public void testIfAddressDomainIsFalse() {
boolean isTestPassed = false;
String script = "if address :domain :is \"From\" \"domain\" {throwTestException;}";
@@ -531,12 +479,10 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
- /**
- * Test for Test 'address'
- */
+ @Test
public void testIfAddressDomainMatchesFalse() {
boolean isTestPassed = false;
String script = "if address :domain :matches \"From\" \"(.*)main\" {throwTestException;}";
@@ -550,12 +496,10 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
- /**
- * Test for Test 'address'
- */
+ @Test
public void testIfAddressDomainContainsFalse() {
boolean isTestPassed = false;
String script = "if address :domain :contains \"From\" \"dom\" {throwTestException;}";
@@ -569,12 +513,10 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
- /**
- * Test for Test 'address'
- */
+ @Test
public void testIfAddressAllIsMultiFalse1() {
boolean isTestPassed = false;
String script = "if address :all :is [\"From\", \"To\"] \"user@domain\" {throwTestException;}";
@@ -589,12 +531,10 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
- /**
- * Test for Test 'address'
- */
+ @Test
public void testIfAddressAllIsMultiFalse2() {
boolean isTestPassed = false;
String script = "if address :all :is [\"From\", \"To\"] [\"user@domain\", \"tweety@pie\"] {throwTestException;}";
@@ -609,7 +549,7 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
}
diff --git a/core/src/test/java/org/apache/jsieve/AllOfTest.java b/core/src/test/java/org/apache/jsieve/AllOfTest.java
index 2920f1c..680112d 100644
--- a/core/src/test/java/org/apache/jsieve/AllOfTest.java
+++ b/core/src/test/java/org/apache/jsieve/AllOfTest.java
@@ -19,22 +19,23 @@
package org.apache.jsieve;
-import junit.framework.TestCase;
-
import org.apache.jsieve.commands.ThrowTestException;
import org.apache.jsieve.exception.SieveException;
import org.apache.jsieve.exception.SyntaxException;
import org.apache.jsieve.parser.generated.ParseException;
import org.apache.jsieve.utils.JUnitUtils;
+import org.junit.Assert;
+import org.junit.Test;
/**
* Class AllOfTest
*/
-public class AllOfTest extends TestCase {
+public class AllOfTest {
/**
* Test for Test 'allof'
*/
+ @Test
public void testIfAllOfFalseTrue() {
boolean isTestPassed = false;
String script = "if allof (false, true) {stop;} throwTestException;";
@@ -46,12 +47,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'allof'
*/
+ @Test
public void testIfAllOfTrueTrue() {
boolean isTestPassed = false;
String script = "if allof (true, true) {throwTestException;}";
@@ -63,12 +65,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'allof'
*/
+ @Test
public void testIfAllOfFalseFalse() {
boolean isTestPassed = false;
String script = "if allof (false, false) {stop;} throwTestException;";
@@ -80,12 +83,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'allof'
*/
+ @Test
public void testIfAllOfTrueFalse() {
boolean isTestPassed = false;
String script = "if allof (true, false) {stop;} throwTestException;";
@@ -97,12 +101,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'anyof' with invalid argument
*/
+ @Test
public void testInvalidArgument() {
boolean isTestPassed = false;
String script = "if anyof 1 {throwTestException;}";
@@ -114,7 +119,7 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
}
diff --git a/core/src/test/java/org/apache/jsieve/AllTests.java b/core/src/test/java/org/apache/jsieve/AllTests.java
deleted file mode 100644
index da1b8ee..0000000
--- a/core/src/test/java/org/apache/jsieve/AllTests.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one *
- * or more contributor license agreements. See the NOTICE file *
- * distributed with this work for additional information *
- * regarding copyright ownership. The ASF licenses this file *
- * to you under the Apache License, Version 2.0 (the *
- * "License"); you may not use this file except in compliance *
- * with the License. You may obtain a copy of the License at *
- * *
- * http://www.apache.org/licenses/LICENSE-2.0 *
- * *
- * Unless required by applicable law or agreed to in writing, *
- * software distributed under the License is distributed on an *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
- * KIND, either express or implied. See the License for the *
- * specific language governing permissions and limitations *
- * under the License. *
- ****************************************************************/
-
-package org.apache.jsieve;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-/**
- * Class AllTests
- */
-public class AllTests {
-
- public static void main(String[] args) {
- junit.swingui.TestRunner.run(AllTests.class);
- }
-
- public static Test suite() {
- TestSuite suite = new TestSuite("Test for org.apache.jsieve.junit");
- // $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(DiscardTest.class));
- suite.addTest(new TestSuite(FileIntoTest.class));
- suite.addTest(new TestSuite(RejectTest.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));
- suite.addTest(new TestSuite(AllOfTest.class));
- 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(EnvelopeTest.class));
- suite.addTest(new TestSuite(LogTest.class));
- // $JUnit-END$
- return suite;
- }
-}
diff --git a/core/src/test/java/org/apache/jsieve/AnyOfTest.java b/core/src/test/java/org/apache/jsieve/AnyOfTest.java
index 74c53cd..a5526dc 100644
--- a/core/src/test/java/org/apache/jsieve/AnyOfTest.java
+++ b/core/src/test/java/org/apache/jsieve/AnyOfTest.java
@@ -26,15 +26,18 @@
import org.apache.jsieve.exception.SyntaxException;
import org.apache.jsieve.parser.generated.ParseException;
import org.apache.jsieve.utils.JUnitUtils;
+import org.junit.*;
+import org.junit.Test;
/**
* Class AnyOfTest
*/
-public class AnyOfTest extends TestCase {
+public class AnyOfTest {
/**
* Test for Test 'anyof'
*/
+ @org.junit.Test
public void testIfAnyOfFalseTrue() {
boolean isTestPassed = false;
String script = "if anyof (false, true) {throwTestException;}";
@@ -46,12 +49,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'anyof'
*/
+ @Test
public void testIfAnyOfTrueTrue() {
boolean isTestPassed = false;
String script = "if anyof (true, true) {throwTestException;}";
@@ -63,12 +67,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'anyof'
*/
+ @Test
public void testIfAnyOfFalseFalse() {
boolean isTestPassed = false;
String script = "if anyof (false, false) {stop;} throwTestException;";
@@ -80,12 +85,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'anyof'
*/
+ @Test
public void testIfAnyOfTrueFalse() {
boolean isTestPassed = false;
String script = "if anyof (true, false) {throwTestException;}";
@@ -97,12 +103,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'anyof' with invalid argument
*/
+ @Test
public void testInvalidArgument() {
boolean isTestPassed = false;
String script = "if anyof 1 {throwTestException;}";
@@ -114,7 +121,7 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
}
diff --git a/core/src/test/java/org/apache/jsieve/BodyTest.java b/core/src/test/java/org/apache/jsieve/BodyTest.java
index ad26e05..6234e15 100644
--- a/core/src/test/java/org/apache/jsieve/BodyTest.java
+++ b/core/src/test/java/org/apache/jsieve/BodyTest.java
@@ -29,11 +29,13 @@
import org.apache.jsieve.parser.generated.ParseException;
import org.apache.jsieve.utils.JUnitUtils;
import org.apache.jsieve.utils.SieveMailAdapter;
+import org.junit.*;
+import org.junit.Test;
/**
* Class BodyTest
*/
-public class BodyTest extends TestCase {
+public class BodyTest {
protected SieveMailAdapter textMail() throws MessagingException {
SieveMailAdapter mail = (SieveMailAdapter) JUnitUtils.createMail();
@@ -52,6 +54,7 @@
/**
* Test for Test 'header'
*/
+ @org.junit.Test
public void testBasic() {
boolean isTestPassed = false;
String script = "if body :contains [\"Wibble\"] {throwTestException;}";
@@ -63,12 +66,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'body'
*/
+ @Test
public void testBodyCaseInsensitivity() {
boolean isTestPassed = false;
String script = "if body :contains [\"wibble\"] {throwTestException;}";
@@ -80,12 +84,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'body'
*/
+ @Test
public void testBodyNoContains() {
boolean isTestPassed = false;
String script = "if body [\"wibble\"] {throwTestException;}";
@@ -97,7 +102,7 @@
} catch (SieveException e) {
isTestPassed = true;
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
diff --git a/core/src/test/java/org/apache/jsieve/ConditionTest.java b/core/src/test/java/org/apache/jsieve/ConditionTest.java
index 1d3c7ef..ecdac63 100644
--- a/core/src/test/java/org/apache/jsieve/ConditionTest.java
+++ b/core/src/test/java/org/apache/jsieve/ConditionTest.java
@@ -19,24 +19,25 @@
package org.apache.jsieve;
-import junit.framework.TestCase;
-
import org.apache.jsieve.commands.ThrowTestException;
import org.apache.jsieve.exception.CommandException;
import org.apache.jsieve.exception.SieveException;
import org.apache.jsieve.exception.SyntaxException;
import org.apache.jsieve.parser.generated.ParseException;
import org.apache.jsieve.utils.JUnitUtils;
+import org.junit.Assert;
+import org.junit.Test;
/**
* Class <code>ConditionTest</code> tests the conditional commands if, elsif
* and else.
*/
-public class ConditionTest extends TestCase {
+public class ConditionTest {
/**
* Test for Command 'if' with an argument of 'true'
*/
+ @org.junit.Test
public void testIfTrue() {
boolean isTestPassed = false;
String script = "if true {throwTestException;}";
@@ -48,12 +49,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Command 'if' with an argument of 'false'
*/
+ @Test
public void testIfFalse() {
boolean isTestPassed = false;
String script = "if false {stop;} throwTestException;";
@@ -65,12 +67,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Command 'elsif' with an argument of 'true'
*/
+ @Test
public void testElsifTrue() {
boolean isTestPassed = false;
String script = "if false {stop;} elsif true {throwTestException;}";
@@ -82,12 +85,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Command 'elsif' with an argument of 'false'
*/
+ @Test
public void testElsifFalse() {
boolean isTestPassed = false;
String script = "if false {stop;} elsif false {stop;} throwTestException;";
@@ -99,12 +103,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for nested Command 'elsif' with an argument of 'true'
*/
+ @Test
public void testElsifFalseElsifTrue() {
boolean isTestPassed = false;
String script = "if false {stop;} elsif false {stop;} elsif true {throwTestException;}";
@@ -116,12 +121,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Command 'else' after 'elseif'
*/
+ @Test
public void testElsifFalseElse() {
boolean isTestPassed = false;
String script = "if false {stop;} elsif false {stop;} else {throwTestException;}";
@@ -133,12 +139,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Command 'else'
*/
+ @Test
public void testElse() {
boolean isTestPassed = false;
String script = "if false {stop;} else {throwTestException;}";
@@ -150,12 +157,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Command 'else' out of sequence
*/
+ @Test
public void testOutOfSequenceElse() {
boolean isTestPassed = false;
String script = "else {stop;}";
@@ -167,12 +175,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Command 'elsif' out of sequence
*/
+ @Test
public void testOutOfSequenceElsif() {
boolean isTestPassed = false;
String script = "elsif {stop;}";
@@ -184,12 +193,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Command 'if' without a corresponding Block
*/
+ @Test
public void testIfMissingBlock() {
boolean isTestPassed = false;
String script = "if true stop;";
@@ -201,12 +211,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Command 'if' without a test
*/
+ @Test
public void testIfMissingTest() {
boolean isTestPassed = false;
String script = "if {stop;}";
@@ -218,12 +229,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Command 'if' without a test
*/
+ @Test
public void testElsifMissingTest() {
boolean isTestPassed = false;
String script = "if false {stop;} elsif {stop;}";
@@ -235,12 +247,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Command 'elsif' without a corresponding Block
*/
+ @Test
public void testElsifMissingBlock() {
boolean isTestPassed = false;
String script = "if false {stop;} elsif true stop;";
@@ -252,12 +265,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Command 'else' without a corresponding Block
*/
+ @Test
public void testElseMissingBlock() {
boolean isTestPassed = false;
String script = "if false {stop;} else stop;";
@@ -269,12 +283,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Command 'if' nested in a block
*/
+ @Test
public void testNestedIf() {
boolean isTestPassed = false;
String script = "if true {if true {throwTestException;}}";
@@ -286,12 +301,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Command 'else' out of sequence nested in a block
*/
+ @Test
public void testNestedOutOfSequenceElse() {
boolean isTestPassed = false;
String script = "if true {else {stop;}}";
@@ -303,12 +319,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Command 'elsif' out of sequence nested in a block
*/
+ @Test
public void testNestedOutOfSequenceElsif() {
boolean isTestPassed = false;
String script = "if true {elsif true {stop;}}";
@@ -320,7 +337,7 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
}
diff --git a/core/src/test/java/org/apache/jsieve/ConfigurationManagerTest.java b/core/src/test/java/org/apache/jsieve/ConfigurationManagerTest.java
index 4cb47ab..e675993 100644
--- a/core/src/test/java/org/apache/jsieve/ConfigurationManagerTest.java
+++ b/core/src/test/java/org/apache/jsieve/ConfigurationManagerTest.java
@@ -19,24 +19,23 @@
package org.apache.jsieve;
+import org.junit.Assert;
+import org.junit.Test;
+
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
-import junit.framework.TestCase;
-
-import org.apache.jsieve.ConfigurationManager;
-import org.apache.jsieve.SieveConfigurationException;
-
/**
* Class ConfigurationManagerTest
*/
-public class ConfigurationManagerTest extends TestCase {
+public class ConfigurationManagerTest {
/**
* Test the CommandMap maps 'MUST' and 'SHOULD' be supported commands to the
* correct classes.
*/
+ @org.junit.Test
public void testCommandMap() {
Map<String, String> map = new HashMap<String, String>();
// Condition Commands
@@ -63,21 +62,22 @@
Iterator mapIter = map.entrySet().iterator();
while (mapIter.hasNext()) {
Map.Entry entry = (Map.Entry) mapIter.next();
- assertTrue("Key: " + entry.getKey(), commandMap
+ Assert.assertTrue("Key: " + entry.getKey(), commandMap
.containsKey(entry.getKey()));
- assertTrue("Value: " + entry.getValue(), commandMap.get(
+ Assert.assertTrue("Value: " + entry.getValue(), commandMap.get(
entry.getKey()).equals(entry.getValue()));
}
isTestPassed = true;
} catch (SieveConfigurationException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test the TestMap maps 'MUST' and 'SHOULD' be supported tests to the
* correct classes.
*/
+ @Test
public void testTestMap() {
Map<String, String> map = new HashMap<String, String>();
@@ -102,21 +102,22 @@
Iterator mapIter = map.entrySet().iterator();
while (mapIter.hasNext()) {
Map.Entry entry = (Map.Entry) mapIter.next();
- assertTrue("Key: " + entry.getKey(), testMap.containsKey(entry
+ Assert.assertTrue("Key: " + entry.getKey(), testMap.containsKey(entry
.getKey()));
- assertTrue("Value: " + entry.getValue(), testMap.get(
+ Assert.assertTrue("Value: " + entry.getValue(), testMap.get(
entry.getKey()).equals(entry.getValue()));
}
isTestPassed = true;
} catch (SieveConfigurationException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test the CommparatorMap maps 'MUST' and 'SHOULD' be supported comparators
* to the correct classes.
*/
+ @Test
public void testComparatorMap() {
Map<String, String> map = new HashMap<String, String>();
@@ -133,15 +134,15 @@
Iterator mapIter = map.entrySet().iterator();
while (mapIter.hasNext()) {
Map.Entry entry = (Map.Entry) mapIter.next();
- assertTrue("Key: " + entry.getKey(), comparatorMap
+ Assert.assertTrue("Key: " + entry.getKey(), comparatorMap
.containsKey(entry.getKey()));
- assertTrue("Value: " + entry.getValue(), comparatorMap.get(
+ Assert.assertTrue("Value: " + entry.getValue(), comparatorMap.get(
entry.getKey()).equals(entry.getValue()));
}
isTestPassed = true;
} catch (SieveConfigurationException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
}
diff --git a/core/src/test/java/org/apache/jsieve/DiscardTest.java b/core/src/test/java/org/apache/jsieve/DiscardTest.java
index 36d6775..0cf8e0c 100644
--- a/core/src/test/java/org/apache/jsieve/DiscardTest.java
+++ b/core/src/test/java/org/apache/jsieve/DiscardTest.java
@@ -19,22 +19,23 @@
package org.apache.jsieve;
-import junit.framework.TestCase;
-
import org.apache.jsieve.exception.SieveException;
import org.apache.jsieve.exception.SyntaxException;
import org.apache.jsieve.mail.MailAdapter;
import org.apache.jsieve.parser.generated.ParseException;
import org.apache.jsieve.utils.JUnitUtils;
+import org.junit.Assert;
+import org.junit.Test;
/**
* Class DiscardTest
*/
-public class DiscardTest extends TestCase {
+public class DiscardTest {
/**
* Test for Command 'discard' with invalid arguments
*/
+ @org.junit.Test
public void testInvalidArguments() {
boolean isTestPassed = false;
String script = "discard 1 ;";
@@ -46,12 +47,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Command 'discard' with an invalid block
*/
+ @Test
public void testInvalidBlock() {
boolean isTestPassed = false;
String script = "discard 1 {throwTestException;}";
@@ -63,12 +65,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/*
* Test for Command 'discard'
*/
+ @Test
public void testDiscard() {
boolean isTestPassed = false;
String script = "discard;";
@@ -76,12 +79,12 @@
try {
MailAdapter mail = JUnitUtils.createMail();
JUnitUtils.interpret(mail, script);
- assertTrue(mail.getActions().isEmpty());
+ Assert.assertTrue(mail.getActions().isEmpty());
isTestPassed = true;
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
}
diff --git a/core/src/test/java/org/apache/jsieve/EnvelopeTest.java b/core/src/test/java/org/apache/jsieve/EnvelopeTest.java
index c0ed219..3f1e156 100644
--- a/core/src/test/java/org/apache/jsieve/EnvelopeTest.java
+++ b/core/src/test/java/org/apache/jsieve/EnvelopeTest.java
@@ -19,22 +19,23 @@
package org.apache.jsieve;
-import junit.framework.TestCase;
-
import org.apache.jsieve.commands.ThrowTestException;
import org.apache.jsieve.exception.SieveException;
import org.apache.jsieve.parser.generated.ParseException;
import org.apache.jsieve.utils.JUnitUtils;
import org.apache.jsieve.utils.SieveEnvelopeMailAdapter;
+import org.junit.Assert;
+import org.junit.Test;
/**
* Class EnvelopeTest
*/
-public class EnvelopeTest extends TestCase {
+public class EnvelopeTest {
/**
* Test for Test 'envelope'
*/
+ @org.junit.Test
public void testIfEnvelopeAllIsTrue() {
boolean isTestPassed = false;
String script = "if envelope :all :is \"From\" \"user@domain\" {throwTestException;}";
@@ -47,12 +48,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'envelope'
*/
+ @Test
public void testCaseInsensitiveEnvelopeName() {
boolean isTestPassed = false;
String script = "if envelope :all :is \"from\" \"user@domain\" {throwTestException;}";
@@ -65,12 +67,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'envelope'
*/
+ @Test
public void testOctetComparatorTrue() {
boolean isTestPassed = false;
String script = "if envelope :comparator \"i;octet\" :all :is \"From\" \"uSeR@dOmAiN\" {throwTestException;}";
@@ -83,12 +86,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'envelope'
*/
+ @Test
public void testOctetComparatorFalse() {
boolean isTestPassed = false;
String script = "if envelope :comparator \"i;octet\" :all :is \"From\" \"uSeR@dOmAiN\" {throwTestException;}";
@@ -101,12 +105,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'envelope'
*/
+ @Test
public void testAsciiComparatorTrue() {
boolean isTestPassed = false;
String script = "if envelope :comparator \"i;ascii-casemap\" :all :is \"From\" \"uSeR@dOmAiN\" {throwTestException;}";
@@ -119,12 +124,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'envelope'
*/
+ @Test
public void testAsciiComparatorFalse() {
boolean isTestPassed = false;
String script = "if envelope :comparator \"i;ascii-casemap\" :all :is \"From\" \"uSeR@dOmAiN\" {throwTestException;}";
@@ -137,12 +143,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'envelope'
*/
+ @Test
public void testIfEnvelopeAllIsMultiTrue1() {
boolean isTestPassed = false;
String script = "if envelope :all :is [\"From\", \"To\"] \"user@domain\" {throwTestException;}";
@@ -156,12 +163,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'envelope'
*/
+ @Test
public void testIfEnvelopeAllIsMultiTrue2() {
boolean isTestPassed = false;
String script = "if envelope :all :is [\"From\", \"To\"] [\"user@domain\", \"tweety@pie\"] {throwTestException;}";
@@ -175,12 +183,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'envelope'
*/
+ @Test
public void testIfEnvelopeAllIsMultiTrue3() {
boolean isTestPassed = false;
String script = "if envelope :all :is [\"From\", \"To\"] [\"user@domain\", \"tweety@pie\"] {throwTestException;}";
@@ -194,12 +203,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'envelope'
*/
+ @Test
public void testIfEnvelopeAllIsMultiTrue4() {
boolean isTestPassed = false;
String script = "if envelope :all :is [\"From\", \"To\"] [\"user@domain\", \"tweety@pie\"] {throwTestException;}";
@@ -213,12 +223,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'envelope'
*/
+ @Test
public void testIfEnvelopeAllMatchesTrue() {
boolean isTestPassed = false;
String script = "if envelope :all :matches \"From\" \"*@domain\" {throwTestException;}";
@@ -231,12 +242,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'envelope'
*/
+ @Test
public void testIfEnvelopeAllContainsTrue() {
boolean isTestPassed = false;
String script = "if envelope :all :contains \"From\" \"r@dom\" {throwTestException;}";
@@ -249,12 +261,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'envelope'
*/
+ @Test
public void testIfEnvelopeLocalpartIsTrue() {
boolean isTestPassed = false;
String script = "if envelope :localpart :is \"From\" \"user\" {throwTestException;}";
@@ -267,12 +280,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'envelope'
*/
+ @Test
public void testIfEnvelopeLocalpartMatchesTrue() {
boolean isTestPassed = false;
String script = "if envelope :localpart :matches \"From\" \"*er\" {throwTestException;}";
@@ -285,12 +299,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'envelope'
*/
+ @Test
public void testIfEnvelopeLocalpartContainsTrue() {
boolean isTestPassed = false;
String script = "if envelope :localpart :contains \"From\" \"r\" {throwTestException;}";
@@ -303,12 +318,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'envelope'
*/
+ @Test
public void testIfEnvelopeDomainIsTrue() {
boolean isTestPassed = false;
String script = "if envelope :domain :is \"From\" \"domain\" {throwTestException;}";
@@ -322,12 +338,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'envelope'
*/
+ @Test
public void testIfEnvelopeDomainMatchesTrue() {
boolean isTestPassed = false;
String script = "if envelope :domain :matches \"From\" \"*main\" {throwTestException;}";
@@ -340,12 +357,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'envelope'
*/
+ @Test
public void testIfEnvelopeDomainContainsTrue() {
boolean isTestPassed = false;
String script = "if envelope :domain :contains \"From\" \"dom\" {throwTestException;}";
@@ -358,12 +376,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'envelope'
*/
+ @Test
public void testIfEnvelopeAllIsFalse() {
boolean isTestPassed = false;
String script = "if envelope :all :is \"From\" \"user@domain\" {throwTestException;}";
@@ -376,12 +395,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'envelope'
*/
+ @Test
public void testIfEnvelopeAllMatchesFalse() {
boolean isTestPassed = false;
String script = "if envelope :all :matches \"From\" \"(.*)@domain\" {throwTestException;}";
@@ -394,12 +414,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'envelope'
*/
+ @Test
public void testIfEnvelopeAllContainsFalse() {
boolean isTestPassed = false;
String script = "if envelope :all :contains \"From\" \"r@dom\" {throwTestException;}";
@@ -412,12 +433,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'envelope'
*/
+ @Test
public void testIfEnvelopeLocalpartIsFalse() {
boolean isTestPassed = false;
String script = "if envelope :localpart :is \"From\" \"user\" {throwTestException;}";
@@ -430,12 +452,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'envelope'
*/
+ @Test
public void testIfEnvelopeLocalpartMatchesFalse() {
boolean isTestPassed = false;
String script = "if envelope :localpart :matches \"From\" \"(.*)er\" {throwTestException;}";
@@ -448,12 +471,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'envelope'
*/
+ @Test
public void testIfEnvelopeLocalpartContainsFalse() {
boolean isTestPassed = false;
String script = "if envelope :localpart :contains \"From\" \"r\" {throwTestException;}";
@@ -466,12 +490,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'envelope'
*/
+ @Test
public void testIfEnvelopeDomainIsFalse() {
boolean isTestPassed = false;
String script = "if envelope :domain :is \"From\" \"domain\" {throwTestException;}";
@@ -485,12 +510,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'envelope'
*/
+ @Test
public void testIfEnvelopeDomainMatchesFalse() {
boolean isTestPassed = false;
String script = "if envelope :domain :matches \"From\" \"(.*)main\" {throwTestException;}";
@@ -503,12 +529,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'envelope'
*/
+ @Test
public void testIfEnvelopeDomainContainsFalse() {
boolean isTestPassed = false;
String script = "if envelope :domain :contains \"From\" \"dom\" {throwTestException;}";
@@ -521,12 +548,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'envelope'
*/
+ @Test
public void testIfEnvelopeAllIsMultiFalse1() {
boolean isTestPassed = false;
String script = "if envelope :all :is [\"From\", \"To\"] \"user@domain\" {throwTestException;}";
@@ -540,12 +568,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'envelope'
*/
+ @Test
public void testIfEnvelopeAllIsMultiFalse2() {
boolean isTestPassed = false;
String script = "if envelope :all :is [\"From\", \"To\"] [\"user@domain\", \"tweety@pie\"] {throwTestException;}";
@@ -559,7 +588,7 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
}
diff --git a/core/src/test/java/org/apache/jsieve/ExistsTest.java b/core/src/test/java/org/apache/jsieve/ExistsTest.java
index 3eff04a..4dd7790 100644
--- a/core/src/test/java/org/apache/jsieve/ExistsTest.java
+++ b/core/src/test/java/org/apache/jsieve/ExistsTest.java
@@ -19,25 +19,26 @@
package org.apache.jsieve;
-import javax.mail.MessagingException;
-
-import junit.framework.TestCase;
-
import org.apache.jsieve.commands.ThrowTestException;
import org.apache.jsieve.exception.SieveException;
import org.apache.jsieve.exception.SyntaxException;
import org.apache.jsieve.parser.generated.ParseException;
import org.apache.jsieve.utils.JUnitUtils;
import org.apache.jsieve.utils.SieveMailAdapter;
+import org.junit.Assert;
+import org.junit.Test;
+
+import javax.mail.MessagingException;
/**
* Class ExistsTest
*/
-public class ExistsTest extends TestCase {
+public class ExistsTest {
/**
* Test for Test 'exists'
*/
+ @org.junit.Test
public void testExistsTrue() {
boolean isTestPassed = false;
String script = "if exists \"From\" {throwTestException;}";
@@ -52,12 +53,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'exists'
*/
+ @Test
public void testCaseInsensitivity() {
boolean isTestPassed = false;
String script = "if exists \"From\" {throwTestException;}";
@@ -72,12 +74,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'exists'
*/
+ @Test
public void testExistsTrueTrue() {
boolean isTestPassed = false;
String script = "if exists [\"From\", \"X-Files\"] {throwTestException;}";
@@ -93,12 +96,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'exists'
*/
+ @Test
public void testExistsTrueFalse() {
boolean isTestPassed = false;
String script = "if exists [\"From\", \"X-Files\"] {stop;} throwTestException;";
@@ -112,12 +116,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'exists'
*/
+ @Test
public void testExistsFalse() {
boolean isTestPassed = false;
String script = "if exists \"From\" {stop;} throwTestException;";
@@ -130,12 +135,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'exists'
*/
+ @Test
public void testExistsFalseFalse() {
boolean isTestPassed = false;
String script = "if exists [\"From\", \"X-Files\"] {stop;} throwTestException;";
@@ -148,12 +154,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'exists' with invalid numeric argument
*/
+ @Test
public void testInvalidNumericArgument() {
boolean isTestPassed = false;
String script = "if exists 1 {throwTestException;}";
@@ -165,12 +172,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'exists' with invalid test argument
*/
+ @Test
public void testInvalidTestArgument() {
boolean isTestPassed = false;
String script = "if exists not {throwTestException;}";
@@ -182,7 +190,7 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
}
diff --git a/core/src/test/java/org/apache/jsieve/FalseTest.java b/core/src/test/java/org/apache/jsieve/FalseTest.java
index 86c92de..cbee1a0 100644
--- a/core/src/test/java/org/apache/jsieve/FalseTest.java
+++ b/core/src/test/java/org/apache/jsieve/FalseTest.java
@@ -19,22 +19,23 @@
package org.apache.jsieve;
-import junit.framework.TestCase;
-
import org.apache.jsieve.commands.ThrowTestException;
import org.apache.jsieve.exception.SieveException;
import org.apache.jsieve.exception.SyntaxException;
import org.apache.jsieve.parser.generated.ParseException;
import org.apache.jsieve.utils.JUnitUtils;
+import org.junit.Assert;
+import org.junit.Test;
/**
* Class FalseTest
*/
-public class FalseTest extends TestCase {
+public class FalseTest {
/**
* Test for Test 'true'
*/
+ @org.junit.Test
public void testIfFalse() {
boolean isTestPassed = false;
String script = "if false {stop;} throwTestException;";
@@ -46,12 +47,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'true' with invalid argument
*/
+ @Test
public void testInvalidArgument() {
boolean isTestPassed = false;
String script = "if false 1 {throwTestException;}";
@@ -63,7 +65,7 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
}
diff --git a/core/src/test/java/org/apache/jsieve/FileIntoTest.java b/core/src/test/java/org/apache/jsieve/FileIntoTest.java
index f39d3f4..3e76fb9 100644
--- a/core/src/test/java/org/apache/jsieve/FileIntoTest.java
+++ b/core/src/test/java/org/apache/jsieve/FileIntoTest.java
@@ -19,23 +19,24 @@
package org.apache.jsieve;
-import junit.framework.TestCase;
-
import org.apache.jsieve.exception.SieveException;
import org.apache.jsieve.exception.SyntaxException;
import org.apache.jsieve.mail.ActionFileInto;
import org.apache.jsieve.mail.MailAdapter;
import org.apache.jsieve.parser.generated.ParseException;
import org.apache.jsieve.utils.JUnitUtils;
+import org.junit.Assert;
+import org.junit.Test;
/**
* Class FileIntoTest
*/
-public class FileIntoTest extends TestCase {
+public class FileIntoTest {
/**
* Test for Command 'fileinto'
*/
+ @org.junit.Test
public void testFileInto() {
boolean isTestPassed = false;
String script = "fileinto \"INBOX.test1\"; fileinto \"INBOX.test2\";";
@@ -43,24 +44,25 @@
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))
+ Assert.assertTrue(mail.getActions().size() == 2);
+ Assert.assertTrue(mail.getActions().get(0) instanceof ActionFileInto);
+ Assert.assertTrue(((ActionFileInto) mail.getActions().get(0))
.getDestination().equals("INBOX.test1"));
- assertTrue(mail.getActions().get(1) instanceof ActionFileInto);
- assertTrue(((ActionFileInto) mail.getActions().get(1))
+ Assert.assertTrue(mail.getActions().get(1) instanceof ActionFileInto);
+ Assert.assertTrue(((ActionFileInto) mail.getActions().get(1))
.getDestination().equals("INBOX.test2"));
isTestPassed = true;
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Command 'fileinto' with duplicate destinations. Only one
* ActionFileInto should result.
*/
+ @Test
public void testDuplicateFileInto() {
boolean isTestPassed = false;
String script = "fileinto \"INBOX.test1\"; fileinto \"INBOX.test1\";";
@@ -68,20 +70,21 @@
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))
+ Assert.assertTrue(mail.getActions().size() == 1);
+ Assert.assertTrue(mail.getActions().get(0) instanceof ActionFileInto);
+ Assert.assertTrue(((ActionFileInto) mail.getActions().get(0))
.getDestination().equals("INBOX.test1"));
isTestPassed = true;
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Command 'fileinto' with an invalid argument type
*/
+ @Test
public void testInvalidArgumentType() {
boolean isTestPassed = false;
String script = "fileinto 1 ;";
@@ -93,12 +96,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Command 'fileinto' with an invalid argument number
*/
+ @Test
public void testInvalidArgumentNumber() {
boolean isTestPassed = false;
String script = "fileinto [\"INBOX.test\", \"elsewhere\"];";
@@ -110,12 +114,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Command 'fileinto' with an invalid block
*/
+ @Test
public void testInvalidBlock() {
boolean isTestPassed = false;
String script = "fileinto 1 {throwTestException;}";
@@ -127,7 +132,7 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
}
diff --git a/core/src/test/java/org/apache/jsieve/HeaderTest.java b/core/src/test/java/org/apache/jsieve/HeaderTest.java
index 881eccf..e15539e 100644
--- a/core/src/test/java/org/apache/jsieve/HeaderTest.java
+++ b/core/src/test/java/org/apache/jsieve/HeaderTest.java
@@ -19,24 +19,25 @@
package org.apache.jsieve;
-import javax.mail.MessagingException;
-
-import junit.framework.TestCase;
-
import org.apache.jsieve.commands.ThrowTestException;
import org.apache.jsieve.exception.SieveException;
import org.apache.jsieve.parser.generated.ParseException;
import org.apache.jsieve.utils.JUnitUtils;
import org.apache.jsieve.utils.SieveMailAdapter;
+import org.junit.Assert;
+import org.junit.Test;
+
+import javax.mail.MessagingException;
/**
* Class HeaderTest
*/
-public class HeaderTest extends TestCase {
+public class HeaderTest {
/**
* Test for Test 'header'
*/
+ @org.junit.Test
public void testHeaderIsTrue() {
boolean isTestPassed = false;
String script = "if header :is \"X-Caffeine\" \"C8H10N4O2\" {throwTestException;}";
@@ -50,12 +51,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'header'
*/
+ @Test
public void testHeaderCaseInsensitivity() {
boolean isTestPassed = false;
String script = "if header :is \"X-Caffeine\" \"C8H10N4O2\" {throwTestException;}";
@@ -69,12 +71,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'header'
*/
+ @Test
public void testHeaderIsTrueMulti1() {
boolean isTestPassed = false;
String script = "if header :is [\"X-Decaf\", \"X-Caffeine\"] \"C8H10N4O2\" {throwTestException;}";
@@ -88,12 +91,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'header'
*/
+ @Test
public void testHeaderIsFalseMulti1() {
boolean isTestPassed = false;
String script = "if header :is [\"X-Decaf\", \"X-Caffeine\"] \"C8H10N4O2\" {throwTestException;}";
@@ -108,12 +112,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'header'
*/
+ @Test
public void testHeaderIsTrueMulti2() {
boolean isTestPassed = false;
String script = "if header :is \"X-Caffeine\" [\"absent\", \"C8H10N4O2\"] {throwTestException;}";
@@ -127,12 +132,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'header'
*/
+ @Test
public void testHeaderIsTrueMulti3() {
boolean isTestPassed = false;
String script = "if header :is [\"X-Decaf\", \"X-Caffeine\"] [\"absent\", \"C8H10N4O2\"] {throwTestException;}";
@@ -147,12 +153,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'header'
*/
+ @Test
public void testHeaderIsFalseValue() {
boolean isTestPassed = false;
String script = "if header :is \"X-Caffeine\" \"C8H10N4O2\" {throwTestException;}";
@@ -166,12 +173,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'header'
*/
+ @Test
public void testHeaderIsFalseHeader() {
boolean isTestPassed = false;
String script = "if header :is \"X-Caffeine\" \"C8H10N4O2\" {throwTestException;}";
@@ -185,12 +193,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'header'
*/
+ @Test
public void testHeaderContainsTrue() {
boolean isTestPassed = false;
String script = "if header :contains \"X-Caffeine\" \"C8H10\" {throwTestException;}";
@@ -204,12 +213,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'header'
*/
+ @Test
public void testHeaderContainsFalse() {
boolean isTestPassed = false;
String script = "if header :is \"X-Caffeine\" \"C8H10N4O2\" {throwTestException;}";
@@ -223,12 +233,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'header'
*/
+ @Test
public void testHeaderContainsNullTrue() {
boolean isTestPassed = false;
String script = "if header :contains \"X-Caffeine\" \"\" {throwTestException;}";
@@ -242,12 +253,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'header'
*/
+ @Test
public void testHeaderIsNullFalse() {
boolean isTestPassed = false;
String script = "if header :is \"X-Caffeine\" \"\" {throwTestException;}";
@@ -261,12 +273,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'header'
*/
+ @Test
public void testHeaderMatchesTrue() {
boolean isTestPassed = false;
String script = "if header :matches \"X-Caffeine\" \"*10N?O2\" {throwTestException;}";
@@ -280,12 +293,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'header'
*/
+ @Test
public void testHeaderMatchesFalse() {
boolean isTestPassed = false;
String script = "if header :matches \"X-Caffeine\" \"*10N?O2\" {throwTestException;}";
@@ -299,15 +313,16 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for square brackets in matching headers When the "[" is in the first
* char of the pattern it does not matches.
- *
+ * <p/>
* See http://issues.apache.org/jira/browse/JSIEVE-19
*/
+ @Test
public void testSquareBracketsInMatch() {
boolean isTestPassed = false;
String script = "if header :matches \"X-Caffeine\" \"[test*\" {throwTestException;}";
@@ -321,12 +336,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for special char escaping: \\? is a ? and \\* is an *
*/
+ @Test
public void testSpecialCharsEscapingInMatch() {
boolean isTestPassed = false;
String script = "if header :matches \"X-Caffeine\" \"my,\\\\,?,\\\\?,*,\\\\*,pattern\" {throwTestException;}";
@@ -341,12 +357,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for special char escaping: \\? is a ? and \\* is an *
*/
+ @Test
public void testSpecialCharsEscapingInMatchFalse() {
boolean isTestPassed = false;
String script = "if header :matches \"X-Caffeine\" \"my,?,\\\\?,*,\\\\*,pattern\" {throwTestException;}";
@@ -361,7 +378,7 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
}
diff --git a/core/src/test/java/org/apache/jsieve/KeepTest.java b/core/src/test/java/org/apache/jsieve/KeepTest.java
index 3c759f1..4467365 100644
--- a/core/src/test/java/org/apache/jsieve/KeepTest.java
+++ b/core/src/test/java/org/apache/jsieve/KeepTest.java
@@ -19,23 +19,24 @@
package org.apache.jsieve;
-import junit.framework.TestCase;
-
import org.apache.jsieve.exception.SieveException;
import org.apache.jsieve.exception.SyntaxException;
import org.apache.jsieve.mail.ActionKeep;
import org.apache.jsieve.mail.MailAdapter;
import org.apache.jsieve.parser.generated.ParseException;
import org.apache.jsieve.utils.JUnitUtils;
+import org.junit.Assert;
+import org.junit.Test;
/**
* Class KeepTest
*/
-public class KeepTest extends TestCase {
+public class KeepTest {
/**
* Test for Command 'keep' with invalid arguments
*/
+ @org.junit.Test
public void testInvalidArguments() {
boolean isTestPassed = false;
String script = "keep 1 ;";
@@ -47,12 +48,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Command 'keep' with an invalid block
*/
+ @Test
public void testInvalidBlock() {
boolean isTestPassed = false;
String script = "keep 1 {throwTestException;}";
@@ -64,12 +66,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Command 'keep'
*/
+ @Test
public void testKeep() {
boolean isTestPassed = false;
String script = "keep;";
@@ -77,13 +80,13 @@
try {
MailAdapter mail = JUnitUtils.createMail();
JUnitUtils.interpret(mail, script);
- assertTrue(mail.getActions().size() == 1);
- assertTrue(mail.getActions().get(0) instanceof ActionKeep);
+ Assert.assertTrue(mail.getActions().size() == 1);
+ Assert.assertTrue(mail.getActions().get(0) instanceof ActionKeep);
isTestPassed = true;
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
}
diff --git a/core/src/test/java/org/apache/jsieve/LiteralEscapeTest.java b/core/src/test/java/org/apache/jsieve/LiteralEscapeTest.java
index d61529e..552ef61 100644
--- a/core/src/test/java/org/apache/jsieve/LiteralEscapeTest.java
+++ b/core/src/test/java/org/apache/jsieve/LiteralEscapeTest.java
@@ -20,33 +20,26 @@
import org.apache.jsieve.utils.JUnitUtils;
import org.apache.jsieve.utils.SieveMailAdapter;
+import org.junit.After;
+import org.junit.Before;
-import junit.framework.TestCase;
-
-public class LiteralEscapeTest extends TestCase {
+public class LiteralEscapeTest {
private final String SCRIPT = "require [\"fileinto\", \"reject\"];" +
- "" +
- "# test" +
- "if allof (header :contains \"to\" \"\\\\\") {" +
- " keep;" +
- " stop;" +
- "}" +
- "" +
- "# test2" +
- "if anyof (header :contains \"subject\" \"foo\") {" +
- " keep;" +
- " stop;" +
- "}";
-
- protected void setUp() throws Exception {
- super.setUp();
- }
+ "" +
+ "# test" +
+ "if allof (header :contains \"to\" \"\\\\\") {" +
+ " keep;" +
+ " stop;" +
+ "}" +
+ "" +
+ "# test2" +
+ "if anyof (header :contains \"subject\" \"foo\") {" +
+ " keep;" +
+ " stop;" +
+ "}";
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-
+ @org.junit.Test
public void testBackSlash() throws Exception {
SieveMailAdapter mail = (SieveMailAdapter) JUnitUtils.createMail();
mail.getMessage().addHeader("to", "tweety@pie");
diff --git a/core/src/test/java/org/apache/jsieve/LogTest.java b/core/src/test/java/org/apache/jsieve/LogTest.java
index ec59f95..31ee6d3 100644
--- a/core/src/test/java/org/apache/jsieve/LogTest.java
+++ b/core/src/test/java/org/apache/jsieve/LogTest.java
@@ -19,20 +19,21 @@
package org.apache.jsieve;
-import junit.framework.TestCase;
-
import org.apache.jsieve.exception.SieveException;
import org.apache.jsieve.parser.generated.ParseException;
import org.apache.jsieve.utils.JUnitUtils;
+import org.junit.Assert;
+import org.junit.Test;
/**
* Class LogTest
*/
-public class LogTest extends TestCase {
+public class LogTest {
/**
* Test for Command 'log'.
*/
+ @org.junit.Test
public void testLogDebug() {
boolean isTestPassed = false;
String script = "log :debug \"Log a debug message.\";";
@@ -43,12 +44,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Command 'log'.
*/
+ @Test
public void testLogError() {
boolean isTestPassed = false;
String script = "log :error \"Log an error message.\";";
@@ -59,12 +61,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Command 'log'.
*/
+ @Test
public void testLogFatal() {
boolean isTestPassed = false;
String script = "log :fatal \"Log a fatal message.\";";
@@ -75,12 +78,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Command 'log'.
*/
+ @Test
public void testLogInfo() {
boolean isTestPassed = false;
String script = "log :info \"Log an info message.\";";
@@ -91,12 +95,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Command 'log'.
*/
+ @Test
public void testLogTrace() {
boolean isTestPassed = false;
String script = "log :trace \"Log a trace message.\";";
@@ -107,12 +112,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Command 'log'.
*/
+ @Test
public void testLogWarn() {
boolean isTestPassed = false;
String script = "log :warn \"Log a warning message.\";";
@@ -123,12 +129,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Command 'log'.
*/
+ @Test
public void testLogDefault() {
boolean isTestPassed = false;
String script = "log \"Log a default message.\";";
@@ -139,7 +146,7 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
}
diff --git a/core/src/test/java/org/apache/jsieve/MultilineTextTest.java b/core/src/test/java/org/apache/jsieve/MultilineTextTest.java
index 5b5cc6d..f6acf10 100644
--- a/core/src/test/java/org/apache/jsieve/MultilineTextTest.java
+++ b/core/src/test/java/org/apache/jsieve/MultilineTextTest.java
@@ -19,88 +19,96 @@
package org.apache.jsieve;
-import junit.framework.TestCase;
-
import org.apache.jsieve.exception.SieveException;
import org.apache.jsieve.mail.ActionReject;
import org.apache.jsieve.mail.MailAdapter;
import org.apache.jsieve.parser.generated.ParseException;
import org.apache.jsieve.utils.JUnitUtils;
+import org.junit.Assert;
+import static org.junit.Assert.assertTrue;
+import org.junit.Test;
/**
* Class RejectTest
*/
-public class MultilineTextTest extends TestCase {
-
+public class MultilineTextTest {
+
/**
* Tests that a multiline message is correctly passed
*/
+ @org.junit.Test
public void testRejectMultilineMessage() throws Exception {
String message = "This is not a love song";
String script = "reject text:\r\n" + message + "\r\n.\r\n;";
- ActionReject rejection = runRejectScript(script);
- assertEquals(message, rejection.getMessage());
+ ActionReject rejection = runRejectScript(script);
+ Assert.assertEquals(message, rejection.getMessage());
}
-
+
/**
* Tests that a multiline message is correctly passed when whitespace is inserted
* between the command and the content.
*/
+ @Test
public void testRejectMultilineMessageWithWhitespace() throws Exception {
String message = "This is not a love song";
String script = "reject text: \t \t \r\n" + message + "\r\n.\r\n;";
- ActionReject rejection = runRejectScript(script);
- assertEquals(message, rejection.getMessage());
- }
-
+ ActionReject rejection = runRejectScript(script);
+ Assert.assertEquals(message, rejection.getMessage());
+ }
+
/**
* Tests that a multiline message is correctly passed when dots within a line
* between the command and the content.
*/
+ @Test
public void testRejectMultilineMessageWithDotsMidline() throws Exception {
String message = "This is not.....a love song";
String script = "reject text:\r\n" + message + "\r\n.\r\n;";
- ActionReject rejection = runRejectScript(script);
- assertEquals(message, rejection.getMessage());
- }
-
+ ActionReject rejection = runRejectScript(script);
+ Assert.assertEquals(message, rejection.getMessage());
+ }
+
/**
* Tests that a multiline message with dot stuffing is correctly decoded.
*/
+ @Test
public void testRejectMultilineMessageWithDotStuffing() throws Exception {
String lineOne = "This is not\n";
String lineTwo = ".A Love Story";
String script = "reject text:\r\n" + lineOne + '.' + lineTwo + "\r\n.\r\n;";
- ActionReject rejection = runRejectScript(script);
- assertEquals(lineOne + lineTwo, rejection.getMessage());
+ ActionReject rejection = runRejectScript(script);
+ Assert.assertEquals(lineOne + lineTwo, rejection.getMessage());
}
-
+
/**
* Tests that a multiline message with missed dot stuffing is correctly decoded.
*/
+ @Test
public void testRejectMultilineMessageWithMissedDotStuffing() throws Exception {
String lineOne = "This is not\n";
String lineTwo = ".A Love Story";
String script = "reject text:\r\n" + lineOne + lineTwo + "\r\n.\r\n;";
- ActionReject rejection = runRejectScript(script);
- assertEquals(lineOne + lineTwo, rejection.getMessage());
+ ActionReject rejection = runRejectScript(script);
+ Assert.assertEquals(lineOne + lineTwo, rejection.getMessage());
}
-
+
/**
* Tests that a multiline message with many dots stuffed is correctly decoded.
*/
+ @Test
public void testNumberOfStuffedDotsInMultilineMessage() throws Exception {
String lineOne = "This is line 1.\n";
String lineTwo = "This is line 2.\n";
String lineThree = "........ This is line 3.\n";
String script = "reject text:\r\n" + lineOne + lineTwo + '.' + lineThree + "\r\n.\r\n;";
- ActionReject rejection = runRejectScript(script);
- assertEquals(lineOne + lineTwo + lineThree, rejection.getMessage());
+ ActionReject rejection = runRejectScript(script);
+ Assert.assertEquals(lineOne + lineTwo + lineThree, rejection.getMessage());
}
-
+
/**
* Tests that a multiline message with many dots stuffed is correctly decoded.
*/
+ @Test
public void testConsecutiveDotStuffedLineInMultilineMessage() throws Exception {
String lineOne = "This is line 1.\n";
String lineTwo = "This is line 2.\n";
@@ -108,10 +116,10 @@
String lineFour = ".\n";
String lineFive = ".\n";
String script = "reject text:\r\n" + lineOne + lineTwo + '.' + lineThree + '.' + lineFour + '.' + lineFive + "\r\n.\r\n;";
- ActionReject rejection = runRejectScript(script);
- assertEquals(lineOne + lineTwo + lineThree + lineFour + lineFive, rejection.getMessage());
+ ActionReject rejection = runRejectScript(script);
+ Assert.assertEquals(lineOne + lineTwo + lineThree + lineFour + lineFive, rejection.getMessage());
}
-
+
private ActionReject runRejectScript(String script) throws SieveException, ParseException {
MailAdapter mail = JUnitUtils.createMail();
JUnitUtils.interpret(mail, script);
diff --git a/core/src/test/java/org/apache/jsieve/MultipleRequireTest.java b/core/src/test/java/org/apache/jsieve/MultipleRequireTest.java
index ade427b..0e310e0 100644
--- a/core/src/test/java/org/apache/jsieve/MultipleRequireTest.java
+++ b/core/src/test/java/org/apache/jsieve/MultipleRequireTest.java
@@ -19,12 +19,12 @@
package org.apache.jsieve;
-import junit.framework.TestCase;
-
import org.apache.jsieve.mail.MailAdapter;
import org.apache.jsieve.utils.JUnitUtils;
+import org.junit.Before;
+import org.junit.Test;
-public class MultipleRequireTest extends TestCase {
+public class MultipleRequireTest {
private static final String MINIMAL_SIEVE = "require [\"fileinto\", \"reject\"];\n";
@@ -35,15 +35,17 @@
MailAdapter mail;
- protected void setUp() throws Exception {
- super.setUp();
+ @Before
+ public void setUp() throws Exception {
mail = JUnitUtils.createMail();
}
+ @org.junit.Test
public void testMinimalScriptMultipleRequiredParsing() throws Exception {
JUnitUtils.interpret(mail, MINIMAL_SIEVE);
}
+ @Test
public void testScriptMultipleRequiredParsing() throws Exception {
JUnitUtils.interpret(mail, MULTIPLE_REQUIRED_SIEVE);
}
diff --git a/core/src/test/java/org/apache/jsieve/MultipleToTest.java b/core/src/test/java/org/apache/jsieve/MultipleToTest.java
index 959798e..386c2af 100644
--- a/core/src/test/java/org/apache/jsieve/MultipleToTest.java
+++ b/core/src/test/java/org/apache/jsieve/MultipleToTest.java
@@ -19,15 +19,15 @@
package org.apache.jsieve;
+import org.apache.jsieve.util.check.ScriptChecker;
+import org.junit.Assert;
+import org.junit.Test;
+
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.util.List;
-import junit.framework.TestCase;
-
-import org.apache.jsieve.util.check.ScriptChecker;
-
-public class MultipleToTest extends TestCase {
+public class MultipleToTest {
private static final String SOLO_TO_EMAIL = "Date: Sun, 1 Apr 2007 1100:00:00 +0100 (BST)\r\n"
+ "From: roadrunner@acme.example.com\r\n"
@@ -50,30 +50,32 @@
+ "if address :is :all \"to\" \"elmer@hunters.example.org\" {\r\n"
+ " fileinto \"elmer\";\r\n}\r\n";
+ @org.junit.Test
public void testSingleTo() throws Exception {
ScriptChecker checker = new ScriptChecker();
ScriptChecker.Results results = checker.check(toStream(SOLO_TO_EMAIL),
toStream(FILTER_SCRIPT));
if (results.getException() != null) {
- fail(results.getException().toString());
+ Assert.fail(results.getException().toString());
}
final List actionsExecuted = results.getActionsExecuted();
- assertEquals(1, actionsExecuted.size());
- assertTrue(results.isActionFileInto("coyote", 0));
+ Assert.assertEquals(1, actionsExecuted.size());
+ Assert.assertTrue(results.isActionFileInto("coyote", 0));
}
+ @Test
public void testMultipleTo() throws Exception {
ScriptChecker checker = new ScriptChecker();
ScriptChecker.Results results = checker.check(
toStream(MULTIPLE_TO_EMAIL), toStream(FILTER_SCRIPT));
if (results.getException() != null) {
- fail(results.getException().toString());
+ Assert.fail(results.getException().toString());
}
final List actionsExecuted = results.getActionsExecuted();
- assertEquals(3, actionsExecuted.size());
- assertTrue(results.isActionFileInto("coyote", 0));
- assertTrue(results.isActionFileInto("bugs", 1));
- assertTrue(results.isActionFileInto("elmer", 2));
+ Assert.assertEquals(3, actionsExecuted.size());
+ Assert.assertTrue(results.isActionFileInto("coyote", 0));
+ Assert.assertTrue(results.isActionFileInto("bugs", 1));
+ Assert.assertTrue(results.isActionFileInto("elmer", 2));
}
private InputStream toStream(String in) throws Exception {
diff --git a/core/src/test/java/org/apache/jsieve/NotTest.java b/core/src/test/java/org/apache/jsieve/NotTest.java
index 3e82ae3..63482a2 100644
--- a/core/src/test/java/org/apache/jsieve/NotTest.java
+++ b/core/src/test/java/org/apache/jsieve/NotTest.java
@@ -19,22 +19,23 @@
package org.apache.jsieve;
-import junit.framework.TestCase;
-
import org.apache.jsieve.commands.ThrowTestException;
import org.apache.jsieve.exception.SieveException;
import org.apache.jsieve.exception.SyntaxException;
import org.apache.jsieve.parser.generated.ParseException;
import org.apache.jsieve.utils.JUnitUtils;
+import org.junit.Assert;
+import org.junit.Test;
/**
* Class NotTest
*/
-public class NotTest extends TestCase {
+public class NotTest {
/**
* Test for Test 'not'
*/
+ @org.junit.Test
public void testIfNotFalse() {
boolean isTestPassed = false;
String script = "if not false {throwTestException;}";
@@ -46,12 +47,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'true' with invalid argument
*/
+ @Test
public void testInvalidArgument() {
boolean isTestPassed = false;
String script = "if not 1 {throwTestException;}";
@@ -63,7 +65,7 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
}
diff --git a/core/src/test/java/org/apache/jsieve/OpenedAddress.java b/core/src/test/java/org/apache/jsieve/OpenedAddress.java
index 4c42c67..c1d7658 100644
--- a/core/src/test/java/org/apache/jsieve/OpenedAddress.java
+++ b/core/src/test/java/org/apache/jsieve/OpenedAddress.java
@@ -19,7 +19,6 @@
package org.apache.jsieve;
-import org.apache.jsieve.SieveContext;
import org.apache.jsieve.exception.SieveException;
import org.apache.jsieve.mail.MailAdapter;
import org.apache.jsieve.tests.Address;
@@ -27,8 +26,8 @@
final class OpenedAddress extends Address {
protected boolean match(MailAdapter mail, String addressPart,
- String comparator, String matchType, String headerName, String key,
- SieveContext context) throws SieveException {
+ String comparator, String matchType, String headerName, String key,
+ SieveContext context) throws SieveException {
return super.match(mail, addressPart, comparator, matchType,
headerName, key, context);
}
diff --git a/core/src/test/java/org/apache/jsieve/QuotingTest.java b/core/src/test/java/org/apache/jsieve/QuotingTest.java
index 5250545..8cb0335 100644
--- a/core/src/test/java/org/apache/jsieve/QuotingTest.java
+++ b/core/src/test/java/org/apache/jsieve/QuotingTest.java
@@ -19,14 +19,14 @@
package org.apache.jsieve;
-import junit.framework.TestCase;
-
import org.apache.jsieve.commands.ThrowTestException;
import org.apache.jsieve.utils.JUnitUtils;
import org.apache.jsieve.utils.SieveMailAdapter;
+import org.junit.Assert;
-public class QuotingTest extends TestCase {
+public class QuotingTest {
+ @org.junit.Test
public void testQuoteInQuotedString() throws Exception {
String script = "if header :is \"X-Test\" \"Before\\\"After\" {throwTestException;}";
@@ -35,7 +35,7 @@
mail.getMessage().addHeader("X-Test", "Before\"After");
try {
JUnitUtils.interpret(mail, script);
- fail("Expected header to be matched");
+ Assert.fail("Expected header to be matched");
} catch (ThrowTestException.TestException e) {
// expected
}
diff --git a/core/src/test/java/org/apache/jsieve/RejectTest.java b/core/src/test/java/org/apache/jsieve/RejectTest.java
index 2198478..533bbb4 100644
--- a/core/src/test/java/org/apache/jsieve/RejectTest.java
+++ b/core/src/test/java/org/apache/jsieve/RejectTest.java
@@ -19,8 +19,6 @@
package org.apache.jsieve;
-import junit.framework.TestCase;
-
import org.apache.jsieve.exception.CommandException;
import org.apache.jsieve.exception.SieveException;
import org.apache.jsieve.exception.SyntaxException;
@@ -28,15 +26,19 @@
import org.apache.jsieve.mail.MailAdapter;
import org.apache.jsieve.parser.generated.ParseException;
import org.apache.jsieve.utils.JUnitUtils;
+import org.junit.Assert;
+import static org.junit.Assert.assertTrue;
+import org.junit.Test;
/**
* Class RejectTest
*/
-public class RejectTest extends TestCase {
+public class RejectTest {
/**
* Test for Command 'reject' with invalid arguments
*/
+ @org.junit.Test
public void testInvalidArguments() {
boolean isTestPassed = false;
String script = "reject 1 ;";
@@ -48,12 +50,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Command 'reject' with an invalid block
*/
+ @Test
public void testInvalidBlock() {
boolean isTestPassed = false;
String script = "reject \"Spam not consumed here!\" {throwTestException;}";
@@ -65,12 +68,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Command 'reject'
*/
+ @Test
public void testReject() {
boolean isTestPassed = false;
String script = "reject \"Spam not consumed here!\";";
@@ -78,23 +82,24 @@
try {
MailAdapter mail = JUnitUtils.createMail();
JUnitUtils.interpret(mail, script);
- assertTrue(mail.getActions().size() == 1);
- assertTrue(mail.getActions().get(0) instanceof ActionReject);
+ Assert.assertTrue(mail.getActions().size() == 1);
+ Assert.assertTrue(mail.getActions().get(0) instanceof ActionReject);
isTestPassed = true;
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Tests that the message is correctly passed
*/
+ @Test
public void testRejectMessage() throws Exception {
String message = "Spam not consumed here!";
String script = "reject \"" + message + "\";";
- ActionReject rejection = runRejectScript(script);
- assertEquals(message, rejection.getMessage());
+ ActionReject rejection = runRejectScript(script);
+ Assert.assertEquals(message, rejection.getMessage());
}
private ActionReject runRejectScript(String script) throws SieveException, ParseException {
@@ -103,13 +108,13 @@
assertTrue(mail.getActions().size() == 1);
Object action = mail.getActions().get(0);
assertTrue(action instanceof ActionReject);
- ActionReject rejection = (ActionReject) action;
- return rejection;
+ return (ActionReject) action;
}
-
+
/**
* Test for Command 'reject'
*/
+ @Test
public void testRejectMissingMessage() {
boolean isTestPassed = false;
String script = "reject;";
@@ -117,18 +122,19 @@
try {
MailAdapter mail = JUnitUtils.createMail();
JUnitUtils.interpret(mail, script);
- assertTrue(mail.getActions().size() == 1);
- assertTrue(mail.getActions().get(0) instanceof ActionReject);
+ Assert.assertTrue(mail.getActions().size() == 1);
+ Assert.assertTrue(mail.getActions().get(0) instanceof ActionReject);
} catch (ParseException e) {
} catch (SieveException e) {
isTestPassed = true;
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for duplicate Command 'reject'
*/
+ @Test
public void testDuplicateReject() {
boolean isTestPassed = false;
String script = "reject \"Spam not consumed here!\"; reject \"Spam not consumed here!\";";
@@ -141,12 +147,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Command 'reject' preceded by another command
*/
+ @Test
public void testRejectAndAPrecedingCommand() {
boolean isTestPassed = false;
String script = "keep; reject \"Spam not consumed here!\";";
@@ -159,12 +166,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Command 'reject' followed by another command
*/
+ @Test
public void testRejectAndAFollowingCommand() {
boolean isTestPassed = false;
String script = "reject \"Spam not consumed here!\"; keep;";
@@ -177,7 +185,7 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
}
diff --git a/core/src/test/java/org/apache/jsieve/RequireMissingTest.java b/core/src/test/java/org/apache/jsieve/RequireMissingTest.java
index 57ce954..a353265 100644
--- a/core/src/test/java/org/apache/jsieve/RequireMissingTest.java
+++ b/core/src/test/java/org/apache/jsieve/RequireMissingTest.java
@@ -19,24 +19,25 @@
package org.apache.jsieve;
-import junit.framework.TestCase;
-
import org.apache.jsieve.parser.generated.ParseException;
import org.apache.jsieve.utils.JUnitUtils;
+import org.junit.Assert;
+import org.junit.Test;
/**
* Class AddressTest
*/
-public class RequireMissingTest extends TestCase {
+public class RequireMissingTest {
/**
* Tests that unsupported requires are caught before script execution.
*/
+ @org.junit.Test
public void testUnsupportedRequireNoBrackets() throws Exception {
String script = "require \"whatever\"; if address :contains [\"To\", \"From\"] \"Fish!\"{ fileinto \"aFolder\"; }";
try {
JUnitUtils.parse(script);
- fail("Expect exception to be throw during parse since command is unsupported");
+ Assert.fail("Expect exception to be throw during parse since command is unsupported");
} catch (ParseException e) {
// expected
}
@@ -45,11 +46,12 @@
/**
* Tests that unsupported requires are caught before script execution.
*/
+ @Test
public void testUnsupportedRequireMultiple() throws Exception {
String script = "require [\"fileinto\",\"whatever\"]; if address :contains [\"To\", \"From\"] \"Fish!\"{ fileinto \"aFolder\"; }";
try {
JUnitUtils.parse(script);
- fail("Expect exception to be throw during parse since command is unsupported");
+ Assert.fail("Expect exception to be throw during parse since command is unsupported");
} catch (ParseException e) {
// expected
}
@@ -58,11 +60,12 @@
/**
* Tests that unsupported requires are caught before script execution.
*/
+ @Test
public void testUnsupportedRequire() throws Exception {
String script = "require [\"whatever\"]; if address :contains [\"To\", \"From\"] \"Fish!\"{ fileinto \"aFolder\"; }";
try {
JUnitUtils.parse(script);
- fail("Expect exception to be throw during parse since command is unsupported");
+ Assert.fail("Expect exception to be throw during parse since command is unsupported");
} catch (ParseException e) {
// expected
}
@@ -73,11 +76,12 @@
* enabled with "required" they must treat it as if they do not support it
* at all.
*/
+ @Test
public void testMissingRequire() throws Exception {
String script = "if address :contains [\"To\", \"From\"] \"Fish!\"{ bogus \"aFolder\"; }";
try {
JUnitUtils.parse(script);
- fail("Expect exception to be throw during parse since command is missing");
+ Assert.fail("Expect exception to be throw during parse since command is missing");
} catch (ParseException e) {
// expected
}
@@ -87,11 +91,12 @@
* Tests 3.2 Control Structure Require: Require MUST NOT be used after any
* other command.
*/
+ @Test
public void testRequireAfterOtherCommand() throws Exception {
String script = "if address :contains [\"To\", \"From\"] \"Fish!\"{ fileinto \"aFolder\"; } require [\"whatever\"]; ";
try {
JUnitUtils.parse(script);
- fail("Expect exception to be throw during parse");
+ Assert.fail("Expect exception to be throw during parse");
} catch (ParseException e) {
// expected
}
diff --git a/core/src/test/java/org/apache/jsieve/RequireTest.java b/core/src/test/java/org/apache/jsieve/RequireTest.java
index 92d1135..d22fb63 100644
--- a/core/src/test/java/org/apache/jsieve/RequireTest.java
+++ b/core/src/test/java/org/apache/jsieve/RequireTest.java
@@ -19,21 +19,22 @@
package org.apache.jsieve;
-import junit.framework.TestCase;
-
import org.apache.jsieve.exception.SieveException;
import org.apache.jsieve.exception.SyntaxException;
import org.apache.jsieve.parser.generated.ParseException;
import org.apache.jsieve.utils.JUnitUtils;
+import org.junit.Assert;
+import org.junit.Test;
/**
* Class RequireTest
*/
-public class RequireTest extends TestCase {
+public class RequireTest {
/**
* Test for Command 'require' with a single command that is present
*/
+ @org.junit.Test
public void testSingleCommandSatisfied() {
boolean isTestPassed = false;
String script = "require \"if\";";
@@ -44,12 +45,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Command 'require' with a single test that is present
*/
+ @Test
public void testSingleTestSatisfied() throws Exception {
String script = "require \"true\";";
JUnitUtils.interpret(JUnitUtils.createMail(), script);
@@ -58,6 +60,7 @@
/**
* Test for Command 'require' with multiple commands that are present
*/
+ @Test
public void testMultipleCommandSatisfied() throws Exception {
String script = "require [\"if\", \"elsif\", \"else\"];";
JUnitUtils.interpret(JUnitUtils.createMail(), script);
@@ -66,6 +69,7 @@
/**
* Test for Command 'require' with multiple tests that are present
*/
+ @Test
public void testMultipleTestSatisfied() throws Exception {
String script = "require [\"true\", \"false\", \"not\"];";
JUnitUtils.interpret(JUnitUtils.createMail(), script);
@@ -74,6 +78,7 @@
/**
* Test for Command 'require' with a single command that is absent
*/
+ @Test
public void testSingleCommandUnsatisfied() throws Exception {
boolean isTestPassed = false;
String script = "require \"absent\";";
@@ -83,12 +88,13 @@
} catch (ParseException e) {
isTestPassed = true;
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Command 'require' with a single test that is absent
*/
+ @Test
public void testSingleTestUnsatisfied() throws Exception {
boolean isTestPassed = false;
String script = "require \"absent\";";
@@ -98,12 +104,13 @@
} catch (ParseException e) {
isTestPassed = true;
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Command 'require' for missing argument
*/
+ @Test
public void testMissingArgument() throws Exception {
boolean isTestPassed = false;
String script = "require;";
@@ -113,12 +120,13 @@
} catch (SyntaxException e) {
isTestPassed = true;
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Command 'require' for extra argument
*/
+ @Test
public void testExtraArgument() throws Exception {
boolean isTestPassed = false;
String script = "require \"if\" 1;";
@@ -128,12 +136,13 @@
} catch (SyntaxException e) {
isTestPassed = true;
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Command 'require' rejecting Blocks
*/
+ @Test
public void testRejectBlock() throws Exception {
boolean isTestPassed = false;
String script = "require \"if\" {stop;}";
@@ -143,12 +152,13 @@
} catch (SyntaxException e) {
isTestPassed = true;
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Command 'require' after a Command
*/
+ @Test
public void testInterveningCommand() throws Exception {
boolean isTestPassed = false;
String script = "fileinto \"someplace\"; require \"fileinto\";";
@@ -158,12 +168,13 @@
} catch (ParseException e) {
isTestPassed = true;
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Command 'require' rejecting invalid arguments
*/
+ @Test
public void testRejectInvalidArgument() throws Exception {
boolean isTestPassed = false;
String script = "require 1 ;";
@@ -173,13 +184,14 @@
} catch (SyntaxException e) {
isTestPassed = true;
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Command 'require' with a multiple commands of which one is
* absent
*/
+ @Test
public void testMultipleCommandsUnsatisfied() throws Exception {
boolean isTestPassed = false;
String script = "require [\"if\", \"elsif\", \"absent\"];";
@@ -189,12 +201,13 @@
} catch (ParseException e) {
isTestPassed = true;
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Command 'require' with a multiple tests of which one is absent
*/
+ @Test
public void testMultipleTestsUnsatisfied() throws Exception {
boolean isTestPassed = false;
String script = "require [\"true\", \"false\", \"absent\"];";
@@ -204,7 +217,7 @@
} catch (ParseException e) {
isTestPassed = true;
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
}
diff --git a/core/src/test/java/org/apache/jsieve/SieveParserVisitorImplQuoteTest.java b/core/src/test/java/org/apache/jsieve/SieveParserVisitorImplQuoteTest.java
index f951f30..80c6f8e 100644
--- a/core/src/test/java/org/apache/jsieve/SieveParserVisitorImplQuoteTest.java
+++ b/core/src/test/java/org/apache/jsieve/SieveParserVisitorImplQuoteTest.java
@@ -19,33 +19,34 @@
package org.apache.jsieve;
-import java.util.ArrayList;
-import java.util.List;
-
-import junit.framework.TestCase;
-
import org.apache.commons.logging.LogFactory;
import org.apache.jsieve.parser.generated.ASTstring;
import org.apache.jsieve.parser.generated.Node;
import org.apache.jsieve.utils.JUnitUtils;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
-public class SieveParserVisitorImplQuoteTest extends TestCase {
+import java.util.ArrayList;
+import java.util.List;
-
+public class SieveParserVisitorImplQuoteTest {
+
+
SieveParserVisitorImpl visitor;
List data;
ASTstring node;
- protected void setUp() throws Exception {
- super.setUp();
+ @Before
+ public void setUp() throws Exception {
final ConfigurationManager configurationManager = new ConfigurationManager();
visitor = new SieveParserVisitorImpl(new BaseSieveContext(
configurationManager.getCommandManager(), configurationManager
- .getComparatorManager(), configurationManager
- .getTestManager(), LogFactory
- .getLog(SieveParserVisitorImplQuoteTest.class)));
+ .getComparatorManager(), configurationManager
+ .getTestManager(), LogFactory
+ .getLog(SieveParserVisitorImplQuoteTest.class)));
data = new ArrayList();
}
@@ -54,56 +55,62 @@
Node node = JUnitUtils.parse("fileinto " + value + ";");
return (ASTstring) node.jjtGetChild(0).jjtGetChild(0).jjtGetChild(0).jjtGetChild(0).jjtGetChild(0).jjtGetChild(0);
}
-
+
+ @org.junit.Test
public void testVisitASTstringObjectQuoted() throws Exception {
node = stringNode("\"value\"");
visitor.visit(node, data);
- assertEquals("Data value added after quotes stripped", 1, data.size());
- assertEquals("Data value added after quotes stripped", "value", data
+ Assert.assertEquals("Data value added after quotes stripped", 1, data.size());
+ Assert.assertEquals("Data value added after quotes stripped", "value", data
.get(0));
}
+ @Test
public void testVisitASTstringObjectQuoteInQuoted() throws Exception {
-
+
node = stringNode("\"val\\\"ue\"");
visitor.visit(node, data);
- assertEquals("Data value added after quotes stripped", 1, data.size());
- assertEquals("Data value added after quotes stripped", "val\"ue", data
+ Assert.assertEquals("Data value added after quotes stripped", 1, data.size());
+ Assert.assertEquals("Data value added after quotes stripped", "val\"ue", data
.get(0));
}
+ @Test
public void testVisitASTstringObjectDoubleSlashQuoted() throws Exception {
node = stringNode("\"val\\\\ue\"");
visitor.visit(node, data);
- assertEquals("Data value added after quotes stripped", 1, data.size());
- assertEquals("Data value added after quotes stripped", "val\\ue", data
+ Assert.assertEquals("Data value added after quotes stripped", 1, data.size());
+ Assert.assertEquals("Data value added after quotes stripped", "val\\ue", data
.get(0));
}
+ @Test
public void testVisitASTstringObjectSlashQuoted() throws Exception {
node = stringNode("\"value\"");
visitor.visit(node, data);
- assertEquals("Data value added after quotes stripped", 1, data.size());
- assertEquals("Data value added after quotes stripped", "value", data
+ Assert.assertEquals("Data value added after quotes stripped", 1, data.size());
+ Assert.assertEquals("Data value added after quotes stripped", "value", data
.get(0));
}
+ @Test
public void testVisitASTstringEmptyQuoted() throws Exception {
node = stringNode("\"\"");
visitor.visit(node, data);
- assertEquals("Data value added after quotes stripped", 1, data.size());
- assertEquals("Data value added after quotes stripped", "", data.get(0));
+ Assert.assertEquals("Data value added after quotes stripped", 1, data.size());
+ Assert.assertEquals("Data value added after quotes stripped", "", data.get(0));
}
+ @Test
public void testVisitASTstringObjectMultiSlashQuoted() throws Exception {
node = stringNode("\"v\\\\al\\\\ue\\\\\"");
visitor.visit(node, data);
- assertEquals("Data value added after quotes stripped", 1, data.size());
- assertEquals("Data value added after quotes stripped", "v\\al\\ue\\",
+ Assert.assertEquals("Data value added after quotes stripped", 1, data.size());
+ Assert.assertEquals("Data value added after quotes stripped", "v\\al\\ue\\",
data.get(0));
}
}
diff --git a/core/src/test/java/org/apache/jsieve/SizeTest.java b/core/src/test/java/org/apache/jsieve/SizeTest.java
index cc18bb6..ff6fd1f 100644
--- a/core/src/test/java/org/apache/jsieve/SizeTest.java
+++ b/core/src/test/java/org/apache/jsieve/SizeTest.java
@@ -19,25 +19,26 @@
package org.apache.jsieve;
-import javax.mail.MessagingException;
-
-import junit.framework.TestCase;
-
import org.apache.jsieve.commands.ThrowTestException;
import org.apache.jsieve.exception.SieveException;
import org.apache.jsieve.mail.SieveMailException;
import org.apache.jsieve.parser.generated.ParseException;
import org.apache.jsieve.utils.JUnitUtils;
import org.apache.jsieve.utils.SieveMailAdapter;
+import org.junit.Assert;
+import org.junit.Test;
+
+import javax.mail.MessagingException;
/**
* Class SizeTest
*/
-public class SizeTest extends TestCase {
+public class SizeTest {
/**
* Test for Test 'size'
*/
+ @org.junit.Test
public void testSizeIsOverTrue() {
boolean isTestPassed = false;
SieveMailAdapter mail = null;
@@ -59,19 +60,18 @@
try {
JUnitUtils.interpret(mail, script);
- }
-
- catch (ThrowTestException.TestException e) {
+ } catch (ThrowTestException.TestException e) {
isTestPassed = true;
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'size'
*/
+ @Test
public void testSizeIsOverFalse() {
boolean isTestPassed = false;
SieveMailAdapter mail = null;
@@ -94,18 +94,17 @@
JUnitUtils.interpret(mail, script);
isTestPassed = true;
- }
-
- catch (ThrowTestException.TestException e) {
+ } catch (ThrowTestException.TestException e) {
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'size'
*/
+ @Test
public void testSizeIsUnderTrue() {
boolean isTestPassed = false;
SieveMailAdapter mail = null;
@@ -127,19 +126,18 @@
try {
JUnitUtils.interpret(mail, script);
- }
-
- catch (ThrowTestException.TestException e) {
+ } catch (ThrowTestException.TestException e) {
isTestPassed = true;
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'size'
*/
+ @Test
public void testSizeIsUnderFalse() {
boolean isTestPassed = false;
SieveMailAdapter mail = null;
@@ -162,18 +160,17 @@
JUnitUtils.interpret(mail, script);
isTestPassed = true;
- }
-
- catch (ThrowTestException.TestException e) {
+ } catch (ThrowTestException.TestException e) {
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
-
+
/**
* Test for Test 'size' with quantifier
*/
+ @Test
public void testSizeIsWithQuantifier() throws Exception {
boolean isTestPassed = false;
SieveMailAdapter mail = (SieveMailAdapter) JUnitUtils.createMail();
@@ -188,13 +185,11 @@
JUnitUtils.interpret(mail, script);
isTestPassed = true;
- }
-
- catch (ThrowTestException.TestException e) {
+ } catch (ThrowTestException.TestException e) {
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
}
diff --git a/core/src/test/java/org/apache/jsieve/StopTest.java b/core/src/test/java/org/apache/jsieve/StopTest.java
index df2bcf6..47c1f43 100644
--- a/core/src/test/java/org/apache/jsieve/StopTest.java
+++ b/core/src/test/java/org/apache/jsieve/StopTest.java
@@ -19,8 +19,6 @@
package org.apache.jsieve;
-import junit.framework.TestCase;
-
import org.apache.jsieve.commands.ThrowTestException;
import org.apache.jsieve.exception.SieveException;
import org.apache.jsieve.exception.SyntaxException;
@@ -28,15 +26,18 @@
import org.apache.jsieve.mail.MailAdapter;
import org.apache.jsieve.parser.generated.ParseException;
import org.apache.jsieve.utils.JUnitUtils;
+import org.junit.Assert;
+import org.junit.Test;
/**
* Class StopTest
*/
-public class StopTest extends TestCase {
+public class StopTest {
/**
* Test for Command 'stop'. This has an implicit Keep.
*/
+ @org.junit.Test
public void testStop() {
boolean isTestPassed = false;
String script = "stop; throwTestException;";
@@ -44,19 +45,20 @@
try {
MailAdapter mail = JUnitUtils.createMail();
JUnitUtils.interpret(mail, script);
- assertTrue(mail.getActions().size() == 1);
- assertTrue(mail.getActions().get(0) instanceof ActionKeep);
+ Assert.assertTrue(mail.getActions().size() == 1);
+ Assert.assertTrue(mail.getActions().get(0) instanceof ActionKeep);
isTestPassed = true;
} catch (ThrowTestException.TestException e) {
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Command 'stop' with invalid arguments
*/
+ @Test
public void testInvalidArguments() {
boolean isTestPassed = false;
String script = "stop 1 ;";
@@ -68,12 +70,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Command 'stop' with an invalid block
*/
+ @Test
public void testInvalidBlock() {
boolean isTestPassed = false;
String script = "stop 1 {throwTestException;}";
@@ -85,7 +88,7 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
}
diff --git a/core/src/test/java/org/apache/jsieve/TrueTest.java b/core/src/test/java/org/apache/jsieve/TrueTest.java
index 7bfd769..0fef668 100644
--- a/core/src/test/java/org/apache/jsieve/TrueTest.java
+++ b/core/src/test/java/org/apache/jsieve/TrueTest.java
@@ -19,22 +19,23 @@
package org.apache.jsieve;
-import junit.framework.TestCase;
-
import org.apache.jsieve.commands.ThrowTestException;
import org.apache.jsieve.exception.SieveException;
import org.apache.jsieve.exception.SyntaxException;
import org.apache.jsieve.parser.generated.ParseException;
import org.apache.jsieve.utils.JUnitUtils;
+import org.junit.Assert;
+import org.junit.Test;
/**
* Class TrueTest
*/
-public class TrueTest extends TestCase {
+public class TrueTest {
/**
* Test for Test 'true'
*/
+ @org.junit.Test
public void testIfTrue() {
boolean isTestPassed = false;
String script = "if true {throwTestException;}";
@@ -46,12 +47,13 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
/**
* Test for Test 'true' with invalid argument
*/
+ @Test
public void testInvalidArgument() {
boolean isTestPassed = false;
String script = "if true 1 {throwTestException;}";
@@ -63,7 +65,7 @@
} catch (ParseException e) {
} catch (SieveException e) {
}
- assertTrue(isTestPassed);
+ Assert.assertTrue(isTestPassed);
}
}
diff --git a/core/src/test/java/org/apache/jsieve/WierdAddressTest.java b/core/src/test/java/org/apache/jsieve/WierdAddressTest.java
index a6540dd..a0d60f7 100644
--- a/core/src/test/java/org/apache/jsieve/WierdAddressTest.java
+++ b/core/src/test/java/org/apache/jsieve/WierdAddressTest.java
@@ -19,21 +19,20 @@
package org.apache.jsieve;
-import junit.framework.TestCase;
-
import org.apache.jsieve.utils.JUnitUtils;
import org.apache.jsieve.utils.SieveMailAdapter;
-public class WierdAddressTest extends TestCase {
+public class WierdAddressTest {
/**
* My god - it's full of stars
*/
+ @org.junit.Test
public void testShouldParseAddressWithLotsOfStars() throws Exception {
String script = "if anyof (header :matches \"from\"" +
- "\"**********************************************address@yahoo.com\" ," +
- "header :is \"subject\" \"5\" )" +
- "{ fileinto \"Whatever\"; stop;}";
+ "\"**********************************************address@yahoo.com\" ," +
+ "header :is \"subject\" \"5\" )" +
+ "{ fileinto \"Whatever\"; stop;}";
SieveMailAdapter mail = (SieveMailAdapter) JUnitUtils.createMail();
mail.getMessage().addHeader("From", "user@domain");
JUnitUtils.interpret(mail, script);
diff --git a/core/src/test/java/org/apache/jsieve/commands/optional/FileIntoTest.java b/core/src/test/java/org/apache/jsieve/commands/optional/FileIntoTest.java
index 7d700bf..4d6947b 100644
--- a/core/src/test/java/org/apache/jsieve/commands/optional/FileIntoTest.java
+++ b/core/src/test/java/org/apache/jsieve/commands/optional/FileIntoTest.java
@@ -18,12 +18,6 @@
****************************************************************/
package org.apache.jsieve.commands.optional;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import junit.framework.TestCase;
-
import org.apache.commons.logging.LogFactory;
import org.apache.jsieve.Argument;
import org.apache.jsieve.Arguments;
@@ -35,18 +29,24 @@
import org.apache.jsieve.TestList;
import org.apache.jsieve.mail.ActionFileInto;
import org.apache.jsieve.util.check.ScriptCheckMailAdapter;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
-public class FileIntoTest extends TestCase {
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+public class FileIntoTest {
FileInto subject;
-
+
ScriptCheckMailAdapter mockAdapter;
Arguments dummyArguments;
SieveContext dummyContext;
-
- @SuppressWarnings("unchecked")
- protected void setUp() throws Exception {
- super.setUp();
+
+ @Before
+ public void setUp() throws Exception {
mockAdapter = new ScriptCheckMailAdapter();
List<String> stringList = new ArrayList<String>();
stringList.add("Whatever");
@@ -56,24 +56,21 @@
ConfigurationManager configurationManager = new ConfigurationManager();
dummyContext = new BaseSieveContext(
configurationManager.getCommandManager(), configurationManager
- .getComparatorManager(), configurationManager
- .getTestManager(), LogFactory
- .getLog(this.getClass()));
+ .getComparatorManager(), configurationManager
+ .getTestManager(), LogFactory
+ .getLog(this.getClass()));
dummyContext.setCoordinate(new ScriptCoordinate(0, 0, 0, 0));
subject = new FileInto();
}
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-
+ @Test
public void testFileIntoShouldNotAllowMultipleFileIntoActions() throws Exception {
subject.execute(mockAdapter, dummyArguments, null, dummyContext);
- assertEquals(1, mockAdapter.getActions().size());
- assertTrue(mockAdapter.getActions().get(0) instanceof ActionFileInto);
-
+ Assert.assertEquals(1, mockAdapter.getActions().size());
+ Assert.assertTrue(mockAdapter.getActions().get(0) instanceof ActionFileInto);
+
subject.execute(mockAdapter, dummyArguments, null, dummyContext);
- assertEquals(1, mockAdapter.getActions().size());
- assertTrue(mockAdapter.getActions().get(0) instanceof ActionFileInto);
+ Assert.assertEquals(1, mockAdapter.getActions().size());
+ Assert.assertTrue(mockAdapter.getActions().get(0) instanceof ActionFileInto);
}
}
diff --git a/core/src/test/java/org/apache/jsieve/comparator/ComparatorUtilsTest.java b/core/src/test/java/org/apache/jsieve/comparator/ComparatorUtilsTest.java
index b1e679f..fd12591 100644
--- a/core/src/test/java/org/apache/jsieve/comparator/ComparatorUtilsTest.java
+++ b/core/src/test/java/org/apache/jsieve/comparator/ComparatorUtilsTest.java
@@ -19,39 +19,40 @@
package org.apache.jsieve.comparator;
-import junit.framework.TestCase;
-
import org.apache.jsieve.comparators.ComparatorUtils;
import org.apache.jsieve.exception.SievePatternException;
+import org.junit.Assert;
+import org.junit.Test;
-public class ComparatorUtilsTest extends TestCase {
+public class ComparatorUtilsTest {
+ @Test
public void testMatchesStringString() throws SievePatternException {
String sievematch = "[test] ?\\\\?\\?*\\\\*\\*\\";
- assertTrue(ComparatorUtils.matches("[test] a\\x?foo\\bar*\\",
+ Assert.assertTrue(ComparatorUtils.matches("[test] a\\x?foo\\bar*\\",
sievematch));
- assertFalse(ComparatorUtils.matches("[test] ab\\x?foo\\bar*\\",
+ Assert.assertFalse(ComparatorUtils.matches("[test] ab\\x?foo\\bar*\\",
sievematch));
- assertFalse(ComparatorUtils.matches("[test]a\\x?foo\\bar*\\",
+ Assert.assertFalse(ComparatorUtils.matches("[test]a\\x?foo\\bar*\\",
sievematch));
- assertFalse(ComparatorUtils.matches("[tst] a\\x?foo\\bar*\\",
+ Assert.assertFalse(ComparatorUtils.matches("[tst] a\\x?foo\\bar*\\",
sievematch));
- assertFalse(ComparatorUtils.matches("[test] a\\\\x?foo\\bar*\\",
+ Assert.assertFalse(ComparatorUtils.matches("[test] a\\\\x?foo\\bar*\\",
sievematch));
- assertFalse(ComparatorUtils.matches("[test] a\\?foo\\bar*\\",
+ Assert.assertFalse(ComparatorUtils.matches("[test] a\\?foo\\bar*\\",
sievematch));
- assertFalse(ComparatorUtils.matches("[test] a\\xafoo\\bar*\\",
+ Assert.assertFalse(ComparatorUtils.matches("[test] a\\xafoo\\bar*\\",
sievematch));
- assertTrue(ComparatorUtils.matches("[test] a\\x?\\bar*\\", sievematch));
- assertTrue(ComparatorUtils.matches("[test] a\\x?foo\\\\bar*\\",
+ Assert.assertTrue(ComparatorUtils.matches("[test] a\\x?\\bar*\\", sievematch));
+ Assert.assertTrue(ComparatorUtils.matches("[test] a\\x?foo\\\\bar*\\",
sievematch));
- assertFalse(ComparatorUtils
+ Assert.assertFalse(ComparatorUtils
.matches("[test] a\\x?foobar*\\", sievematch));
- assertFalse(ComparatorUtils.matches("[test] a\\x?foo\\bar.\\",
+ Assert.assertFalse(ComparatorUtils.matches("[test] a\\x?foo\\bar.\\",
sievematch));
- assertFalse(ComparatorUtils.matches("[test] a\\x?foo\\bar*\\\\",
+ Assert.assertFalse(ComparatorUtils.matches("[test] a\\x?foo\\bar*\\\\",
sievematch));
- assertFalse(ComparatorUtils
+ Assert.assertFalse(ComparatorUtils
.matches("[test] a\\x?foo\\bar*", sievematch));
}
@@ -64,11 +65,11 @@
* is commonplace in several programming languages that use globs and
* regular expressions.
*/
+ @Test
public void testSieveToJavaRegex() {
String sievematch = "[test] ?\\\\?\\?*\\\\*\\*\\";
String res = ComparatorUtils.sieveToJavaRegex(sievematch);
String expected = "\\[test\\] .\\\\.\\?.*\\\\.*\\*\\\\";
- assertEquals(expected, res);
+ Assert.assertEquals(expected, res);
}
-
}
diff --git a/core/src/test/java/org/apache/jsieve/comparators/AsciiNumericTest.java b/core/src/test/java/org/apache/jsieve/comparators/AsciiNumericTest.java
index 0d29dd5..0a8ba16 100644
--- a/core/src/test/java/org/apache/jsieve/comparators/AsciiNumericTest.java
+++ b/core/src/test/java/org/apache/jsieve/comparators/AsciiNumericTest.java
@@ -18,76 +18,82 @@
****************************************************************/
package org.apache.jsieve.comparators;
-import junit.framework.TestCase;
-
import org.apache.jsieve.exception.FeatureException;
import org.apache.jsieve.parser.generated.ParseException;
import org.apache.jsieve.utils.JUnitUtils;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
-public class AsciiNumericTest extends TestCase {
-
+public class AsciiNumericTest {
+
AsciiNumeric subject;
- protected void setUp() throws Exception {
- super.setUp();
+ @Before
+ public void setUp() throws Exception {
subject = new AsciiNumeric();
}
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-
+ @Test
public void testVerificationFailsWhenAsciiNumericIsNotRequired() throws Exception {
String script = "if header :contains :comparator \"i;ascii-numeric\" \"Subject\" \"69\" {stop;}";
try {
JUnitUtils.interpret(JUnitUtils.createMail(), script);
- fail("Comparator must be declared in require statement");
+ Assert.fail("Comparator must be declared in require statement");
} catch (ParseException e) {
// Expected
}
}
-
+
+ @Test
public void testVerificationPassesWhenAsciiNumericIsRequired() throws Exception {
String script = "require [\"comparator-i;ascii-numeric\"]; if header :is :comparator \"i;ascii-numeric\" \"Subject\" \"69\" {stop;}";
JUnitUtils.interpret(JUnitUtils.createMail(), script);
}
-
+
+ @Test
public void testBasicNumbericEquality() throws Exception {
- assertFalse(subject.equals("1", "2"));
- assertTrue(subject.equals("1", "1"));
+ Assert.assertFalse(subject.equals("1", "2"));
+ Assert.assertTrue(subject.equals("1", "1"));
}
-
+
+ @Test
public void testEqualityShouldIgnoreTrailingCharacters() throws Exception {
- assertTrue(subject.equals("01", "1A"));
- assertTrue(subject.equals("1", "00000000000000001A"));
- assertTrue(subject.equals("234S", "234YTGSDBBSD"));
+ Assert.assertTrue(subject.equals("01", "1A"));
+ Assert.assertTrue(subject.equals("1", "00000000000000001A"));
+ Assert.assertTrue(subject.equals("234S", "234YTGSDBBSD"));
}
-
+
+ @Test
public void testEqualityShouldIgnoreLeadingZeros() throws Exception {
- assertTrue(subject.equals("01", "1"));
- assertTrue(subject.equals("000001", "1"));
- assertFalse(subject.equals("000001", "10"));
+ Assert.assertTrue(subject.equals("01", "1"));
+ Assert.assertTrue(subject.equals("000001", "1"));
+ Assert.assertFalse(subject.equals("000001", "10"));
}
-
+
+ @Test
public void testStingsThatDoNotStartWithADigitRepresentPositiveInfinityWhenUsedInEquality() throws Exception {
- assertFalse(subject.equals("1", "A4"));
- assertFalse(subject.equals("x", "4"));
- assertTrue(subject.equals("GT", "A4"));
+ Assert.assertFalse(subject.equals("1", "A4"));
+ Assert.assertFalse(subject.equals("x", "4"));
+ Assert.assertTrue(subject.equals("GT", "A4"));
}
-
+
+ @Test
public void testSubstringIsNotSupported() throws Exception {
try {
subject.contains("234234", "34");
- fail("Substring is unsupported");
+ Assert.fail("Substring is unsupported");
} catch (FeatureException e) {
// Expected
}
}
-
+
+ @Test
public void testMatchNotSupported() throws Exception {
try {
subject.matches("234234", "34");
- fail("Substring is unsupported");
+ Assert.fail("Substring is unsupported");
} catch (FeatureException e) {
// Expected
}
diff --git a/core/src/test/java/org/apache/jsieve/comparators/RequireComparatorTest.java b/core/src/test/java/org/apache/jsieve/comparators/RequireComparatorTest.java
index 777873d..cf61d2c 100644
--- a/core/src/test/java/org/apache/jsieve/comparators/RequireComparatorTest.java
+++ b/core/src/test/java/org/apache/jsieve/comparators/RequireComparatorTest.java
@@ -18,36 +18,31 @@
****************************************************************/
package org.apache.jsieve.comparators;
-import junit.framework.TestCase;
-
import org.apache.jsieve.parser.generated.ParseException;
import org.apache.jsieve.utils.JUnitUtils;
+import org.junit.Assert;
+import org.junit.Test;
-public class RequireComparatorTest extends TestCase {
+public class RequireComparatorTest {
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-
+ @Test
public void testAsciiCasemapShouldBeImplicitlyDeclared() throws Exception {
String script = "if header :contains :comparator \"i;ascii-casemap\" \"Subject\" \"69\" {stop;}";
JUnitUtils.interpret(JUnitUtils.createMail(), script);
}
-
+
+ @Test
public void testOctetShouldBeImplicitlyDeclared() throws Exception {
String script = "if header :contains :comparator \"i;octet\" \"Subject\" \"69\" {stop;}";
JUnitUtils.interpret(JUnitUtils.createMail(), script);
}
-
+
+ @Test
public void testBogusComparatorShouldFailAtParseTime() throws Exception {
String script = "if header :contains :comparator \"i;bogus\" \"Subject\" \"69\" {stop;}";
try {
JUnitUtils.interpret(JUnitUtils.createMail(), script);
- fail("Bogus comparator should fail");
+ Assert.fail("Bogus comparator should fail");
} catch (ParseException e) {
// TODO: catch more finely grained exception
// Expected
diff --git a/core/src/test/java/org/apache/jsieve/parser/SieveNodeCommentTest.java b/core/src/test/java/org/apache/jsieve/parser/SieveNodeCommentTest.java
index 10f6d73..02ed951 100644
--- a/core/src/test/java/org/apache/jsieve/parser/SieveNodeCommentTest.java
+++ b/core/src/test/java/org/apache/jsieve/parser/SieveNodeCommentTest.java
@@ -18,74 +18,74 @@
****************************************************************/
package org.apache.jsieve.parser;
+import org.apache.jsieve.utils.JUnitUtils;
+import org.junit.Assert;
+import org.junit.Test;
+
import java.util.List;
-import junit.framework.TestCase;
+public class SieveNodeCommentTest {
-import org.apache.jsieve.utils.JUnitUtils;
-
-public class SieveNodeCommentTest extends TestCase {
-
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-
+ @Test
public void testGetNoCommentsBefore() throws Exception {
SieveNode node = (SieveNode) JUnitUtils.parse("if address :contains [\"To\", \"From\"] \"Fish!\"{ }");
List comments = node.getPrecedingComments();
- assertNotNull(comments);
- assertEquals(0, comments.size());
+ Assert.assertNotNull(comments);
+ Assert.assertEquals(0, comments.size());
}
-
+
+ @Test
public void testGetBracketCommentsBefore() throws Exception {
SieveNode node = (SieveNode) JUnitUtils.parse("/* A Comment *//* Another comment */if address :contains [\"To\", \"From\"] \"Fish!\"{ }");
List comments = node.getPrecedingComments();
- assertNotNull(comments);
- assertEquals(2, comments.size());
- assertEquals(" A Comment ", comments.get(0));
- assertEquals(" Another comment ", comments.get(1));
+ Assert.assertNotNull(comments);
+ Assert.assertEquals(2, comments.size());
+ Assert.assertEquals(" A Comment ", comments.get(0));
+ Assert.assertEquals(" Another comment ", comments.get(1));
}
-
+
+ @Test
public void testGetHashCommentsBefore() throws Exception {
SieveNode node = (SieveNode) JUnitUtils.parse("/* A Comment */#A Line Comment\nif address :contains [\"To\", \"From\"] \"Fish!\"{ }");
List comments = node.getPrecedingComments();
- assertNotNull(comments);
- assertEquals(2, comments.size());
- assertEquals(" A Comment ", comments.get(0));
- assertEquals("A Line Comment", comments.get(1));
+ Assert.assertNotNull(comments);
+ Assert.assertEquals(2, comments.size());
+ Assert.assertEquals(" A Comment ", comments.get(0));
+ Assert.assertEquals("A Line Comment", comments.get(1));
}
-
+
+ @Test
public void testGetHashCommentsBeforeCRLF() throws Exception {
SieveNode node = (SieveNode) JUnitUtils.parse("/* A Comment */#A Line Comment\r\nif address :contains [\"To\", \"From\"] \"Fish!\"{ }");
List comments = node.getPrecedingComments();
- assertNotNull(comments);
- assertEquals(2, comments.size());
- assertEquals(" A Comment ", comments.get(0));
- assertEquals("A Line Comment", comments.get(1));
+ Assert.assertNotNull(comments);
+ Assert.assertEquals(2, comments.size());
+ Assert.assertEquals(" A Comment ", comments.get(0));
+ Assert.assertEquals("A Line Comment", comments.get(1));
}
-
+
+ @Test
public void testGetLastCommentNoneBefore() throws Exception {
SieveNode node = (SieveNode) JUnitUtils.parse("if address :contains [\"To\", \"From\"] \"Fish!\"{ }");
- assertNull(node.getLastComment());
+ Assert.assertNull(node.getLastComment());
}
-
+
+ @Test
public void testGetBracketLastCommentBefore() throws Exception {
SieveNode node = (SieveNode) JUnitUtils.parse("/* A Comment *//* Another comment */if address :contains [\"To\", \"From\"] \"Fish!\"{ }");
- assertEquals(" Another comment ", node.getLastComment());
+ Assert.assertEquals(" Another comment ", node.getLastComment());
}
-
+
+ @Test
public void testGetHashLastCommentBefore() throws Exception {
SieveNode node = (SieveNode) JUnitUtils.parse("/* A Comment */#A Line Comment\nif address :contains [\"To\", \"From\"] \"Fish!\"{ }");
- assertEquals("A Line Comment", node.getLastComment());
+ Assert.assertEquals("A Line Comment", node.getLastComment());
}
-
+
+ @Test
public void testGetHashLastCommentBeforeCRLF() throws Exception {
- SieveNode node = (SieveNode) JUnitUtils.parse("/* A Comment */#A Line Comment\r\nif address :contains [\"To\", \"From\"] \"Fish!\"{ }");;
- assertEquals("A Line Comment", node.getLastComment());
+ SieveNode node = (SieveNode) JUnitUtils.parse("/* A Comment */#A Line Comment\r\nif address :contains [\"To\", \"From\"] \"Fish!\"{ }");
+ Assert.assertEquals("A Line Comment", node.getLastComment());
}
}
diff --git a/core/src/test/java/org/apache/jsieve/parser/address/SieveAddressBuilderTest.java b/core/src/test/java/org/apache/jsieve/parser/address/SieveAddressBuilderTest.java
index 1f699b5..85af231 100644
--- a/core/src/test/java/org/apache/jsieve/parser/address/SieveAddressBuilderTest.java
+++ b/core/src/test/java/org/apache/jsieve/parser/address/SieveAddressBuilderTest.java
@@ -18,12 +18,13 @@
****************************************************************/
package org.apache.jsieve.parser.address;
-import junit.framework.TestCase;
-
import org.apache.jsieve.mail.MailAdapter.Address;
import org.apache.jsieve.parser.generated.address.ParseException;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
-public class SieveAddressBuilderTest extends TestCase {
+public class SieveAddressBuilderTest {
public static final String DOMAIN = "example.org";
@@ -44,63 +45,66 @@
SieveAddressBuilder builder;
- protected void setUp() throws Exception {
- super.setUp();
+ @Before
+ public void setUp() throws Exception {
builder = new SieveAddressBuilder();
}
+ @Test
public void testNotAddress() throws Exception {
try {
builder
.addAddresses("What a load of rubbish - not an address in sight!");
- fail("Parsing should fail when the input is not an address");
+ Assert.fail("Parsing should fail when the input is not an address");
} catch (ParseException e) {
// expected
}
}
+ @Test
public void testAddAddresses() throws Exception {
- assertNotNull(builder.getAddresses());
+ Assert.assertNotNull(builder.getAddresses());
builder.addAddresses(COYOTE_ADDRESS);
Address[] addresses = builder.getAddresses();
- assertNotNull(addresses);
- assertEquals(1, addresses.length);
- assertEquals(COYOTE, addresses[0].getLocalPart());
- assertEquals(DOMAIN, addresses[0].getDomain());
+ Assert.assertNotNull(addresses);
+ Assert.assertEquals(1, addresses.length);
+ Assert.assertEquals(COYOTE, addresses[0].getLocalPart());
+ Assert.assertEquals(DOMAIN, addresses[0].getDomain());
builder.addAddresses(HEROS);
addresses = builder.getAddresses();
- assertNotNull(addresses);
- assertEquals(3, addresses.length);
- assertEquals(COYOTE, addresses[0].getLocalPart());
- assertEquals(DOMAIN, addresses[0].getDomain());
- assertEquals(ROADRUNNER, addresses[1].getLocalPart());
- assertEquals(DOMAIN, addresses[1].getDomain());
- assertEquals(BUGS, addresses[2].getLocalPart());
- assertEquals(DOMAIN, addresses[2].getDomain());
+ Assert.assertNotNull(addresses);
+ Assert.assertEquals(3, addresses.length);
+ Assert.assertEquals(COYOTE, addresses[0].getLocalPart());
+ Assert.assertEquals(DOMAIN, addresses[0].getDomain());
+ Assert.assertEquals(ROADRUNNER, addresses[1].getLocalPart());
+ Assert.assertEquals(DOMAIN, addresses[1].getDomain());
+ Assert.assertEquals(BUGS, addresses[2].getLocalPart());
+ Assert.assertEquals(DOMAIN, addresses[2].getDomain());
}
+ @Test
public void testReset() throws Exception {
- assertNotNull(builder.getAddresses());
+ Assert.assertNotNull(builder.getAddresses());
builder.addAddresses(COYOTE_ADDRESS);
Address[] addresses = builder.getAddresses();
- assertNotNull(addresses);
- assertEquals(1, addresses.length);
- assertEquals(COYOTE, addresses[0].getLocalPart());
- assertEquals(DOMAIN, addresses[0].getDomain());
+ Assert.assertNotNull(addresses);
+ Assert.assertEquals(1, addresses.length);
+ Assert.assertEquals(COYOTE, addresses[0].getLocalPart());
+ Assert.assertEquals(DOMAIN, addresses[0].getDomain());
addresses = builder.getAddresses();
- assertNotNull(addresses);
- assertEquals(1, addresses.length);
- assertEquals(COYOTE, addresses[0].getLocalPart());
- assertEquals(DOMAIN, addresses[0].getDomain());
+ Assert.assertNotNull(addresses);
+ Assert.assertEquals(1, addresses.length);
+ Assert.assertEquals(COYOTE, addresses[0].getLocalPart());
+ Assert.assertEquals(DOMAIN, addresses[0].getDomain());
builder.reset();
addresses = builder.getAddresses();
- assertNotNull(addresses);
- assertEquals(0, addresses.length);
+ Assert.assertNotNull(addresses);
+ Assert.assertEquals(0, addresses.length);
builder.addAddresses(COYOTE_ADDRESS);
addresses = builder.getAddresses();
- assertNotNull(addresses);
- assertEquals(1, addresses.length);
- assertEquals(COYOTE, addresses[0].getLocalPart());
- assertEquals(DOMAIN, addresses[0].getDomain());
+ Assert.assertNotNull(addresses);
+ Assert.assertEquals(1, addresses.length);
+ Assert.assertEquals(COYOTE, addresses[0].getLocalPart());
+ Assert.assertEquals(DOMAIN, addresses[0].getDomain());
}
}
diff --git a/core/src/test/java/org/apache/jsieve/util/check/ScriptCheckMailAdapterActionsTest.java b/core/src/test/java/org/apache/jsieve/util/check/ScriptCheckMailAdapterActionsTest.java
index 8576cd9..3e68c01 100644
--- a/core/src/test/java/org/apache/jsieve/util/check/ScriptCheckMailAdapterActionsTest.java
+++ b/core/src/test/java/org/apache/jsieve/util/check/ScriptCheckMailAdapterActionsTest.java
@@ -19,13 +19,12 @@
package org.apache.jsieve.util.check;
-import java.util.ListIterator;
-
-import junit.framework.TestCase;
-
import org.apache.jsieve.mail.Action;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
-public class ScriptCheckMailAdapterActionsTest extends TestCase {
+public class ScriptCheckMailAdapterActionsTest {
ScriptCheckMailAdapter adapter;
@@ -33,109 +32,116 @@
Action anotherAction;
- protected void setUp() throws Exception {
- super.setUp();
+ @Before
+ public void setUp() throws Exception {
adapter = new ScriptCheckMailAdapter();
action = new MockAction();
anotherAction = new MockAction();
}
+ @Test
public void testAddAction() {
adapter.addAction(action);
- assertEquals("Running total updated", 1, adapter.getActions().size());
- assertEquals("Running total updated", action, adapter.getActions().get(
+ Assert.assertEquals("Running total updated", 1, adapter.getActions().size());
+ Assert.assertEquals("Running total updated", action, adapter.getActions().get(
0));
adapter.addAction(anotherAction);
- assertEquals("Order preserved", 2, adapter.getActions().size());
- assertEquals("Order preserved", anotherAction, adapter.getActions()
+ Assert.assertEquals("Order preserved", 2, adapter.getActions().size());
+ Assert.assertEquals("Order preserved", anotherAction, adapter.getActions()
.get(1));
}
+ @Test
public void testExecuteActions() throws Exception {
- assertNotNull(adapter.getExecutedActions());
- assertEquals("No actions executed", 0, adapter.getExecutedActions()
+ Assert.assertNotNull(adapter.getExecutedActions());
+ Assert.assertEquals("No actions executed", 0, adapter.getExecutedActions()
.size());
adapter.addAction(action);
- assertNotNull(adapter.getExecutedActions());
- assertEquals("No actions executed", 0, adapter.getExecutedActions()
+ Assert.assertNotNull(adapter.getExecutedActions());
+ Assert.assertEquals("No actions executed", 0, adapter.getExecutedActions()
.size());
adapter.executeActions();
- assertNotNull(adapter.getExecutedActions());
- assertEquals("One action executed", 1, adapter.getExecutedActions()
+ Assert.assertNotNull(adapter.getExecutedActions());
+ Assert.assertEquals("One action executed", 1, adapter.getExecutedActions()
.size());
}
+ @Test
public void testGetActions() {
- assertNotNull(adapter.getActions());
+ Assert.assertNotNull(adapter.getActions());
try {
- adapter.getActions().add(new Action() {});
- fail("Should not be able to modify collection");
+ adapter.getActions().add(new Action() {
+ });
+ Assert.fail("Should not be able to modify collection");
} catch (UnsupportedOperationException e) {
// expected
}
adapter.addAction(action);
- assertNotNull(adapter.getActions());
- assertEquals("Running total updated", 1, adapter.getActions().size());
- assertEquals("Running total updated", action, adapter.getActions().get(
+ Assert.assertNotNull(adapter.getActions());
+ Assert.assertEquals("Running total updated", 1, adapter.getActions().size());
+ Assert.assertEquals("Running total updated", action, adapter.getActions().get(
0));
adapter.addAction(anotherAction);
- assertNotNull(adapter.getActions());
- assertEquals("Order preserved", 2, adapter.getActions().size());
- assertEquals("Order preserved", anotherAction, adapter.getActions()
+ Assert.assertNotNull(adapter.getActions());
+ Assert.assertEquals("Order preserved", 2, adapter.getActions().size());
+ Assert.assertEquals("Order preserved", anotherAction, adapter.getActions()
.get(1));
}
+ @Test
public void testGetExecutedActions() throws Exception {
- assertNotNull(adapter.getExecutedActions());
- assertEquals("No actions executed", 0, adapter.getExecutedActions()
+ Assert.assertNotNull(adapter.getExecutedActions());
+ Assert.assertEquals("No actions executed", 0, adapter.getExecutedActions()
.size());
adapter.addAction(action);
- assertNotNull(adapter.getExecutedActions());
- assertEquals("No actions executed", 0, adapter.getExecutedActions()
+ Assert.assertNotNull(adapter.getExecutedActions());
+ Assert.assertEquals("No actions executed", 0, adapter.getExecutedActions()
.size());
adapter.executeActions();
- assertEquals("One action executed", 1, adapter.getExecutedActions()
+ Assert.assertEquals("One action executed", 1, adapter.getExecutedActions()
.size());
- assertEquals("One action executed", action, adapter
+ Assert.assertEquals("One action executed", action, adapter
.getExecutedActions().get(0));
adapter.addAction(anotherAction);
- assertEquals("One action executed", 1, adapter.getExecutedActions()
+ Assert.assertEquals("One action executed", 1, adapter.getExecutedActions()
.size());
- assertEquals("One action executed", action, adapter
+ Assert.assertEquals("One action executed", action, adapter
.getExecutedActions().get(0));
adapter.executeActions();
- assertEquals("Two actions executed", 2, adapter.getExecutedActions()
+ Assert.assertEquals("Two actions executed", 2, adapter.getExecutedActions()
.size());
- assertEquals("Two actions executed", action, adapter
+ Assert.assertEquals("Two actions executed", action, adapter
.getExecutedActions().get(0));
- assertEquals("Two actions executed", anotherAction, adapter
+ Assert.assertEquals("Two actions executed", anotherAction, adapter
.getExecutedActions().get(1));
- adapter.getExecutedActions().add(new Action(){});
- assertEquals("Two actions executed", 2, adapter.getExecutedActions()
+ adapter.getExecutedActions().add(new Action() {
+ });
+ Assert.assertEquals("Two actions executed", 2, adapter.getExecutedActions()
.size());
- assertEquals("Two actions executed", action, adapter
+ Assert.assertEquals("Two actions executed", action, adapter
.getExecutedActions().get(0));
- assertEquals("Two actions executed", anotherAction, adapter
+ Assert.assertEquals("Two actions executed", anotherAction, adapter
.getExecutedActions().get(1));
adapter.executeActions();
- assertEquals("Two actions executed", 2, adapter.getExecutedActions()
+ Assert.assertEquals("Two actions executed", 2, adapter.getExecutedActions()
.size());
- assertEquals("Two actions executed", action, adapter
+ Assert.assertEquals("Two actions executed", action, adapter
.getExecutedActions().get(0));
- assertEquals("Two actions executed", anotherAction, adapter
+ Assert.assertEquals("Two actions executed", anotherAction, adapter
.getExecutedActions().get(1));
}
+ @Test
public void testReset() throws Exception {
adapter.addAction(action);
adapter.addAction(anotherAction);
adapter.executeActions();
- assertEquals("Two actions executed", 2, adapter.getExecutedActions()
+ Assert.assertEquals("Two actions executed", 2, adapter.getExecutedActions()
.size());
- assertEquals("Two actions", 2, adapter.getActions().size());
+ Assert.assertEquals("Two actions", 2, adapter.getActions().size());
adapter.reset();
- assertEquals("Two actions executed", 0, adapter.getExecutedActions()
+ Assert.assertEquals("Two actions executed", 0, adapter.getExecutedActions()
.size());
- assertEquals("Two actions", 0, adapter.getActions().size());
+ Assert.assertEquals("Two actions", 0, adapter.getActions().size());
}
}
diff --git a/core/src/test/java/org/apache/jsieve/util/check/ScriptCheckMailAdapterHeadersTest.java b/core/src/test/java/org/apache/jsieve/util/check/ScriptCheckMailAdapterHeadersTest.java
index 44b478c..814dec5 100644
--- a/core/src/test/java/org/apache/jsieve/util/check/ScriptCheckMailAdapterHeadersTest.java
+++ b/core/src/test/java/org/apache/jsieve/util/check/ScriptCheckMailAdapterHeadersTest.java
@@ -19,13 +19,14 @@
package org.apache.jsieve.util.check;
+import org.apache.jsieve.javaxmail.MockMimeMessage;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
import java.util.List;
-import junit.framework.TestCase;
-
-import org.apache.jsieve.javaxmail.MockMimeMessage;
-
-public class ScriptCheckMailAdapterHeadersTest extends TestCase {
+public class ScriptCheckMailAdapterHeadersTest {
private static final String BCC = "Bcc";
private static final String TO = "To";
@@ -55,8 +56,8 @@
MockMimeMessage message;
- protected void setUp() throws Exception {
- super.setUp();
+ @Before
+ public void setUp() throws Exception {
adapter = new ScriptCheckMailAdapter();
message = new MockMimeMessage();
message.addHeader(FROM, FROM_ADDRESS);
@@ -71,66 +72,70 @@
adapter.setMail(message);
}
+ @Test
public void testGetHeader() throws Exception {
List<String> headers = adapter.getHeader(FROM);
- assertNotNull(headers);
- assertEquals("From header", 1, headers.size());
- assertEquals("From header", FROM_ADDRESS, headers.get(0));
+ Assert.assertNotNull(headers);
+ Assert.assertEquals("From header", 1, headers.size());
+ Assert.assertEquals("From header", FROM_ADDRESS, headers.get(0));
headers = adapter.getHeader(BCC);
- assertEquals("Bcc headers", 2, headers.size());
- assertTrue("Bcc headers", headers.contains(BCC_ADDRESS_ONE));
- assertTrue("Bcc headers", headers.contains(BCC_ADDRESS_TWO));
+ Assert.assertEquals("Bcc headers", 2, headers.size());
+ Assert.assertTrue("Bcc headers", headers.contains(BCC_ADDRESS_ONE));
+ Assert.assertTrue("Bcc headers", headers.contains(BCC_ADDRESS_TWO));
headers = adapter.getHeader(X_HEADER_NAME);
- assertEquals("Case and whitespace sensitive", 1, headers.size());
- assertEquals("Case and whitespace sensitive", X_HEADER_VALUE, headers
+ Assert.assertEquals("Case and whitespace sensitive", 1, headers.size());
+ Assert.assertEquals("Case and whitespace sensitive", X_HEADER_VALUE, headers
.get(0));
headers = adapter.getHeader(X_HEADER_NAME.toLowerCase());
- assertEquals("Case and whitespace sensitive", 1, headers.size());
- assertEquals("Case and whitespace sensitive", X_HEADER_VALUE
+ Assert.assertEquals("Case and whitespace sensitive", 1, headers.size());
+ Assert.assertEquals("Case and whitespace sensitive", X_HEADER_VALUE
.toLowerCase(), headers.get(0));
headers = adapter.getHeader(X_HEADER_WITH_WS);
- assertEquals("Case and whitespace sensitive", 1, headers.size());
- assertEquals("Case and whitespace sensitive", X_HEADER_VALUE_ALT,
+ Assert.assertEquals("Case and whitespace sensitive", 1, headers.size());
+ Assert.assertEquals("Case and whitespace sensitive", X_HEADER_VALUE_ALT,
headers.get(0));
}
+ @Test
public void testGetHeaderNames() throws Exception {
List headers = adapter.getHeaderNames();
- assertNotNull(headers);
- assertEquals("All headers set returned", 6, headers.size());
- assertTrue("All headers set returned", headers.contains(BCC));
- assertTrue("All headers set returned", headers.contains(TO));
- assertTrue("All headers set returned", headers.contains(FROM));
- assertTrue("All headers set returned", headers.contains(X_HEADER_NAME));
- assertTrue("All headers set returned", headers.contains(X_HEADER_NAME
+ Assert.assertNotNull(headers);
+ Assert.assertEquals("All headers set returned", 6, headers.size());
+ Assert.assertTrue("All headers set returned", headers.contains(BCC));
+ Assert.assertTrue("All headers set returned", headers.contains(TO));
+ Assert.assertTrue("All headers set returned", headers.contains(FROM));
+ Assert.assertTrue("All headers set returned", headers.contains(X_HEADER_NAME));
+ Assert.assertTrue("All headers set returned", headers.contains(X_HEADER_NAME
.toLowerCase()));
- assertTrue("All headers set returned", headers
+ Assert.assertTrue("All headers set returned", headers
.contains(X_HEADER_WITH_WS));
}
+ @Test
public void testGetMatchingHeader() throws Exception {
List<String> headers = adapter.getMatchingHeader(FROM);
- assertNotNull(headers);
- assertEquals("From headers set returned", 1, headers.size());
- assertTrue("From headers set returned", headers.contains(FROM_ADDRESS));
+ Assert.assertNotNull(headers);
+ Assert.assertEquals("From headers set returned", 1, headers.size());
+ Assert.assertTrue("From headers set returned", headers.contains(FROM_ADDRESS));
headers = adapter.getMatchingHeader(X_HEADER_NAME);
- assertNotNull(headers);
- assertEquals(
+ Assert.assertNotNull(headers);
+ Assert.assertEquals(
"Matches ignoring whitespace and capitalisation headers set returned",
3, headers.size());
- assertTrue(
+ Assert.assertTrue(
"Matches ignoring whitespace and capitalisation headers set returned",
headers.contains(X_HEADER_VALUE));
- assertTrue(
+ Assert.assertTrue(
"Matches ignoring whitespace and capitalisation headers set returned",
headers.contains(X_HEADER_VALUE_ALT));
- assertTrue(
+ Assert.assertTrue(
"Matches ignoring whitespace and capitalisation headers set returned",
headers.contains(X_HEADER_VALUE.toLowerCase()));
}
+ @Test
public void testGetSize() throws Exception {
int size = adapter.getSize();
- assertEquals("Message size set", MESSAGE_SIZE, size);
+ Assert.assertEquals("Message size set", MESSAGE_SIZE, size);
}
}
diff --git a/core/src/test/java/org/apache/jsieve/util/check/ScriptCheckMailAdapterMailTest.java b/core/src/test/java/org/apache/jsieve/util/check/ScriptCheckMailAdapterMailTest.java
index 521942a..a7cd227 100644
--- a/core/src/test/java/org/apache/jsieve/util/check/ScriptCheckMailAdapterMailTest.java
+++ b/core/src/test/java/org/apache/jsieve/util/check/ScriptCheckMailAdapterMailTest.java
@@ -19,11 +19,12 @@
package org.apache.jsieve.util.check;
-import junit.framework.TestCase;
-
import org.apache.jsieve.mail.Action;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
-public class ScriptCheckMailAdapterMailTest extends TestCase {
+public class ScriptCheckMailAdapterMailTest {
ScriptCheckMailAdapter adapter;
@@ -31,23 +32,24 @@
Action anotherAction;
- protected void setUp() throws Exception {
- super.setUp();
+ @Before
+ public void setUp() throws Exception {
adapter = new ScriptCheckMailAdapter();
action = new MockAction();
anotherAction = new MockAction();
}
+ @Test
public void testSetMail() throws Exception {
adapter.addAction(action);
adapter.addAction(anotherAction);
adapter.executeActions();
- assertEquals("Two actions executed", 2, adapter.getExecutedActions()
+ Assert.assertEquals("Two actions executed", 2, adapter.getExecutedActions()
.size());
- assertEquals("Two actions", 2, adapter.getActions().size());
+ Assert.assertEquals("Two actions", 2, adapter.getActions().size());
adapter.setMail(null);
- assertEquals("Set mail resets", 0, adapter.getExecutedActions().size());
- assertEquals("Set mail resets", 0, adapter.getActions().size());
+ Assert.assertEquals("Set mail resets", 0, adapter.getExecutedActions().size());
+ Assert.assertEquals("Set mail resets", 0, adapter.getActions().size());
}
}
diff --git a/core/src/test/java/org/apache/jsieve/util/check/ScriptCheckMailAdapterNoMessageSetTest.java b/core/src/test/java/org/apache/jsieve/util/check/ScriptCheckMailAdapterNoMessageSetTest.java
index 688f6e8..36fd41a 100644
--- a/core/src/test/java/org/apache/jsieve/util/check/ScriptCheckMailAdapterNoMessageSetTest.java
+++ b/core/src/test/java/org/apache/jsieve/util/check/ScriptCheckMailAdapterNoMessageSetTest.java
@@ -19,36 +19,42 @@
package org.apache.jsieve.util.check;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
import java.util.List;
-import junit.framework.TestCase;
-
-public class ScriptCheckMailAdapterNoMessageSetTest extends TestCase {
+public class ScriptCheckMailAdapterNoMessageSetTest {
ScriptCheckMailAdapter adapter;
- protected void setUp() throws Exception {
- super.setUp();
+ @Before
+ public void setUp() throws Exception {
adapter = new ScriptCheckMailAdapter();
}
+ @Test
public void testGetHeader() throws Exception {
List<String> headers = adapter.getHeader("From");
- assertNotNull(headers);
+ Assert.assertNotNull(headers);
}
+ @Test
public void testGetHeaderNames() throws Exception {
List headers = adapter.getHeaderNames();
- assertNotNull(headers);
+ Assert.assertNotNull(headers);
}
+ @Test
public void testGetMatchingHeader() throws Exception {
List headers = adapter.getMatchingHeader("From");
- assertNotNull(headers);
+ Assert.assertNotNull(headers);
}
- public void tesGetSize() throws Exception {
+ @Test
+ public void testGetSize() throws Exception {
int size = adapter.getSize();
- assertEquals("When mail not set, size is zero", 0, size);
+ Assert.assertEquals("When mail not set, size is zero", 0, size);
}
}
diff --git a/core/src/test/java/org/apache/jsieve/util/check/ScriptCheckerTestActionsTest.java b/core/src/test/java/org/apache/jsieve/util/check/ScriptCheckerTestActionsTest.java
index 2984e2a..922b817 100644
--- a/core/src/test/java/org/apache/jsieve/util/check/ScriptCheckerTestActionsTest.java
+++ b/core/src/test/java/org/apache/jsieve/util/check/ScriptCheckerTestActionsTest.java
@@ -19,17 +19,18 @@
package org.apache.jsieve.util.check;
-import java.util.Arrays;
-
-import junit.framework.TestCase;
-
import org.apache.jsieve.mail.Action;
import org.apache.jsieve.mail.ActionFileInto;
import org.apache.jsieve.mail.ActionKeep;
import org.apache.jsieve.mail.ActionRedirect;
import org.apache.jsieve.mail.ActionReject;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
-public class ScriptCheckerTestActionsTest extends TestCase {
+import java.util.Arrays;
+
+public class ScriptCheckerTestActionsTest {
private static final String REDIRECT_ADDRESS_TWO = "roadrunner@acme.example.org";
@@ -43,120 +44,124 @@
private static final String DESTINATION_ONE = "org.apache.james";
- static final Action[] ACTIONS = { new ActionFileInto(DESTINATION_ONE),
+ static final Action[] ACTIONS = {new ActionFileInto(DESTINATION_ONE),
new ActionKeep(), new ActionFileInto(DESTINATION_TWO),
new ActionReject(REJECT_MESSAGE_ONE),
new ActionRedirect(REDIRECT_ADDRESS_ONE),
new ActionRedirect(REDIRECT_ADDRESS_TWO),
- new ActionReject(REJECT_MESSAGE_TWO), };
+ new ActionReject(REJECT_MESSAGE_TWO),};
ScriptChecker.Results result;
- protected void setUp() throws Exception {
- super.setUp();
+ @Before
+ public void setUp() throws Exception {
result = new ScriptChecker.Results(Arrays.asList(ACTIONS));
}
+ @Test
public void testFileInto() throws Exception {
- assertTrue("Check for file into action with right destination", result
+ Assert.assertTrue("Check for file into action with right destination", result
.isActionFileInto(DESTINATION_ONE, 0));
- assertFalse("Check for file into action with right destination", result
+ Assert.assertFalse("Check for file into action with right destination", result
.isActionFileInto(DESTINATION_ONE, 1));
- assertFalse("Check for file into action with right destination", result
+ Assert.assertFalse("Check for file into action with right destination", result
.isActionFileInto(DESTINATION_ONE, 2));
- assertFalse("Check for file into action with right destination", result
+ Assert.assertFalse("Check for file into action with right destination", result
.isActionFileInto(DESTINATION_ONE, 3));
- assertFalse("Check for file into action with right destination", result
+ Assert.assertFalse("Check for file into action with right destination", result
.isActionFileInto(DESTINATION_ONE, 4));
- assertFalse("Check for file into action with right destination", result
+ Assert.assertFalse("Check for file into action with right destination", result
.isActionFileInto(DESTINATION_ONE, 5));
- assertFalse("Check for file into action with right destination", result
+ Assert.assertFalse("Check for file into action with right destination", result
.isActionFileInto(DESTINATION_ONE, 6));
- assertFalse("Check for file into action with right destination", result
+ Assert.assertFalse("Check for file into action with right destination", result
.isActionFileInto(DESTINATION_TWO, 0));
- assertFalse("Check for file into action with right destination", result
+ Assert.assertFalse("Check for file into action with right destination", result
.isActionFileInto(DESTINATION_TWO, 1));
- assertTrue("Check for file into action with right destination", result
+ Assert.assertTrue("Check for file into action with right destination", result
.isActionFileInto(DESTINATION_TWO, 2));
- assertFalse("Check for file into action with right destination", result
+ Assert.assertFalse("Check for file into action with right destination", result
.isActionFileInto(DESTINATION_TWO, 3));
- assertFalse("Check for file into action with right destination", result
+ Assert.assertFalse("Check for file into action with right destination", result
.isActionFileInto(DESTINATION_TWO, 4));
- assertFalse("Check for file into action with right destination", result
+ Assert.assertFalse("Check for file into action with right destination", result
.isActionFileInto(DESTINATION_TWO, 5));
- assertFalse("Check for file into action with right destination", result
+ Assert.assertFalse("Check for file into action with right destination", result
.isActionFileInto(DESTINATION_TWO, 6));
}
+ @Test
public void testRedirect() throws Exception {
- assertFalse("Check for redirect action with right message", result
+ Assert.assertFalse("Check for redirect action with right message", result
.isActionRedirect(REDIRECT_ADDRESS_ONE, 0));
- assertFalse("Check for redirect action with right message", result
+ Assert.assertFalse("Check for redirect action with right message", result
.isActionRedirect(REDIRECT_ADDRESS_ONE, 1));
- assertFalse("Check for redirect action with right message", result
+ Assert.assertFalse("Check for redirect action with right message", result
.isActionRedirect(REDIRECT_ADDRESS_ONE, 2));
- assertFalse("Check for redirect action with right message", result
+ Assert.assertFalse("Check for redirect action with right message", result
.isActionRedirect(REDIRECT_ADDRESS_ONE, 3));
- assertTrue("Check for redirect action with right message", result
+ Assert.assertTrue("Check for redirect action with right message", result
.isActionRedirect(REDIRECT_ADDRESS_ONE, 4));
- assertFalse("Check for redirect action with right message", result
+ Assert.assertFalse("Check for redirect action with right message", result
.isActionRedirect(REDIRECT_ADDRESS_ONE, 5));
- assertFalse("Check for redirect action with right message", result
+ Assert.assertFalse("Check for redirect action with right message", result
.isActionRedirect(REDIRECT_ADDRESS_ONE, 6));
- assertFalse("Check for redirect action with right message", result
+ Assert.assertFalse("Check for redirect action with right message", result
.isActionRedirect(REDIRECT_ADDRESS_TWO, 0));
- assertFalse("Check for redirect action with right message", result
+ Assert.assertFalse("Check for redirect action with right message", result
.isActionRedirect(REDIRECT_ADDRESS_TWO, 1));
- assertFalse("Check for redirect action with right message", result
+ Assert.assertFalse("Check for redirect action with right message", result
.isActionRedirect(REDIRECT_ADDRESS_TWO, 2));
- assertFalse("Check for redirect action with right message", result
+ Assert.assertFalse("Check for redirect action with right message", result
.isActionRedirect(REDIRECT_ADDRESS_TWO, 3));
- assertFalse("Check for redirect action with right message", result
+ Assert.assertFalse("Check for redirect action with right message", result
.isActionRedirect(REDIRECT_ADDRESS_TWO, 4));
- assertTrue("Check for redirect action with right message", result
+ Assert.assertTrue("Check for redirect action with right message", result
.isActionRedirect(REDIRECT_ADDRESS_TWO, 5));
- assertFalse("Check for redirect action with right message", result
+ Assert.assertFalse("Check for redirect action with right message", result
.isActionRedirect(REDIRECT_ADDRESS_TWO, 6));
}
+ @Test
public void testReject() throws Exception {
- assertFalse("Check for reject action with right message", result
+ Assert.assertFalse("Check for reject action with right message", result
.isActionReject(REJECT_MESSAGE_ONE, 0));
- assertFalse("Check for reject action with right message", result
+ Assert.assertFalse("Check for reject action with right message", result
.isActionReject(REJECT_MESSAGE_ONE, 1));
- assertFalse("Check for reject action with right message", result
+ Assert.assertFalse("Check for reject action with right message", result
.isActionReject(REJECT_MESSAGE_ONE, 2));
- assertTrue("Check for reject action with right message", result
+ Assert.assertTrue("Check for reject action with right message", result
.isActionReject(REJECT_MESSAGE_ONE, 3));
- assertFalse("Check for reject action with right message", result
+ Assert.assertFalse("Check for reject action with right message", result
.isActionReject(REJECT_MESSAGE_ONE, 4));
- assertFalse("Check for reject action with right message", result
+ Assert.assertFalse("Check for reject action with right message", result
.isActionReject(REJECT_MESSAGE_ONE, 5));
- assertFalse("Check for reject action with right message", result
+ Assert.assertFalse("Check for reject action with right message", result
.isActionReject(REJECT_MESSAGE_ONE, 6));
- assertFalse("Check for reject action with right message", result
+ Assert.assertFalse("Check for reject action with right message", result
.isActionReject(REJECT_MESSAGE_TWO, 0));
- assertFalse("Check for reject action with right message", result
+ Assert.assertFalse("Check for reject action with right message", result
.isActionReject(REJECT_MESSAGE_TWO, 1));
- assertFalse("Check for reject action with right message", result
+ Assert.assertFalse("Check for reject action with right message", result
.isActionReject(REJECT_MESSAGE_TWO, 2));
- assertFalse("Check for reject action with right message", result
+ Assert.assertFalse("Check for reject action with right message", result
.isActionReject(REJECT_MESSAGE_TWO, 3));
- assertFalse("Check for reject action with right message", result
+ Assert.assertFalse("Check for reject action with right message", result
.isActionReject(REJECT_MESSAGE_TWO, 4));
- assertFalse("Check for reject action with right message", result
+ Assert.assertFalse("Check for reject action with right message", result
.isActionReject(REJECT_MESSAGE_TWO, 5));
- assertTrue("Check for reject action with right message", result
+ Assert.assertTrue("Check for reject action with right message", result
.isActionReject(REJECT_MESSAGE_TWO, 6));
}
+ @Test
public void testKeep() throws Exception {
- assertFalse("Check for keep action ", result.isActionKeep(0));
- assertTrue("Check for keep action ", result.isActionKeep(1));
- assertFalse("Check for keep action ", result.isActionKeep(2));
- assertFalse("Check for keep action ", result.isActionKeep(3));
- assertFalse("Check for keep action ", result.isActionKeep(4));
- assertFalse("Check for keep action ", result.isActionKeep(5));
- assertFalse("Check for keep action ", result.isActionKeep(6));
+ Assert.assertFalse("Check for keep action ", result.isActionKeep(0));
+ Assert.assertTrue("Check for keep action ", result.isActionKeep(1));
+ Assert.assertFalse("Check for keep action ", result.isActionKeep(2));
+ Assert.assertFalse("Check for keep action ", result.isActionKeep(3));
+ Assert.assertFalse("Check for keep action ", result.isActionKeep(4));
+ Assert.assertFalse("Check for keep action ", result.isActionKeep(5));
+ Assert.assertFalse("Check for keep action ", result.isActionKeep(6));
}
}
diff --git a/manager/pom.xml b/manager/pom.xml
index 0e95140..261ff49 100644
--- a/manager/pom.xml
+++ b/manager/pom.xml
@@ -36,7 +36,6 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
- <version>4.10</version>
<scope>test</scope>
</dependency>
</dependencies>
diff --git a/pom.xml b/pom.xml
index ba816ef..5143373 100644
--- a/pom.xml
+++ b/pom.xml
@@ -78,7 +78,7 @@
<target.jdk>1.6</target.jdk>
<mime4j.version>0.7.2</mime4j.version>
<apache-mailet.version>2.5.0-SNAPSHOT</apache-mailet.version>
- <junit.version>3.8.2</junit.version>
+ <junit.version>4.10</junit.version>
<jmock.version>1.2.0</jmock.version>
<log4j.version>1.2.14</log4j.version>
<mail.version>1.4.4</mail.version>