From: Javen O'Neal Date: Mon, 30 Nov 2015 05:22:14 +0000 (+0000) Subject: add @Override annotation. Explicitly specify workbook type returned by SXSSFITestData... X-Git-Tag: REL_3_14_BETA1~34 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=4eadfb17791af388ec43b4deb7761be3c5198844;p=poi.git add @Override annotation. Explicitly specify workbook type returned by SXSSFITestDataProvider.writeOutAndReadBack git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1717179 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/ooxml/testcases/org/apache/poi/xssf/SXSSFITestDataProvider.java b/src/ooxml/testcases/org/apache/poi/xssf/SXSSFITestDataProvider.java index eab0413cc8..39b520fd00 100644 --- a/src/ooxml/testcases/org/apache/poi/xssf/SXSSFITestDataProvider.java +++ b/src/ooxml/testcases/org/apache/poi/xssf/SXSSFITestDataProvider.java @@ -46,6 +46,7 @@ public final class SXSSFITestDataProvider implements ITestDataProvider { // enforce singleton } + @Override public Workbook openSampleWorkbook(String sampleFileName) { XSSFWorkbook xssfWorkbook = XSSFITestDataProvider.instance.openSampleWorkbook(sampleFileName); SXSSFWorkbook swb = new SXSSFWorkbook(xssfWorkbook); @@ -53,12 +54,16 @@ public final class SXSSFITestDataProvider implements ITestDataProvider { return swb; } - public Workbook writeOutAndReadBack(Workbook wb) { + /** + * Returns an XSSFWorkbook since SXSSFWorkbook is write-only + */ + @Override + public XSSFWorkbook writeOutAndReadBack(Workbook wb) { if(!(wb instanceof SXSSFWorkbook)) { throw new IllegalArgumentException("Expected an instance of SXSSFWorkbook"); } - Workbook result; + XSSFWorkbook result; try { ByteArrayOutputStream baos = new ByteArrayOutputStream(8192); wb.write(baos); @@ -70,24 +75,29 @@ public final class SXSSFITestDataProvider implements ITestDataProvider { return result; } + @Override public SXSSFWorkbook createWorkbook(){ SXSSFWorkbook wb = new SXSSFWorkbook(); instances.add(wb); return wb; } + @Override public FormulaEvaluator createFormulaEvaluator(Workbook wb) { return new XSSFFormulaEvaluator(((SXSSFWorkbook) wb).getXSSFWorkbook()); } + @Override public byte[] getTestDataFileContent(String fileName) { return POIDataSamples.getSpreadSheetInstance().readFile(fileName); } + @Override public SpreadsheetVersion getSpreadsheetVersion(){ return SpreadsheetVersion.EXCEL2007; } + @Override public String getStandardFileNameExtension() { return "xlsx"; }