aboutsummaryrefslogtreecommitdiffstats
path: root/src/testcases
diff options
context:
space:
mode:
authorDominik Stadler <centic@apache.org>2020-04-24 20:58:32 +0000
committerDominik Stadler <centic@apache.org>2020-04-24 20:58:32 +0000
commit52320e3213c882049a2b20f259f0c430dd0f94b8 (patch)
tree1dac704198b9f38ef73ac682561ae43d97091fe1 /src/testcases
parenta415ae13f7769cc894de3cc06f4379073d78d8f5 (diff)
downloadpoi-52320e3213c882049a2b20f259f0c430dd0f94b8.tar.gz
poi-52320e3213c882049a2b20f259f0c430dd0f94b8.zip
Fix some IDE warnings, remove usage of deprecated methods
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1876947 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases')
-rw-r--r--src/testcases/org/apache/poi/hssf/model/TestFormulaParser.java30
-rw-r--r--src/testcases/org/apache/poi/ss/usermodel/BaseTestCell.java13
2 files changed, 21 insertions, 22 deletions
diff --git a/src/testcases/org/apache/poi/hssf/model/TestFormulaParser.java b/src/testcases/org/apache/poi/hssf/model/TestFormulaParser.java
index 8c0cf9b82f..5a88f460b8 100644
--- a/src/testcases/org/apache/poi/hssf/model/TestFormulaParser.java
+++ b/src/testcases/org/apache/poi/hssf/model/TestFormulaParser.java
@@ -162,10 +162,12 @@ public final class TestFormulaParser {
// Verify that myFunc and yourFunc were successfully added to Workbook names
try (HSSFWorkbook wb2 = HSSFTestDataSamples.writeOutAndReadBack(wb)) {
// HSSFWorkbook/EXCEL97-specific side-effects user-defined function names must be added to Workbook's defined names in order to be saved.
- assertNotNull(wb2.getName("myFunc"));
- assertEqualsIgnoreCase("myFunc", wb2.getName("myFunc").getNameName());
- assertNotNull(wb2.getName("yourFunc"));
- assertEqualsIgnoreCase("yourFunc", wb2.getName("yourFunc").getNameName());
+ HSSFName myFunc = wb2.getName("myFunc");
+ assertNotNull(myFunc);
+ assertEqualsIgnoreCase("myFunc", myFunc.getNameName());
+ HSSFName yourFunc = wb2.getName("yourFunc");
+ assertNotNull(yourFunc);
+ assertEqualsIgnoreCase("yourFunc", yourFunc.getNameName());
// Manually check to make sure file isn't corrupted
// TODO: develop a process for occasionally manually reviewing workbooks
@@ -542,14 +544,14 @@ public final class TestFormulaParser {
assertEquals("Cash_Flow!A1", formula);
// Then the other
- cell.setCellFormula("\'Test Sheet\'!A1");
+ cell.setCellFormula("'Test Sheet'!A1");
formula = cell.getCellFormula();
- assertEquals("\'Test Sheet\'!A1", formula);
+ assertEquals("'Test Sheet'!A1", formula);
// Now both
- cell.setCellFormula("Cash_Flow:\'Test Sheet\'!A1");
+ cell.setCellFormula("Cash_Flow:'Test Sheet'!A1");
formula = cell.getCellFormula();
- assertEquals("Cash_Flow:\'Test Sheet\'!A1", formula);
+ assertEquals("Cash_Flow:'Test Sheet'!A1", formula);
// References to a range (area) of cells:
@@ -560,14 +562,14 @@ public final class TestFormulaParser {
assertEquals("Cash_Flow!A1:B2", formula);
// Then the other
- cell.setCellFormula("\'Test Sheet\'!A1:B2");
+ cell.setCellFormula("'Test Sheet'!A1:B2");
formula = cell.getCellFormula();
- assertEquals("\'Test Sheet\'!A1:B2", formula);
+ assertEquals("'Test Sheet'!A1:B2", formula);
// Now both
- cell.setCellFormula("Cash_Flow:\'Test Sheet\'!A1:B2");
+ cell.setCellFormula("Cash_Flow:'Test Sheet'!A1:B2");
formula = cell.getCellFormula();
- assertEquals("Cash_Flow:\'Test Sheet\'!A1:B2", formula);
+ assertEquals("Cash_Flow:'Test Sheet'!A1:B2", formula);
wb.close();
}
@@ -1085,13 +1087,13 @@ public final class TestFormulaParser {
confirmTokenClasses(ptgs, ArrayPtg.class);
Object element = ((ArrayPtg)ptgs[0]).getTokenArrayValues()[0][0];
- assertEquals(-42.0, ((Double)element).doubleValue(), 0.0);
+ assertEquals(-42.0, (Double) element, 0.0);
// Should be able to handle whitespace between unary minus and digits (Excel
// accepts this formula after presenting the user with a confirmation dialog).
ptgs = parseFormula("{- 5}");
element = ((ArrayPtg)ptgs[0]).getTokenArrayValues()[0][0];
- assertEquals(-5.0, ((Double)element).doubleValue(), 0.0);
+ assertEquals(-5.0, (Double) element, 0.0);
}
@Test
diff --git a/src/testcases/org/apache/poi/ss/usermodel/BaseTestCell.java b/src/testcases/org/apache/poi/ss/usermodel/BaseTestCell.java
index 2ab0f48b5e..e2032de2df 100644
--- a/src/testcases/org/apache/poi/ss/usermodel/BaseTestCell.java
+++ b/src/testcases/org/apache/poi/ss/usermodel/BaseTestCell.java
@@ -133,18 +133,15 @@ public abstract class BaseTestCell {
assertProhibitedValueAccess(cell, CellType.BOOLEAN, CellType.STRING,
CellType.FORMULA, CellType.ERROR);
- String strNull = null;
- cell.setCellValue(strNull);
+ cell.setCellValue((String)null);
assertEquals("", cell.getStringCellValue());
assertEquals(CellType.BLANK, cell.getCellType());
- LocalDate ldNull = null;
- cell.setCellValue(ldNull);
+ cell.setCellValue((LocalDate)null);
assertNull(cell.getLocalDateTimeCellValue());
assertEquals(CellType.BLANK, cell.getCellType());
- LocalDateTime ldtNull = null;
- cell.setCellValue(ldtNull);
+ cell.setCellValue((LocalDateTime)null);
assertNull(cell.getLocalDateTimeCellValue());
assertEquals(CellType.BLANK, cell.getCellType());
@@ -769,12 +766,12 @@ public abstract class BaseTestCell {
Sheet sh = wb1.createSheet();
Row row = sh.createRow(0);
Cell cell = row.createCell(0);
- cell.setCellValue(Integer.valueOf(23));
+ cell.setCellValue(23);
cell.setCellValue("some");
cell = row.createCell(1);
- cell.setCellValue(Integer.valueOf(23));
+ cell.setCellValue(23);
cell.setCellValue("24");