ConcatFunction implements Function { public String execute(List<String> parameterList, TestContext context) { if (CollectionUtils.isEmpty(parameterList)) { throw new InvalidFunctionUsageException("Function parameters must not be empty"); } StringBuffer resultString = new StringBuffer(); for (int i = 0; i < parameterList.size(); i++) { resultString.append(parameterList.get(i)); } return resultString.toString(); }  String execute(List<String> parameterList, TestContext context);  }
@Test public void testFunction() { List<String> params = new ArrayList<String>(); params.add("Hallo "); params.add("TestFramework"); params.add("!"); Assert.assertEquals(function.execute(params, context), "Hallo TestFramework!"); }
@Test(expectedExceptions = {InvalidFunctionUsageException.class}) public void testNoParameters() { function.execute(Collections.<String>emptyList(), context); }