Replace deprecated CellReference class and some other warnings fixed
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1809714 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
43717f6936
commit
af1b1d619c
@ -19,7 +19,7 @@ package org.apache.poi.hssf.record;
|
||||
|
||||
import org.apache.poi.ss.formula.ptg.TblPtg;
|
||||
import org.apache.poi.hssf.util.CellRangeAddress8Bit;
|
||||
import org.apache.poi.hssf.util.CellReference;
|
||||
import org.apache.poi.ss.util.CellReference;
|
||||
import org.apache.poi.util.BitField;
|
||||
import org.apache.poi.util.BitFieldFactory;
|
||||
import org.apache.poi.util.HexDump;
|
||||
@ -156,7 +156,7 @@ public final class TableRecord extends SharedValueRecordBase {
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
buffer.append("[TABLE]\n");
|
||||
buffer.append(" .range = ").append(getRange()).append("\n");
|
||||
buffer.append(" .flags = ") .append(HexDump.byteToHex(field_5_flags)).append("\n");
|
||||
|
@ -42,7 +42,7 @@ import org.apache.poi.hssf.record.FtCfSubRecord;
|
||||
import org.apache.poi.hssf.record.FtPioGrbitSubRecord;
|
||||
import org.apache.poi.hssf.record.NoteRecord;
|
||||
import org.apache.poi.hssf.record.ObjRecord;
|
||||
import org.apache.poi.hssf.util.CellReference;
|
||||
import org.apache.poi.ss.util.CellReference;
|
||||
import org.apache.poi.poifs.filesystem.DirectoryEntry;
|
||||
import org.apache.poi.poifs.filesystem.DirectoryNode;
|
||||
import org.apache.poi.ss.usermodel.Chart;
|
||||
@ -119,7 +119,7 @@ public final class HSSFPatriarch implements HSSFShapeContainer, Drawing<HSSFShap
|
||||
*/
|
||||
protected void preSerialize(){
|
||||
Map<Integer, NoteRecord> tailRecords = _boundAggregate.getTailRecords();
|
||||
/**
|
||||
/*
|
||||
* contains coordinates of comments we iterate over
|
||||
*/
|
||||
Set<String> coordinates = new HashSet<>(tailRecords.size());
|
||||
@ -392,8 +392,7 @@ public final class HSSFPatriarch implements HSSFShapeContainer, Drawing<HSSFShap
|
||||
*/
|
||||
public int countOfAllChildren() {
|
||||
int count = _shapes.size();
|
||||
for (Iterator<HSSFShape> iterator = _shapes.iterator(); iterator.hasNext(); ) {
|
||||
HSSFShape shape = iterator.next();
|
||||
for (HSSFShape shape : _shapes) {
|
||||
count += shape.countOfAllChildren();
|
||||
}
|
||||
return count;
|
||||
@ -450,8 +449,7 @@ public final class HSSFPatriarch implements HSSFShapeContainer, Drawing<HSSFShap
|
||||
return false;
|
||||
}
|
||||
|
||||
for (Iterator<EscherProperty> it = optRecord.getEscherProperties().iterator(); it.hasNext(); ) {
|
||||
EscherProperty prop = it.next();
|
||||
for (EscherProperty prop : optRecord.getEscherProperties()) {
|
||||
if (prop.getPropertyNumber() == 896 && prop.isComplex()) {
|
||||
EscherComplexProperty cp = (EscherComplexProperty) prop;
|
||||
String str = StringUtil.getFromUnicodeLE(cp.getComplexData());
|
||||
|
@ -82,7 +82,6 @@ import org.apache.poi.hssf.record.aggregates.RecordAggregate.RecordVisitor;
|
||||
import org.apache.poi.hssf.record.common.UnicodeString;
|
||||
import org.apache.poi.hssf.record.crypto.Biff8DecryptingStream;
|
||||
import org.apache.poi.hssf.record.crypto.Biff8EncryptionKey;
|
||||
import org.apache.poi.hssf.util.CellReference;
|
||||
import org.apache.poi.poifs.crypt.ChunkedCipherOutputStream;
|
||||
import org.apache.poi.poifs.crypt.Decryptor;
|
||||
import org.apache.poi.poifs.crypt.EncryptionInfo;
|
||||
@ -110,6 +109,7 @@ import org.apache.poi.ss.usermodel.Row.MissingCellPolicy;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.usermodel.SheetVisibility;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.poi.ss.util.CellReference;
|
||||
import org.apache.poi.util.Configurator;
|
||||
import org.apache.poi.util.HexDump;
|
||||
import org.apache.poi.util.IOUtils;
|
||||
@ -1367,12 +1367,9 @@ public final class HSSFWorkbook extends POIDocument implements org.apache.poi.ss
|
||||
*/
|
||||
@Override
|
||||
public void write(File newFile) throws IOException {
|
||||
POIFSFileSystem fs = POIFSFileSystem.create(newFile);
|
||||
try {
|
||||
try (POIFSFileSystem fs = POIFSFileSystem.create(newFile)) {
|
||||
write(fs);
|
||||
fs.writeFilesystem();
|
||||
} finally {
|
||||
fs.close();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1393,12 +1390,9 @@ public final class HSSFWorkbook extends POIDocument implements org.apache.poi.ss
|
||||
*/
|
||||
@Override
|
||||
public void write(OutputStream stream) throws IOException {
|
||||
NPOIFSFileSystem fs = new NPOIFSFileSystem();
|
||||
try {
|
||||
try (NPOIFSFileSystem fs = new NPOIFSFileSystem()) {
|
||||
write(fs);
|
||||
fs.writeFilesystem(stream);
|
||||
} finally {
|
||||
fs.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -24,8 +24,7 @@ import java.util.Iterator;
|
||||
import org.apache.poi.hssf.HSSFTestDataSamples;
|
||||
import org.apache.poi.hssf.record.FormulaRecord;
|
||||
import org.apache.poi.hssf.record.aggregates.FormulaRecordAggregate;
|
||||
import org.apache.poi.hssf.util.CellReference;
|
||||
import org.apache.poi.ss.formula.ptg.Ptg;
|
||||
import org.apache.poi.ss.util.CellReference;
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
import org.apache.poi.ss.usermodel.CellType;
|
||||
import org.apache.poi.ss.usermodel.CellValue;
|
||||
@ -73,9 +72,9 @@ public final class TestBug42464 {
|
||||
}
|
||||
FormulaRecordAggregate record = (FormulaRecordAggregate) cell.getCellValueRecord();
|
||||
FormulaRecord r = record.getFormulaRecord();
|
||||
Ptg[] ptgs = r.getParsedExpression();
|
||||
/*Ptg[] ptgs =*/ r.getParsedExpression();
|
||||
|
||||
String cellRef = new CellReference(row.getRowNum(), cell.getColumnIndex(), false, false).formatAsString();
|
||||
/*String cellRef =*/ new CellReference(row.getRowNum(), cell.getColumnIndex(), false, false).formatAsString();
|
||||
// if(false && cellRef.equals("BP24")) { // TODO - replace System.out.println()s with asserts
|
||||
// System.out.print(cellRef);
|
||||
// System.out.println(" - has " + ptgs.length + " ptgs:");
|
||||
|
@ -28,7 +28,7 @@ import java.util.Date;
|
||||
|
||||
import org.apache.poi.hssf.HSSFTestDataSamples;
|
||||
import org.apache.poi.hssf.model.HSSFFormulaParser;
|
||||
import org.apache.poi.hssf.util.CellReference;
|
||||
import org.apache.poi.ss.util.CellReference;
|
||||
import org.apache.poi.ss.formula.FormulaType;
|
||||
import org.apache.poi.ss.formula.ptg.NamePtg;
|
||||
import org.apache.poi.ss.formula.ptg.Ptg;
|
||||
@ -52,8 +52,8 @@ public final class TestFormulas {
|
||||
|
||||
HSSFWorkbook wb1 = new HSSFWorkbook();
|
||||
HSSFSheet s = wb1.createSheet();
|
||||
HSSFRow r = null;
|
||||
HSSFCell c = null;
|
||||
HSSFRow r;
|
||||
HSSFCell c;
|
||||
|
||||
//get our minimum values
|
||||
r = s.createRow(1);
|
||||
@ -165,8 +165,8 @@ public final class TestFormulas {
|
||||
private static void floatTest(String operator) throws IOException {
|
||||
HSSFWorkbook wb1 = new HSSFWorkbook();
|
||||
HSSFSheet s = wb1.createSheet();
|
||||
HSSFRow r = null;
|
||||
HSSFCell c = null;
|
||||
HSSFRow r;
|
||||
HSSFCell c;
|
||||
|
||||
//get our minimum values
|
||||
|
||||
@ -240,8 +240,8 @@ public final class TestFormulas {
|
||||
private static void operationRefTest(String operator) throws IOException {
|
||||
HSSFWorkbook wb1 = new HSSFWorkbook();
|
||||
HSSFSheet s = wb1.createSheet();
|
||||
HSSFRow r = null;
|
||||
HSSFCell c = null;
|
||||
HSSFRow r;
|
||||
HSSFCell c;
|
||||
|
||||
//get our minimum values
|
||||
r = s.createRow(0);
|
||||
@ -253,12 +253,12 @@ public final class TestFormulas {
|
||||
|
||||
for (int y = 1; y < 256 && y > 0; y++) {
|
||||
|
||||
String ref=null;
|
||||
String ref2=null;
|
||||
short refx1=0;
|
||||
short refy1=0;
|
||||
short refx2=0;
|
||||
short refy2=0;
|
||||
String ref;
|
||||
String ref2;
|
||||
short refx1;
|
||||
short refy1;
|
||||
short refx2;
|
||||
short refy2;
|
||||
if (x +50 < Short.MAX_VALUE) {
|
||||
refx1=(short)(x+50);
|
||||
refx2=(short)(x+46);
|
||||
@ -309,8 +309,8 @@ public final class TestFormulas {
|
||||
private static void operationalRefVerify(String operator, HSSFWorkbook wb) {
|
||||
|
||||
HSSFSheet s = wb.getSheetAt(0);
|
||||
HSSFRow r = null;
|
||||
HSSFCell c = null;
|
||||
HSSFRow r;
|
||||
HSSFCell c;
|
||||
|
||||
//get our minimum values
|
||||
r = s.getRow(0);
|
||||
@ -376,8 +376,8 @@ public final class TestFormulas {
|
||||
private static void orderTest(String formula) throws IOException {
|
||||
HSSFWorkbook wb1 = new HSSFWorkbook();
|
||||
HSSFSheet s = wb1.createSheet();
|
||||
HSSFRow r = null;
|
||||
HSSFCell c = null;
|
||||
HSSFRow r;
|
||||
HSSFCell c;
|
||||
|
||||
//get our minimum values
|
||||
r = s.createRow(0);
|
||||
@ -403,8 +403,8 @@ public final class TestFormulas {
|
||||
private static void binomialOperator(String operator) throws IOException {
|
||||
HSSFWorkbook wb1 = new HSSFWorkbook();
|
||||
HSSFSheet s = wb1.createSheet();
|
||||
HSSFRow r = null;
|
||||
HSSFCell c = null;
|
||||
HSSFRow r;
|
||||
HSSFCell c;
|
||||
|
||||
//get our minimum values
|
||||
r = s.createRow(0);
|
||||
@ -440,8 +440,8 @@ public final class TestFormulas {
|
||||
*/
|
||||
private static void binomialVerify(String operator, HSSFWorkbook wb) {
|
||||
HSSFSheet s = wb.getSheetAt(0);
|
||||
HSSFRow r = null;
|
||||
HSSFCell c = null;
|
||||
HSSFRow r;
|
||||
HSSFCell c;
|
||||
|
||||
//get our minimum values
|
||||
r = s.getRow(0);
|
||||
@ -481,8 +481,8 @@ public final class TestFormulas {
|
||||
|
||||
HSSFWorkbook wb1 = new HSSFWorkbook();
|
||||
HSSFSheet s = wb1.createSheet();
|
||||
HSSFRow r = null;
|
||||
HSSFCell c = null;
|
||||
HSSFRow r;
|
||||
HSSFCell c;
|
||||
|
||||
|
||||
r = s.createRow(0);
|
||||
@ -509,8 +509,8 @@ public final class TestFormulas {
|
||||
|
||||
HSSFWorkbook wb1 = new HSSFWorkbook();
|
||||
HSSFSheet s = wb1.createSheet();
|
||||
HSSFRow r = null;
|
||||
HSSFCell c = null;
|
||||
HSSFRow r;
|
||||
HSSFCell c;
|
||||
|
||||
|
||||
r = s.createRow(0);
|
||||
@ -539,8 +539,8 @@ public final class TestFormulas {
|
||||
|
||||
HSSFWorkbook wb1 = new HSSFWorkbook();
|
||||
HSSFSheet s = wb1.createSheet();
|
||||
HSSFRow r = null;
|
||||
HSSFCell c = null;
|
||||
HSSFRow r;
|
||||
HSSFCell c;
|
||||
|
||||
|
||||
r = s.createRow(0);
|
||||
@ -608,8 +608,8 @@ public final class TestFormulas {
|
||||
public void testSheetFunctions() throws IOException {
|
||||
HSSFWorkbook wb1 = new HSSFWorkbook();
|
||||
HSSFSheet s = wb1.createSheet("A");
|
||||
HSSFRow r = null;
|
||||
HSSFCell c = null;
|
||||
HSSFRow r;
|
||||
HSSFCell c;
|
||||
r = s.createRow(0);
|
||||
c = r.createCell(0);c.setCellValue(1);
|
||||
c = r.createCell(1);c.setCellValue(2);
|
||||
@ -638,8 +638,8 @@ public final class TestFormulas {
|
||||
FileOutputStream out = new FileOutputStream(file);
|
||||
HSSFWorkbook wb = new HSSFWorkbook();
|
||||
HSSFSheet s = wb.createSheet();
|
||||
HSSFRow r = null;
|
||||
HSSFCell c = null;
|
||||
HSSFRow r;
|
||||
HSSFCell c;
|
||||
|
||||
|
||||
r = s.createRow(0);
|
||||
@ -676,8 +676,8 @@ public final class TestFormulas {
|
||||
public void testStringFormulas() throws IOException {
|
||||
HSSFWorkbook wb = new HSSFWorkbook();
|
||||
HSSFSheet s = wb.createSheet("A");
|
||||
HSSFRow r = null;
|
||||
HSSFCell c = null;
|
||||
HSSFRow r;
|
||||
HSSFCell c;
|
||||
r = s.createRow(0);
|
||||
c=r.createCell(1); c.setCellFormula("UPPER(\"abc\")");
|
||||
c=r.createCell(2); c.setCellFormula("LOWER(\"ABC\")");
|
||||
@ -699,8 +699,8 @@ public final class TestFormulas {
|
||||
|
||||
HSSFWorkbook wb1 = new HSSFWorkbook();
|
||||
HSSFSheet s = wb1.createSheet("A");
|
||||
HSSFRow r = null;
|
||||
HSSFCell c = null;
|
||||
HSSFRow r;
|
||||
HSSFCell c;
|
||||
r = s.createRow(0);
|
||||
c=r.createCell(1); c.setCellFormula("IF(A1<A2,B1,B2)");
|
||||
|
||||
@ -717,8 +717,8 @@ public final class TestFormulas {
|
||||
public void testDateFormulas() throws IOException {
|
||||
HSSFWorkbook wb = new HSSFWorkbook();
|
||||
HSSFSheet s = wb.createSheet("testSheet1");
|
||||
HSSFRow r = null;
|
||||
HSSFCell c = null;
|
||||
HSSFRow r;
|
||||
HSSFCell c;
|
||||
|
||||
r = s.createRow(0 );
|
||||
c = r.createCell(0 );
|
||||
@ -746,8 +746,8 @@ public final class TestFormulas {
|
||||
public void testIfFormulas() throws IOException {
|
||||
HSSFWorkbook wb1 = new HSSFWorkbook();
|
||||
HSSFSheet s = wb1.createSheet("testSheet1");
|
||||
HSSFRow r = null;
|
||||
HSSFCell c = null;
|
||||
HSSFRow r;
|
||||
HSSFCell c;
|
||||
r = s.createRow(0);
|
||||
c=r.createCell(1); c.setCellValue(1);
|
||||
c=r.createCell(2); c.setCellValue(2);
|
||||
@ -906,22 +906,16 @@ public final class TestFormulas {
|
||||
/** test for bug 34021*/
|
||||
@Test
|
||||
public void testComplexSheetRefs () throws IOException {
|
||||
HSSFWorkbook sb = new HSSFWorkbook();
|
||||
try {
|
||||
HSSFSheet s1 = sb.createSheet("Sheet a.1");
|
||||
HSSFSheet s2 = sb.createSheet("Sheet.A");
|
||||
s2.createRow(1).createCell(2).setCellFormula("'Sheet a.1'!A1");
|
||||
s1.createRow(1).createCell(2).setCellFormula("'Sheet.A'!A1");
|
||||
File file = TempFile.createTempFile("testComplexSheetRefs",".xls");
|
||||
FileOutputStream stream = new FileOutputStream(file);
|
||||
try {
|
||||
sb.write(stream);
|
||||
} finally {
|
||||
stream.close();
|
||||
}
|
||||
} finally {
|
||||
sb.close();
|
||||
}
|
||||
try (HSSFWorkbook sb = new HSSFWorkbook()) {
|
||||
HSSFSheet s1 = sb.createSheet("Sheet a.1");
|
||||
HSSFSheet s2 = sb.createSheet("Sheet.A");
|
||||
s2.createRow(1).createCell(2).setCellFormula("'Sheet a.1'!A1");
|
||||
s1.createRow(1).createCell(2).setCellFormula("'Sheet.A'!A1");
|
||||
File file = TempFile.createTempFile("testComplexSheetRefs", ".xls");
|
||||
try (FileOutputStream stream = new FileOutputStream(file)) {
|
||||
sb.write(stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Unknown Ptg 3C*/
|
||||
@ -931,25 +925,20 @@ public final class TestFormulas {
|
||||
wb.getSheetAt(0);
|
||||
assertEquals("Reference for named range ", "Compliance!#REF!",wb.getNameAt(0).getRefersToFormula());
|
||||
File outF = TempFile.createTempFile("bug27272_1",".xls");
|
||||
FileOutputStream stream = new FileOutputStream(outF);
|
||||
try {
|
||||
try (FileOutputStream stream = new FileOutputStream(outF)) {
|
||||
wb.write(stream);
|
||||
} finally {
|
||||
stream.close();
|
||||
}
|
||||
wb.close();
|
||||
}
|
||||
|
||||
/** Unknown Ptg 3D*/
|
||||
@Test
|
||||
public void test27272_2() throws IOException {
|
||||
HSSFWorkbook wb = openSample("27272_2.xls");
|
||||
assertEquals("Reference for named range ", "LOAD.POD_HISTORIES!#REF!",wb.getNameAt(0).getRefersToFormula());
|
||||
File outF = TempFile.createTempFile("bug27272_2",".xls");
|
||||
FileOutputStream stream = new FileOutputStream(outF);
|
||||
try {
|
||||
try (FileOutputStream stream = new FileOutputStream(outF)) {
|
||||
wb.write(stream);
|
||||
} finally {
|
||||
stream.close();
|
||||
}
|
||||
wb.close();
|
||||
}
|
||||
@ -957,12 +946,9 @@ public final class TestFormulas {
|
||||
/** MissingArgPtg */
|
||||
@Test
|
||||
public void testMissingArgPtg() throws IOException {
|
||||
HSSFWorkbook wb = new HSSFWorkbook();
|
||||
try {
|
||||
try (HSSFWorkbook wb = new HSSFWorkbook()) {
|
||||
HSSFCell cell = wb.createSheet("Sheet1").createRow(4).createCell(0);
|
||||
cell.setCellFormula("IF(A1=\"A\",1,)");
|
||||
} finally {
|
||||
wb.close();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1032,22 +1018,19 @@ public final class TestFormulas {
|
||||
*/
|
||||
@Test
|
||||
public void testFormulasWithUnderscore() throws IOException{
|
||||
HSSFWorkbook wb = new HSSFWorkbook();
|
||||
try {
|
||||
try (HSSFWorkbook wb = new HSSFWorkbook()) {
|
||||
Name nm1 = wb.createName();
|
||||
nm1.setNameName("_score1");
|
||||
nm1.setRefersToFormula("A1");
|
||||
|
||||
|
||||
Name nm2 = wb.createName();
|
||||
nm2.setNameName("_score2");
|
||||
nm2.setRefersToFormula("A2");
|
||||
|
||||
|
||||
Sheet sheet = wb.createSheet();
|
||||
Cell cell = sheet.createRow(0).createCell(2);
|
||||
cell.setCellFormula("_score1*SUM(_score1+_score2)");
|
||||
assertEquals("_score1*SUM(_score1+_score2)", cell.getCellFormula());
|
||||
} finally {
|
||||
wb.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ import org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator;
|
||||
import org.apache.poi.hssf.usermodel.HSSFRow;
|
||||
import org.apache.poi.hssf.usermodel.HSSFSheet;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.hssf.util.CellReference;
|
||||
import org.apache.poi.ss.util.CellReference;
|
||||
import org.apache.poi.ss.formula.IEvaluationListener.ICacheEntry;
|
||||
import org.apache.poi.ss.formula.PlainCellCache.Loc;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
@ -162,7 +162,7 @@ public class TestEvaluationCache extends TestCase {
|
||||
}
|
||||
}
|
||||
private void log(String tag, int rowIndex, int columnIndex, Object value) {
|
||||
StringBuffer sb = new StringBuffer(64);
|
||||
StringBuilder sb = new StringBuilder(64);
|
||||
sb.append(tag).append(' ');
|
||||
sb.append(new CellReference(rowIndex, columnIndex, false, false).formatAsString());
|
||||
if (value != null) {
|
||||
@ -208,9 +208,8 @@ public class TestEvaluationCache extends TestCase {
|
||||
* Wrapper class to manage repetitive tasks from this test,
|
||||
*
|
||||
* Note - this class does a little bit more than just plain set-up of data. The method
|
||||
* {@link WorkbookEvaluator#clearCachedResultValue(HSSFSheet, int, int)} is called whenever a
|
||||
* {@link WorkbookEvaluator#notifyUpdateCell(EvaluationCell)} is called whenever a
|
||||
* cell value is changed.
|
||||
*
|
||||
*/
|
||||
private static final class MySheet {
|
||||
|
||||
|
@ -34,7 +34,7 @@ import org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator;
|
||||
import org.apache.poi.hssf.usermodel.HSSFRow;
|
||||
import org.apache.poi.hssf.usermodel.HSSFSheet;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.hssf.util.CellReference;
|
||||
import org.apache.poi.ss.util.CellReference;
|
||||
import org.apache.poi.ss.formula.eval.ErrorEval;
|
||||
import org.apache.poi.ss.usermodel.CellType;
|
||||
import org.apache.poi.ss.usermodel.CellValue;
|
||||
@ -50,8 +50,6 @@ public abstract class BaseTestFunctionsFromSpreadsheet {
|
||||
* This class defines constants for navigating around the test data spreadsheet used for these tests.
|
||||
*/
|
||||
interface SS {
|
||||
/** Name of the test spreadsheet (found in the standard test data folder) */
|
||||
|
||||
/** Name of the first sheet in the spreadsheet (contains comments) */
|
||||
String README_SHEET_NAME = "Read Me";
|
||||
|
||||
@ -70,7 +68,7 @@ public abstract class BaseTestFunctionsFromSpreadsheet {
|
||||
|
||||
}
|
||||
|
||||
@Parameter(value = 0)
|
||||
@Parameter()
|
||||
public String testName;
|
||||
@Parameter(value = 1)
|
||||
public String filename;
|
||||
@ -92,7 +90,7 @@ public abstract class BaseTestFunctionsFromSpreadsheet {
|
||||
int nSheets = workbook.getNumberOfSheets();
|
||||
for(int sheetIdx=1; sheetIdx< nSheets; sheetIdx++) {
|
||||
HSSFSheet sheet = workbook.getSheetAt(sheetIdx);
|
||||
processFunctionGroup(data, sheet, SS.START_TEST_CASES_ROW_INDEX, null, filename);
|
||||
processFunctionGroup(data, sheet, SS.START_TEST_CASES_ROW_INDEX, filename);
|
||||
}
|
||||
|
||||
workbook.close();
|
||||
@ -100,7 +98,7 @@ public abstract class BaseTestFunctionsFromSpreadsheet {
|
||||
return data;
|
||||
}
|
||||
|
||||
private static void processFunctionGroup(List<Object[]> data, HSSFSheet sheet, final int startRowIndex, String testFocusFunctionName, String filename) {
|
||||
private static void processFunctionGroup(List<Object[]> data, HSSFSheet sheet, final int startRowIndex, String filename) {
|
||||
HSSFFormulaEvaluator evaluator = new HSSFFormulaEvaluator(sheet.getWorkbook());
|
||||
|
||||
String currentGroupComment = "";
|
||||
@ -224,13 +222,13 @@ public abstract class BaseTestFunctionsFromSpreadsheet {
|
||||
return "";
|
||||
}
|
||||
|
||||
private static String formatValue(HSSFCell expecedCell) {
|
||||
switch (expecedCell.getCellType()) {
|
||||
private static String formatValue(HSSFCell expectedCell) {
|
||||
switch (expectedCell.getCellType()) {
|
||||
case BLANK: return "<blank>";
|
||||
case BOOLEAN: return Boolean.toString(expecedCell.getBooleanCellValue());
|
||||
case NUMERIC: return Double.toString(expecedCell.getNumericCellValue());
|
||||
case STRING: return expecedCell.getRichStringCellValue().getString();
|
||||
default: fail("Unexpected cell type of expected value (" + expecedCell.getCellType() + ")");
|
||||
case BOOLEAN: return Boolean.toString(expectedCell.getBooleanCellValue());
|
||||
case NUMERIC: return Double.toString(expectedCell.getNumericCellValue());
|
||||
case STRING: return expectedCell.getRichStringCellValue().getString();
|
||||
default: fail("Unexpected cell type of expected value (" + expectedCell.getCellType() + ")");
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ import org.apache.poi.hssf.HSSFTestDataSamples;
|
||||
import org.apache.poi.hssf.usermodel.HSSFCell;
|
||||
import org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.hssf.util.CellReference;
|
||||
import org.apache.poi.ss.util.CellReference;
|
||||
/**
|
||||
* Tests for proper calculation of named ranges from external workbooks.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user