Fix test to make it work on different date as well

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1612786 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dominik Stadler 2014-07-23 07:55:48 +00:00
parent b6dd3bca34
commit a5d32d87d4

View File

@ -26,6 +26,7 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Calendar;
import java.util.List;
import org.apache.poi.EncryptedDocumentException;
@ -40,6 +41,7 @@ import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.ss.formula.WorkbookEvaluator;
import org.apache.poi.ss.formula.eval.ErrorEval;
import org.apache.poi.ss.formula.eval.NumberEval;
import org.apache.poi.ss.formula.eval.ValueEval;
import org.apache.poi.ss.formula.functions.Function;
import org.apache.poi.ss.usermodel.*;
@ -1753,12 +1755,11 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
public void testBug56688_4() {
XSSFWorkbook excel = XSSFTestDataSamples.openSampleWorkbook("56688_4.xlsx");
// Calendar calendar = Calendar.getInstance();
// calendar.add(Calendar.MONTH, 2);
// double excelDate = DateUtil.getExcelDate(calendar.getTime());
// NumberEval eval = new NumberEval(Math.floor(excelDate));
// checkValue(excel, eval.getStringValue() + ".0");
checkValue(excel, "41904.0");
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.MONTH, 2);
double excelDate = DateUtil.getExcelDate(calendar.getTime());
NumberEval eval = new NumberEval(Math.floor(excelDate));
checkValue(excel, eval.getStringValue() + ".0");
}
private void checkValue(XSSFWorkbook excel, String expect) {