public class MvelExpressionValidatorTest
extends junit.framework.TestCase
| Constructor and Description |
|---|
MvelExpressionValidatorTest() |
| Modifier and Type | Method and Description |
|---|---|
void |
testBlockedMethodsAreRejected() |
void |
testBlockedMethodsWithoutParenthesesAreRejected()
MVEL calls no argument methods written as properties, so blocked methods must be blocked in that form too.
|
void |
testBuiltInMethodsCanBeAllowedWithProperty()
Allowing a built-in blocked method allows only that method, e.g.
|
void |
testCodeHiddenFromTheValidatorIsRejected()
The validator must agree with MVEL on where string literals and comments start and end.
|
void |
testCodeInsideStringLiteralsIsAllowed() |
void |
testConstructorsAreRejected() |
void |
testExpressionCompilationAndExecutionIsRejected()
MVEL can compile and evaluate any expression, so the compile and execute methods are blocked, whether reached
through the fully qualified org.mvel2.MVEL or the bare MVEL import, and whichever of them is used.
|
void |
testJvmTerminationIsRejected()
System.exit kills the JVM, so it is blocked, like the already blocked halt.
|
void |
testLongStringLiteralsAreAllowed()
Long string values, with or without escapes, must not overflow the stack while being removed.
|
void |
testMethodsCanBeBlockedWithProperty() |
void |
testNewInsideValuesAndNamesIsAllowed()
Product, sku and other names containing "new" are values in string literals, or part of a longer name, and
must not be mistaken for the new keyword.
|
void |
testNullAndEmptyExpressionsAreAllowed()
String literal contents are data and must never be treated as code.
|
void |
testObjectCreationWithoutNewIsRejected()
Factory methods that create or load classes without using new
|
void |
testReflectionIsRejected() |
void |
testReportedPayloadIsRejected() |
void |
testRuleBuilderExpressionsAreAllowed()
Expressions generated by the rule builder, including legacy forms, and hand written rules from the tests and
demo data must remain allowed.
|
void |
testShippedDemoAndTestRulesAreAllowed()
Rules harvested from the 6.0 reference-site demo/seed SQL and the offer test data providers must keep validating,
so enabling the validator never silently breaks an existing stored rule (the false-positive regression guard).
|
void |
testStatementSeparatorsAreRejected() |
void |
testValidationCanBeTurnedOffWithProperty() |
void |
testValidationIsEnabledByDefault() |
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runBare, runTest, setName, setUp, tearDown, toStringpublic void testRuleBuilderExpressionsAreAllowed()
public void testShippedDemoAndTestRulesAreAllowed()
public void testNullAndEmptyExpressionsAreAllowed()
public void testCodeInsideStringLiteralsIsAllowed()
public void testNewInsideValuesAndNamesIsAllowed()
public void testReportedPayloadIsRejected()
public void testExpressionCompilationAndExecutionIsRejected()
public void testJvmTerminationIsRejected()
public void testConstructorsAreRejected()
public void testObjectCreationWithoutNewIsRejected()
public void testReflectionIsRejected()
public void testBlockedMethodsAreRejected()
public void testStatementSeparatorsAreRejected()
public void testBlockedMethodsWithoutParenthesesAreRejected()
public void testCodeHiddenFromTheValidatorIsRejected()
public void testLongStringLiteralsAreAllowed()
public void testValidationIsEnabledByDefault()
public void testValidationCanBeTurnedOffWithProperty()
public void testMethodsCanBeBlockedWithProperty()
public void testBuiltInMethodsCanBeAllowedWithProperty()
Copyright © 2026. All rights reserved.