Package org.apache.poi.ss.usermodel

Examples of org.apache.poi.ss.usermodel.CellValue.formatAsString()


        evaluator.evaluateAll();
       
        XSSFCell cell = excel.getSheetAt(0).getRow(1).getCell(1);
        CellValue value = evaluator.evaluate(cell);
       
        assertEquals(expect, value.formatAsString());
    }
}
View Full Code Here


    // numeric criteria
        for (int i = 0; i < 8; i++) {
      CellValue expected = evaluator.evaluate(sheet.getRow(i).getCell(REF_COL));
      CellValue actual = evaluator.evaluate(sheet.getRow(i).getCell(EVAL_COL));
      assertEquals(expected.formatAsString(), actual.formatAsString());
    }

        // boolean criteria
        for (int i = 0; i < 8; i++) {
            HSSFCell cellFmla = sheet.getRow(i).getCell(8);
View Full Code Here

    private void confirm(String formulaText, double expectedResult) {
        cell11.setCellFormula(formulaText);
        evaluator.clearAllCachedResultValues();
        CellValue cv = evaluator.evaluate(cell11);
        if (cv.getCellType() != Cell.CELL_TYPE_NUMERIC) {
            throw new AssertionFailedError("Wrong result type: " + cv.formatAsString());
        }
        double actualValue = cv.getNumberValue();
        assertEquals(expectedResult, actualValue, 0);
    }
}
View Full Code Here

        evaluator.evaluateAll();
       
        XSSFCell cell = excel.getSheetAt(0).getRow(1).getCell(1);
        CellValue value = evaluator.evaluate(cell);
       
        assertEquals(expect, value.formatAsString());
    }
}
View Full Code Here

      double expectedResult) {
    fe.clearAllCachedResultValues();
    cell.setCellFormula(formula);
    CellValue cv = fe.evaluate(cell);
    if (cv.getCellType() != Cell.CELL_TYPE_NUMERIC) {
      throw new AssertionFailedError("expected numeric cell type but got " + cv.formatAsString());
    }
    assertEquals(expectedResult, cv.getNumberValue(), 0.0);
  }
  private static void confirm(FormulaEvaluator fe, Cell cell, String formula,
      ErrorEval expectedResult) {
View Full Code Here

      ErrorEval expectedResult) {
    fe.clearAllCachedResultValues();
    cell.setCellFormula(formula);
    CellValue cv = fe.evaluate(cell);
    if (cv.getCellType() != Cell.CELL_TYPE_ERROR) {
      throw new AssertionFailedError("expected error cell type but got " + cv.formatAsString());
    }
    int expCode = expectedResult.getErrorCode();
    if (cv.getErrorValue() != expCode) {
      throw new AssertionFailedError("Expected error '" + EE.getText(expCode)
          + "' but got '" + cv.formatAsString() + "'.");
View Full Code Here

      throw new AssertionFailedError("expected error cell type but got " + cv.formatAsString());
    }
    int expCode = expectedResult.getErrorCode();
    if (cv.getErrorValue() != expCode) {
      throw new AssertionFailedError("Expected error '" + EE.getText(expCode)
          + "' but got '" + cv.formatAsString() + "'.");
    }
  }
}
View Full Code Here

    // numeric criteria
        for (int i = 0; i < 8; i++) {
      CellValue expected = evaluator.evaluate(sheet.getRow(i).getCell(REF_COL));
      CellValue actual = evaluator.evaluate(sheet.getRow(i).getCell(EVAL_COL));
      assertEquals(expected.formatAsString(), actual.formatAsString());
    }

        // boolean criteria
        for (int i = 0; i < 8; i++) {
            HSSFCell cellFmla = sheet.getRow(i).getCell(8);
View Full Code Here

    private void confirm(String formulaText, double expectedResult) {
        cell11.setCellFormula(formulaText);
        evaluator.clearAllCachedResultValues();
        CellValue cv = evaluator.evaluate(cell11);
        if (cv.getCellType() != Cell.CELL_TYPE_NUMERIC) {
            throw new AssertionFailedError("Wrong result type: " + cv.formatAsString());
        }
        double actualValue = cv.getNumberValue();
        assertEquals(expectedResult, actualValue, 0);
    }
}
View Full Code Here

      double expectedResult) {
    fe.clearAllCachedResultValues();
    cell.setCellFormula(formula);
    CellValue cv = fe.evaluate(cell);
    if (cv.getCellType() != Cell.CELL_TYPE_NUMERIC) {
      throw new AssertionFailedError("expected numeric cell type but got " + cv.formatAsString());
    }
    assertEquals(expectedResult, cv.getNumberValue(), 0.0);
  }
  private static void confirm(FormulaEvaluator fe, Cell cell, String formula,
      ErrorEval expectedResult) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.