ValidationAPI implements Serializable { public boolean isExpressionValid() { try { CustomExpressionVisitor customExpressionVisitor = new CustomExpressionVisitor(); customExpressionVisitor.visit(generateAntlrTree()); return true; } catch (Exception e) { try { throw e; } catch (Exception e1) { e1.printStackTrace(); } } return false; } ValidationAPI(String expression, String propertiesFilePath); boolean isExpressionValid(); String getValidExpression(); DiagnosticCollector<JavaFileObject> transformCompiler(Map<String, Class<?>> schemaFields); DiagnosticCollector<JavaFileObject> filterCompiler(Map<String, Class<?>> schemaFields); List<String> getFieldNameList(Map<String, Class<?>> schemaFields); Object execute(); Object execute(String[] fieldNames, Object[] data); Object execute(String[] fieldNames, Object[] data, String validExpression); void init(String[] fieldNames,String[] fieldTypes); ValidationAPI init(String validExpression,Map<String,String> fieldMap); void init(String expression); Object exec(Object[] data); Object execute(String validExpression); static DiagnosticCollector<JavaFileObject> filterCompiler(String expression, String propertiesFilePath,
			Map<String, Class<?>> schemaFields, String externalJarPath); static DiagnosticCollector<JavaFileObject> transformCompiler(String expression, String propertiesFilePath,
			Map<String, Class<?>> schemaFields, String externalJarPath); static List<String> getFieldNameList(Map<String, Class<?>> schemaFields,String expression,String propertiesFilePath); static Object execute(String expression, String propertiesFilePath, String[] fieldNames, Object[] data); String getExpr(); void setExpr(String expr);  }
@Test public void itShouldThrowException() { ValidationAPI validationAPI = new ValidationAPI("(1==1)12:20;", ""); boolean isValid = validationAPI.isExpressionValid(); Assert.assertFalse(isValid); }
@Test public void itShouldValidateTheExpression() { ValidationAPI validationAPI = new ValidationAPI("StringFunctions.stringMatch(\"AAA\",\"a\")?1:2", ""); Assert.assertTrue(validationAPI.isExpressionValid()); }