Cell cellA1 = _sheet1.setCellEditText(0, 0, "=variable1"); //A1
cellA1 = _sheet1.setCellEditText(0, 0, "=variable1"); //A1
}
public void testVariable2() {
Cell cellA1 = _sheet1.setCellEditText(0, 0, "=bankAccount1"); //A1
Cell cellB1 = _sheet1.setCellEditText(0, 1, "=bankAccount2"); //B1
Cell cellC1 = _sheet1.setCellEditText(0, 2, "=bankAccount3"); //C1
Cell cellD1 = _sheet1.setCellEditText(0, 3, "=SUM(A1:C1)"); //D1
Cell cellE1 = _sheet1.setCellEditText(0, 4, "=bankAccount1 + bankAccount2 + bankAccount3"); //E1
Map varmap = new HashMap();
VariableResolver resolver = new SimpleResolver(varmap);
_book.addVariableResolver(resolver);
varmap.put("bankAccount1", new Double(1d));
varmap.put("bankAccount2", new Double(10d));
varmap.put("bankAccount3", new Double(100d));
assertValue(1d, ((Number)cellA1.getResult()).doubleValue(), 0d);
assertValue(10d, ((Number)cellB1.getResult()).doubleValue(), 0d);
assertValue(100d, ((Number)cellC1.getResult()).doubleValue(), 0d);
assertValue(111d, ((Number)cellD1.getResult()).doubleValue(), 0d);
assertValue(111d, ((Number)cellE1.getResult()).doubleValue(), 0d);
varmap.put("bankAccount1", new Double(2d));
varmap.put("bankAccount2", new Double(20d));
varmap.put("bankAccount3", new Double(200d));
assertValue(2d, ((Number)cellA1.getResult()).doubleValue(), 0d);
assertValue(20d, ((Number)cellB1.getResult()).doubleValue(), 0d);
assertValue(200d, ((Number)cellC1.getResult()).doubleValue(), 0d);
assertValue(222d, ((Number)cellD1.getResult()).doubleValue(), 0d);
assertValue(222d, ((Number)cellE1.getResult()).doubleValue(), 0d);
}