Removing functionality. Removed soundslike/distanceto/like operators
This commit is contained in:
@@ -57,26 +57,6 @@ public class EvaluationTests extends ExpressionTestCase {
|
||||
evaluate("name in {null, \"Anonymous\"}", "false", Boolean.class);
|
||||
}
|
||||
|
||||
public void testRelOperatorsLike01() {
|
||||
evaluate("'Abc' like 'A%_'", "true", Boolean.class);
|
||||
}
|
||||
|
||||
public void testRelOperatorsLike02() {
|
||||
evaluate("'Abc' like '..'", "false", Boolean.class);
|
||||
}
|
||||
|
||||
public void testRelOperatorsLike03() {
|
||||
evaluateAndCheckError("null like '.'", SpelMessages.INVALID_FIRST_OPERAND_FOR_LIKE_OPERATOR);
|
||||
}
|
||||
|
||||
public void testRelOperatorsLike04() {
|
||||
evaluateAndCheckError("'abc' like 2.0", SpelMessages.INVALID_SECOND_OPERAND_FOR_LIKE_OPERATOR);
|
||||
}
|
||||
|
||||
public void testRelOperatorsLike05() {
|
||||
evaluate("27 like '__'", "true", Boolean.class); // conversion int>string
|
||||
}
|
||||
|
||||
public void testRelOperatorsBetween01() {
|
||||
evaluate("1 between {1, 5}", "true", Boolean.class);
|
||||
}
|
||||
@@ -137,7 +117,6 @@ public class EvaluationTests extends ExpressionTestCase {
|
||||
evaluate("27 matches '^.*2.*$'", true, Boolean.class); // conversion int>string
|
||||
}
|
||||
|
||||
|
||||
// mixing operators
|
||||
public void testMixingOperators01() {
|
||||
evaluate("true and 5>3", "true", Boolean.class);
|
||||
@@ -484,43 +463,6 @@ public class EvaluationTests extends ExpressionTestCase {
|
||||
evaluate("(#sqrt={|n| T(Math).sqrt($n)};#delegate={|f,n| $f($n)};#delegate(#sqrt,4))", "2.0", Double.class);
|
||||
}
|
||||
|
||||
// Soundex
|
||||
public void testSoundex01() {
|
||||
evaluate("'Rob' soundslike 'Rod'", "false", Boolean.class);
|
||||
}
|
||||
|
||||
public void testSoundex02() {
|
||||
evaluate("'Robert' soundslike 'Rupert'", "true", Boolean.class);
|
||||
}
|
||||
|
||||
public void testSoundex03() {
|
||||
evaluate("'Andy' soundslike 'Christian'", "false", Boolean.class);
|
||||
}
|
||||
|
||||
public void testSoundex04() {
|
||||
evaluate("@(fruits:).values().?{#this.colorName soundslike 'gren'}!=null", "true", Boolean.class);
|
||||
}
|
||||
|
||||
public void testSoundex05() {
|
||||
evaluate("@(fruits:).values().?{colorName soundslike 'gren'}!=null", "true", Boolean.class);
|
||||
}
|
||||
|
||||
public void testSoundex06() {
|
||||
evaluate("'Adrian' soundslike 'Adrain'", "true", Boolean.class);
|
||||
}
|
||||
|
||||
// Word distance
|
||||
public void testDistanceTo01() {
|
||||
evaluate("'Saturday' distanceto 'Sunday'", "3", Integer.class);
|
||||
evaluate("'Saturday' distanceto 'Monday'", "5", Integer.class);
|
||||
evaluate("'Saturday' distanceto 'Saturdaz'", "1", Integer.class);
|
||||
evaluate("'Saturday' distanceto 'Saturdab'", "1", Integer.class);
|
||||
}
|
||||
|
||||
public void testDistanceTo02() {
|
||||
evaluate("'Kitten' distanceto 'Sitting'", "3", Integer.class);
|
||||
}
|
||||
|
||||
public void testVariableReferences() {
|
||||
evaluate("(#answer=42;#answer)", "42", Integer.class, true);
|
||||
evaluate("($answer=42;$answer)", "42", Integer.class, true);
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.springframework.expression.spel.standard.StandardEvaluationContext;
|
||||
|
||||
/**
|
||||
* Common superclass for expression tests.
|
||||
*
|
||||
*
|
||||
* @author Andy Clement
|
||||
*/
|
||||
public abstract class ExpressionTestCase extends TestCase {
|
||||
@@ -36,9 +36,9 @@ public abstract class ExpressionTestCase extends TestCase {
|
||||
|
||||
protected final static boolean SHOULD_BE_WRITABLE = true;
|
||||
protected final static boolean SHOULD_NOT_BE_WRITABLE = false;
|
||||
|
||||
protected static SpelExpressionParser parser = new SpelExpressionParser();
|
||||
protected static StandardEvaluationContext eContext = TestScenarioCreator.getTestEvaluationContext();
|
||||
|
||||
protected final static SpelExpressionParser parser = new SpelExpressionParser();
|
||||
protected final static StandardEvaluationContext eContext = TestScenarioCreator.getTestEvaluationContext();
|
||||
|
||||
/**
|
||||
* Evaluate an expression and check that the actual result matches the expectedValue and the class of the result
|
||||
@@ -137,7 +137,7 @@ public abstract class ExpressionTestCase extends TestCase {
|
||||
* Evaluate an expression and check that the actual result matches the expectedValue and the class of the result
|
||||
* matches the expectedClassOfResult. This method can also check if the expression is writable (for example, it is a
|
||||
* variable or property reference).
|
||||
*
|
||||
*
|
||||
* @param expression The expression to evaluate
|
||||
* @param expectedValue the expected result for evaluating the expression
|
||||
* @param expectedClassOfResult the expected class of the evaluation result
|
||||
@@ -335,7 +335,7 @@ public abstract class ExpressionTestCase extends TestCase {
|
||||
|
||||
/**
|
||||
* Produce a nice string representation of the input object.
|
||||
*
|
||||
*
|
||||
* @param value object to be formatted
|
||||
* @return a nice string
|
||||
*/
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.springframework.expression.ParseException;
|
||||
/**
|
||||
* Parse some expressions and check we get the AST we expect. Rather than inspecting each node in the AST, we ask it to
|
||||
* write itself to a string form and check that is as expected.
|
||||
*
|
||||
*
|
||||
* @author Andy Clement
|
||||
*/
|
||||
public class ParsingTests extends TestCase {
|
||||
@@ -137,14 +137,6 @@ public class ParsingTests extends TestCase {
|
||||
parseCheck("3 in {1,2,3,4,5}", "(3 in {1,2,3,4,5})");
|
||||
}
|
||||
|
||||
public void testRelOperatorsLike01() {
|
||||
parseCheck("'Abc' like '[A-Z]b*'", "('Abc' like '[A-Z]b*')");
|
||||
}
|
||||
|
||||
public void testRelOperatorsLike02() {
|
||||
parseCheck("'Abc' like '?'", "('Abc' like '?')");
|
||||
}
|
||||
|
||||
public void testRelOperatorsBetween01() {
|
||||
parseCheck("1 between {1, 5}", "(1 between {1,5})");
|
||||
}
|
||||
@@ -418,7 +410,7 @@ public class ParsingTests extends TestCase {
|
||||
/**
|
||||
* Parse the supplied expression and then create a string representation of the resultant AST, it should be the same
|
||||
* as the original expression.
|
||||
*
|
||||
*
|
||||
* @param expression the expression to parse *and* the expected value of the string form of the resultant AST
|
||||
*/
|
||||
public void parseCheck(String expression) {
|
||||
@@ -428,7 +420,7 @@ public class ParsingTests extends TestCase {
|
||||
/**
|
||||
* Parse the supplied expression and then create a string representation of the resultant AST, it should be the
|
||||
* expected value.
|
||||
*
|
||||
*
|
||||
* @param expression the expression to parse
|
||||
* @param expectedStringFormOfAST the expected string form of the AST
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user