Skip to content
Permalink
Browse files
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
  • Loading branch information
ieugen committed Dec 25, 2012
1 parent 34dc794 commit 542d000e3124c2857cadbe4dff928d473a3451e5
Showing 45 changed files with 935 additions and 883 deletions.
@@ -23,7 +23,6 @@

/**
* Bean based implementation of context.
*
*/
public class BaseSieveContext extends SieveContext {

@@ -42,8 +41,8 @@ public class BaseSieveContext extends SieveContext {
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 @@ public BaseSieveContext(final CommandManager commandManager,

/**
* Gets the script position of the current operation.
*
*
* @return <code>ScriptCoordinate</code>, not null
*/
@Override
@@ -64,9 +63,8 @@ public ScriptCoordinate getCoordinate() {

/**
* 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 CommandManager getCommandManager() {
public TestManager getTestManager() {
return testManager;
}


}
@@ -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 @@ public class AddressParseTest extends TestCase {

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 @@ public void testSingleAddress() throws Exception {
"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",

0 comments on commit 542d000

Please sign in to comment.