From 24e5a0a4586f520cef86aaffe74415251dc06bf3 Mon Sep 17 00:00:00 2001 From: Javen O'Neal Date: Mon, 30 Nov 2015 05:22:14 +0000 Subject: [PATCH] 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 --- .../apache/poi/xssf/SXSSFITestDataProvider.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/ooxml/testcases/org/apache/poi/xssf/SXSSFITestDataProvider.java b/src/ooxml/testcases/org/apache/poi/xssf/SXSSFITestDataProvider.java index eab0413cc..39b520fd0 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"; }