### Question:
FormulaRegistry { static void validateFormulaFunction(FormulaFunction formulaFunction) { if (formulaFunction instanceof StatefulFormulaFunction) { StatefulFormulaFunction function = (StatefulFormulaFunction) formulaFunction; StatefulFormulaFunction instance; try { instance = function.getClass().newInstance(); } catch (SecurityException | InstantiationException | IllegalAccessException ex) { throw new IllegalArgumentException("StatefulFormulaFunction " + formulaFunction.getClass().getName() + " must be public and have a public no-arg constructor.", ex); } try { instance.dispose(); } catch (Exception ex) { throw new RuntimeException("StatefulFormulaFunction " + formulaFunction.getClass().getName() + " fails on dispose.", ex); } } }  static FormulaRegistry getDefault(); void registerFormulaFunctionSet(FormulaFunctionSet functionSet); Set<String> listFunctionSets(); FormulaFunctionSet findFunctionSet(String name); Collection<FormulaFunction> findFunctions(String functionName, Integer nArguments); Object findNamedConstant(String constantName);  }### Answer:
@Test public void validateFunction1() { FormulaRegistry.validateFormulaFunction(new Function1()); }
@Test(expected = IllegalArgumentException.class) public void validateFunction2() { FormulaRegistry.validateFormulaFunction(new Function2()); }