diff options
author | Dominik Stadler <centic@apache.org> | 2013-08-23 10:44:39 +0000 |
---|---|---|
committer | Dominik Stadler <centic@apache.org> | 2013-08-23 10:44:39 +0000 |
commit | 5a067c6b972cbb2892ba676916622f9f179d220a (patch) | |
tree | 26be2b0d01ea33afd55413ccf60efd08023e54a0 /src/testcases/org/apache/poi | |
parent | cb6ca3554d19f4cef1e7807db50a4cceb935eed8 (diff) | |
download | poi-5a067c6b972cbb2892ba676916622f9f179d220a.tar.gz poi-5a067c6b972cbb2892ba676916622f9f179d220a.zip |
fix some Eclipse warnings, adjust some unit tests slightly
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1516818 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org/apache/poi')
3 files changed, 55 insertions, 42 deletions
diff --git a/src/testcases/org/apache/poi/POIDataSamples.java b/src/testcases/org/apache/poi/POIDataSamples.java index 6cdf7ce8f5..b335215390 100644 --- a/src/testcases/org/apache/poi/POIDataSamples.java +++ b/src/testcases/org/apache/poi/POIDataSamples.java @@ -16,7 +16,12 @@ ==================================================================== */
package org.apache.poi;
-import java.io.*;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
/**
* Centralises logic for finding/opening sample files
@@ -219,16 +224,20 @@ public final class POIDataSamples { _is = is;
}
- public int read() throws IOException {
+ @Override
+ public int read() throws IOException {
return _is.read();
}
- public int read(byte[] b, int off, int len) throws IOException {
+ @Override
+ public int read(byte[] b, int off, int len) throws IOException {
return _is.read(b, off, len);
}
- public boolean markSupported() {
+ @Override
+ public boolean markSupported() {
return false;
}
- public void close() throws IOException {
+ @Override
+ public void close() throws IOException {
_is.close();
}
}
diff --git a/src/testcases/org/apache/poi/hssf/usermodel/AllUserModelTests.java b/src/testcases/org/apache/poi/hssf/usermodel/AllUserModelTests.java index e71289c149..8363449bfa 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/AllUserModelTests.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/AllUserModelTests.java @@ -71,9 +71,8 @@ public class AllUserModelTests { result.addTestSuite(TestRowStyle.class); result.addTestSuite(TestSanityChecker.class); result.addTestSuite(TestSheetHiding.class); - if (false) { // deliberately avoiding this one - result.addTestSuite(TestUnfixedBugs.class); - } + /* deliberately avoiding this one + result.addTestSuite(TestUnfixedBugs.class);*/ result.addTestSuite(TestUnicodeWorkbook.class); result.addTestSuite(TestNonStandardWorkbookStreamNames.class); result.addTestSuite(TestWorkbook.class); diff --git a/src/testcases/org/apache/poi/ss/usermodel/BaseTestRow.java b/src/testcases/org/apache/poi/ss/usermodel/BaseTestRow.java index eb185471f4..d013beaf21 100644 --- a/src/testcases/org/apache/poi/ss/usermodel/BaseTestRow.java +++ b/src/testcases/org/apache/poi/ss/usermodel/BaseTestRow.java @@ -89,36 +89,41 @@ public abstract class BaseTestRow extends TestCase { public void testRemoveCell() { Workbook workbook = _testDataProvider.createWorkbook(); - Sheet sheet = workbook.createSheet(); - Row row = sheet.createRow(0); - - assertEquals(0, row.getPhysicalNumberOfCells()); - assertEquals(-1, row.getLastCellNum()); - assertEquals(-1, row.getFirstCellNum()); - - row.createCell(1); - assertEquals(2, row.getLastCellNum()); - assertEquals(1, row.getFirstCellNum()); - assertEquals(1, row.getPhysicalNumberOfCells()); - row.createCell(3); - assertEquals(4, row.getLastCellNum()); - assertEquals(1, row.getFirstCellNum()); - assertEquals(2, row.getPhysicalNumberOfCells()); - row.removeCell(row.getCell(3)); - assertEquals(2, row.getLastCellNum()); - assertEquals(1, row.getFirstCellNum()); - assertEquals(1, row.getPhysicalNumberOfCells()); - row.removeCell(row.getCell(1)); - assertEquals(-1, row.getLastCellNum()); - assertEquals(-1, row.getFirstCellNum()); - assertEquals(0, row.getPhysicalNumberOfCells()); + { + Sheet sheet = workbook.createSheet(); + Row row = sheet.createRow(0); + + assertEquals(0, row.getPhysicalNumberOfCells()); + assertEquals(-1, row.getLastCellNum()); + assertEquals(-1, row.getFirstCellNum()); + + row.createCell(1); + assertEquals(2, row.getLastCellNum()); + assertEquals(1, row.getFirstCellNum()); + assertEquals(1, row.getPhysicalNumberOfCells()); + row.createCell(3); + assertEquals(4, row.getLastCellNum()); + assertEquals(1, row.getFirstCellNum()); + assertEquals(2, row.getPhysicalNumberOfCells()); + row.removeCell(row.getCell(3)); + assertEquals(2, row.getLastCellNum()); + assertEquals(1, row.getFirstCellNum()); + assertEquals(1, row.getPhysicalNumberOfCells()); + row.removeCell(row.getCell(1)); + assertEquals(-1, row.getLastCellNum()); + assertEquals(-1, row.getFirstCellNum()); + assertEquals(0, row.getPhysicalNumberOfCells()); + } workbook = _testDataProvider.writeOutAndReadBack(workbook); - sheet = workbook.getSheetAt(0); - row = sheet.getRow(0); - assertEquals(-1, row.getLastCellNum()); - assertEquals(-1, row.getFirstCellNum()); - assertEquals(0, row.getPhysicalNumberOfCells()); + + { + Sheet sheet = workbook.getSheetAt(0); + Row row = sheet.getRow(0); + assertEquals(-1, row.getLastCellNum()); + assertEquals(-1, row.getFirstCellNum()); + assertEquals(0, row.getPhysicalNumberOfCells()); + } } public void baseTestRowBounds(int maxRowNum) { @@ -387,30 +392,30 @@ public abstract class BaseTestRow extends TestCase { assertTrue(cell2 == it.next()); assertEquals(Cell.CELL_TYPE_STRING, cell5.getCellType()); } - + public void testRowStyle() { Workbook workbook = _testDataProvider.createWorkbook(); Sheet sheet = workbook.createSheet("test"); Row row1 = sheet.createRow(0); Row row2 = sheet.createRow(1); - + // Won't be styled currently assertEquals(false, row1.isFormatted()); assertEquals(false, row2.isFormatted()); assertEquals(null, row1.getRowStyle()); assertEquals(null, row2.getRowStyle()); - + // Style one CellStyle style = workbook.createCellStyle(); style.setDataFormat((short)4); row2.setRowStyle(style); - + // Check assertEquals(false, row1.isFormatted()); assertEquals(true, row2.isFormatted()); assertEquals(null, row1.getRowStyle()); assertEquals(style, row2.getRowStyle()); - + // Save, load and re-check workbook = _testDataProvider.writeOutAndReadBack(workbook); sheet = workbook.getSheetAt(0); @@ -418,7 +423,7 @@ public abstract class BaseTestRow extends TestCase { row1 = sheet.getRow(0); row2 = sheet.getRow(1); style = workbook.getCellStyleAt(style.getIndex()); - + assertEquals(false, row1.isFormatted()); assertEquals(true, row2.isFormatted()); assertEquals(null, row1.getRowStyle()); |