@Test public void calculate1() { String formula = "2 * a + 3 * b - c"; BigDecimal value = Calculator.calculate(formula, MoreObjects.mapOf("a", 3, "b", 4.2, "c", 2.5)); Assert.assertEquals(new BigDecimal(2).multiply(new BigDecimal(3)) .add(new BigDecimal(3).multiply(new BigDecimal("4.2")).subtract(new BigDecimal("2.5"))), value); }
public BigDecimal calculate(String formula) { return calculate(formula, null); }
Calculator { public BigDecimal calculate(String formula) { return calculate(formula, null); } }
Calculator { public BigDecimal calculate(String formula) { return calculate(formula, null); }  }
Calculator { public BigDecimal calculate(String formula) { return calculate(formula, null); }  BigDecimal calculate(String formula); BigDecimal calculate(String formula, Object data); BigDecimal calculate(String formula, Object data, int scale); }
Calculator { public BigDecimal calculate(String formula) { return calculate(formula, null); }  BigDecimal calculate(String formula); BigDecimal calculate(String formula, Object data); BigDecimal calculate(String formula, Object data, int scale);  }