DateFunctions { static public boolean isValid(String[] values) { try { if (values[2].equalsIgnoreCase("currentdate")) { return true; } else if (values[2].equalsIgnoreCase("adddays")) { if (!StringUtils.isEmpty(values[3])) { return true; } } return false; } catch (Exception ex) { return false; } }  static boolean isValid(String[] values); static String executeFunction(String[] values);  }
@Test public void testIsValid() { assertFalse(FunctionHandler.validFunction("#function.date")); assertFalse(FunctionHandler.validFunction("#function.date.bogusFunction")); assertTrue(FunctionHandler.validFunction("#function.date.currentDate")); assertTrue(FunctionHandler.validFunction("#function.date.currentDate.MMddyyyy")); assertFalse(FunctionHandler.validFunction("#function.date.addDays")); assertTrue(FunctionHandler.validFunction("#function.date.addDays.MMddyyyy")); assertTrue(FunctionHandler.validFunction("#function.date.addDays.14.MMddyyyy")); }