ExpressionEvaluatorFactory { protected boolean isAnMVELExpression(String rawValue) { if (rawValue.trim().startsWith(MVEL_ESCAPE_SYMBOL)) { return true; } Optional<JsonNode> optionalNode = JsonUtils.convertFromStringToJSONNode(rawValue); return optionalNode.filter( jsonNode -> jsonNode.isTextual() && jsonNode.asText().trim().startsWith(MVEL_ESCAPE_SYMBOL)).isPresent(); } private  ExpressionEvaluatorFactory(ClassLoader classLoader, Type type); static ExpressionEvaluatorFactory create(ClassLoader classLoader, Type type); ExpressionEvaluator getOrCreate(FactMappingValue factMappingValue);  }
@Test public void isAnMVELExpression() { ExpressionEvaluatorFactory ruleEvaluatorFactory = ExpressionEvaluatorFactory.create(classLoader, ScenarioSimulationModel.Type.RULE); assertFalse(ruleEvaluatorFactory.isAnMVELExpression("10")); assertTrue(ruleEvaluatorFactory.isAnMVELExpression(MVEL_ESCAPE_SYMBOL + "10")); assertTrue(ruleEvaluatorFactory.isAnMVELExpression(" " + MVEL_ESCAPE_SYMBOL + " 10")); assertTrue(ruleEvaluatorFactory.isAnMVELExpression(new TextNode(MVEL_ESCAPE_SYMBOL + " 10").textValue())); assertTrue(ruleEvaluatorFactory.isAnMVELExpression(new TextNode(" " + MVEL_ESCAPE_SYMBOL + " 10").textValue())); assertFalse(ruleEvaluatorFactory.isAnMVELExpression(new TextNode("10").textValue())); }