Fix SPEL tests when using maven. With the maven test runner expression.spel.SetValueTests is run before expression.spel.EvaluationTests. The order is reversed in eclipse/spring-build. Static variables are modifed in SetValueTests that cause EvaluationTests to fail if it is run first. Make a simple fix so SetValueTests uses a local evaluation context variable instead of a static variable.

This commit is contained in:
Mark Pollack 2009-03-27 16:05:38 +00:00
parent f9541d1e28
commit 74326a93d2
1 changed files with 5 additions and 3 deletions

View File

@ -19,6 +19,7 @@ package org.springframework.expression.spel;
import org.springframework.expression.EvaluationException;
import org.springframework.expression.Expression;
import org.springframework.expression.ParseException;
import org.springframework.expression.spel.support.StandardEvaluationContext;
/**
* Tests set value expressions.
@ -70,9 +71,10 @@ public class SetValueTests extends ExpressionTestCase {
if (DEBUG) {
SpelUtilities.printAbstractSyntaxTree(System.out, e);
}
assertTrue("Expression is not writeable but should be", e.isWritable(eContext));
e.setValue(eContext, value);
assertEquals("Retrieved value was not equal to set value", value, e.getValue(eContext));
StandardEvaluationContext lContext = TestScenarioCreator.getTestEvaluationContext();
assertTrue("Expression is not writeable but should be", e.isWritable(lContext));
e.setValue(lContext, value);
assertEquals("Retrieved value was not equal to set value", value, e.getValue(lContext));
} catch (EvaluationException ee) {
ee.printStackTrace();
fail("Unexpected Exception: " + ee.getMessage());