File tree Expand file tree Collapse file tree
apache-poi/src/test/java/com/baeldung/poi/excel/setformula Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ public void setup() throws URISyntaxException {
2525 }
2626
2727 @ Test
28- void givenExcelData_whenSetAndEvaluateFormula () throws IOException {
28+ void givenExcelData_whenSetFormula_thenSuccess () throws IOException {
2929 FileInputStream inputStream = new FileInputStream (new File (fileLocation ));
3030 XSSFWorkbook wb = new XSSFWorkbook (inputStream );
3131 XSSFSheet sheet = wb .getSheetAt (0 );
@@ -43,7 +43,9 @@ void givenExcelData_whenSetAndEvaluateFormula() throws IOException {
4343 String startCellB = colNameB + 1 ;
4444 String stopCellB = colNameB + (sheet .getLastRowNum () + 1 );
4545 String sumFormulaForColumnB = String .format ("SUM(%s:%s)" , startCellB , stopCellB );
46+
4647 double resultValue = excelFormula .setFormula (fileLocation , wb , sumFormulaForColumnA + "-" + sumFormulaForColumnB );
47- Assert .assertEquals (resultValue , resultColumnA - resultColumnB , 0d );
48+
49+ Assert .assertEquals (resultColumnA - resultColumnB , resultValue , 0d );
4850 }
4951}
You can’t perform that action at this time.
0 commit comments