@Test public void areNotAllFunctionsDeclared() throws Exception { String expression = "1 + Sin(90) + MyFunc(1)"; ExpressionSolver target = new ExpressionSolver(expression); boolean actual = target.areAllFunctionsDeclared(); boolean expected = false; assertThat(actual, is(equalTo(expected))); }
@Test public void areAllFunctionsDeclared() throws Exception { String expression = "1 + Sin(90) + MyFunc(1)"; ExpressionSolver target = new ExpressionSolver(expression); target.addFunction("MyFunc", Arrays.asList("x"), "1 + x"); boolean actual = target.areAllFunctionsDeclared(); boolean expected = true; assertThat(actual, is(equalTo(expected))); }