mirror of https://github.com/apache/poi.git
add @Override annotations to ITestDataProviders
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1725040 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
fca4f0d0cb
commit
384c1bc7b6
|
@ -24,6 +24,7 @@ import java.io.ByteArrayOutputStream;
|
|||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.poi.POIDataSamples;
|
||||
import org.apache.poi.ss.ITestDataProvider;
|
||||
|
@ -40,7 +41,9 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|||
public final class SXSSFITestDataProvider implements ITestDataProvider {
|
||||
public static final SXSSFITestDataProvider instance = new SXSSFITestDataProvider();
|
||||
|
||||
private ArrayList<SXSSFWorkbook> instances = new ArrayList<SXSSFWorkbook>();
|
||||
// an instance of all SXSSFWorkbooks opened by this TestDataProvider,
|
||||
// so that the temporary files created can be disposed up by cleanup()
|
||||
private final List<SXSSFWorkbook> instances = new ArrayList<SXSSFWorkbook>();
|
||||
|
||||
private SXSSFITestDataProvider() {
|
||||
// enforce singleton
|
||||
|
|
|
@ -35,10 +35,12 @@ public final class XSSFITestDataProvider implements ITestDataProvider {
|
|||
// enforce singleton
|
||||
}
|
||||
|
||||
@Override
|
||||
public XSSFWorkbook openSampleWorkbook(String sampleFileName) {
|
||||
return XSSFTestDataSamples.openSampleWorkbook(sampleFileName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public XSSFWorkbook writeOutAndReadBack(Workbook original) {
|
||||
if(!(original instanceof XSSFWorkbook)) {
|
||||
throw new IllegalArgumentException("Expected an instance of XSSFWorkbook, but had " + original.getClass());
|
||||
|
@ -46,22 +48,27 @@ public final class XSSFITestDataProvider implements ITestDataProvider {
|
|||
return XSSFTestDataSamples.writeOutAndReadBack((XSSFWorkbook)original);
|
||||
}
|
||||
|
||||
public XSSFWorkbook createWorkbook(){
|
||||
@Override
|
||||
public XSSFWorkbook createWorkbook() {
|
||||
return new XSSFWorkbook();
|
||||
}
|
||||
|
||||
@Override
|
||||
public FormulaEvaluator createFormulaEvaluator(Workbook wb) {
|
||||
return new XSSFFormulaEvaluator((XSSFWorkbook) wb);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getTestDataFileContent(String fileName) {
|
||||
return POIDataSamples.getSpreadSheetInstance().readFile(fileName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SpreadsheetVersion getSpreadsheetVersion(){
|
||||
return SpreadsheetVersion.EXCEL2007;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStandardFileNameExtension() {
|
||||
return "xlsx";
|
||||
}
|
||||
|
|
|
@ -37,13 +37,16 @@ public final class HSSFITestDataProvider implements ITestDataProvider {
|
|||
// enforce singleton
|
||||
}
|
||||
|
||||
@Override
|
||||
public HSSFWorkbook openSampleWorkbook(String sampleFileName) {
|
||||
return HSSFTestDataSamples.openSampleWorkbook(sampleFileName);
|
||||
}
|
||||
|
||||
public InputStream openWorkbookStream(String sampleFileName) {
|
||||
return HSSFTestDataSamples.openSampleFileStream(sampleFileName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HSSFWorkbook writeOutAndReadBack(Workbook original) {
|
||||
if(!(original instanceof HSSFWorkbook)) {
|
||||
throw new IllegalArgumentException("Expected an instance of HSSFWorkbook");
|
||||
|
@ -51,22 +54,27 @@ public final class HSSFITestDataProvider implements ITestDataProvider {
|
|||
return HSSFTestDataSamples.writeOutAndReadBack((HSSFWorkbook)original);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HSSFWorkbook createWorkbook(){
|
||||
return new HSSFWorkbook();
|
||||
}
|
||||
|
||||
@Override
|
||||
public FormulaEvaluator createFormulaEvaluator(Workbook wb) {
|
||||
return new HSSFFormulaEvaluator((HSSFWorkbook) wb);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getTestDataFileContent(String fileName) {
|
||||
return POIDataSamples.getSpreadSheetInstance().readFile(fileName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SpreadsheetVersion getSpreadsheetVersion(){
|
||||
return SpreadsheetVersion.EXCEL97;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStandardFileNameExtension() {
|
||||
return "xls";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue