ExpressionUtils { public static String ensureExpressionSyntax(String expressionValue) { if (expressionValue != null && !expressionValue.startsWith(EXPRESSION_VALUE_PREFIX)) { if (expressionValue.startsWith(MVEL_ESCAPE_SYMBOL)) { return expressionValue.replaceFirst(MVEL_ESCAPE_SYMBOL, EXPRESSION_VALUE_PREFIX); } if (expressionValue.startsWith(" ")) { return expressionValue.replaceFirst(" ", EXPRESSION_VALUE_PREFIX); } return EXPRESSION_VALUE_PREFIX + expressionValue; } return expressionValue; } private  ExpressionUtils(); static String ensureExpressionSyntax(String expressionValue);  }
@Test public void checkExpressionSyntax_Null() { assertNull(ExpressionUtils.ensureExpressionSyntax(null)); }
@Test public void checkExpressionSyntax_Empty() { assertEquals(ConstantHolder.EXPRESSION_VALUE_PREFIX, ExpressionUtils.ensureExpressionSyntax("")); }
@Test public void checkExpressionSyntax_StringWithNoPrefix() { assertEquals(ConstantHolder.EXPRESSION_VALUE_PREFIX + "Test", ExpressionUtils.ensureExpressionSyntax("Test")); }
@Test public void checkExpressionSyntax_StringWithSpacePrefix() { assertEquals(ConstantHolder.EXPRESSION_VALUE_PREFIX + "Test", ExpressionUtils.ensureExpressionSyntax(" Test")); }
@Test public void checkExpressionSyntax_StringWithMVelPrefix() { assertEquals(ConstantHolder.EXPRESSION_VALUE_PREFIX + "Test", ExpressionUtils.ensureExpressionSyntax(ConstantsHolder.MVEL_ESCAPE_SYMBOL + "Test")); }
@Test public void checkExpressionSyntax_StringWithExpressionValuePrefix() { assertEquals(ConstantHolder.EXPRESSION_VALUE_PREFIX + "Test", ExpressionUtils.ensureExpressionSyntax(ConstantHolder.EXPRESSION_VALUE_PREFIX + "Test")); }