@Test public void testSomeCalculations() throws Exception{ Assert.assertEquals(mEvalutor.calculate("5+5"), "10", "5+5 should equal 10"); }
public static String calculate(String calculation) throws Exception{ ScriptEngineManager mgr = new ScriptEngineManager(); ScriptEngine engine = mgr.getEngineByName("JavaScript"); return engine.eval(calculation).toString(); }
Evaluator { public static String calculate(String calculation) throws Exception{ ScriptEngineManager mgr = new ScriptEngineManager(); ScriptEngine engine = mgr.getEngineByName("JavaScript"); return engine.eval(calculation).toString(); } }
Evaluator { public static String calculate(String calculation) throws Exception{ ScriptEngineManager mgr = new ScriptEngineManager(); ScriptEngine engine = mgr.getEngineByName("JavaScript"); return engine.eval(calculation).toString(); }  }
Evaluator { public static String calculate(String calculation) throws Exception{ ScriptEngineManager mgr = new ScriptEngineManager(); ScriptEngine engine = mgr.getEngineByName("JavaScript"); return engine.eval(calculation).toString(); }  static String calculate(String calculation); }
Evaluator { public static String calculate(String calculation) throws Exception{ ScriptEngineManager mgr = new ScriptEngineManager(); ScriptEngine engine = mgr.getEngineByName("JavaScript"); return engine.eval(calculation).toString(); }  static String calculate(String calculation);  }