Add assertions, remove Sonar warnings

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1568554 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dominik Stadler 2014-02-15 00:18:34 +00:00
parent f8bf66308e
commit 2b85b00690
3 changed files with 12 additions and 14 deletions

View File

@ -52,8 +52,7 @@ public class GZIPSheetDataWriter extends SheetDataWriter {
*/ */
@Override @Override
public File createTempFile()throws IOException { public File createTempFile()throws IOException {
File fd = File.createTempFile("poi-sxssf-sheet-xml", ".gz"); return File.createTempFile("poi-sxssf-sheet-xml", ".gz");
return fd;
} }
/** /**

View File

@ -75,8 +75,7 @@ public class SheetDataWriter {
* @return temp file to write sheet data * @return temp file to write sheet data
*/ */
public File createTempFile()throws IOException { public File createTempFile()throws IOException {
File fd = File.createTempFile("poi-sxssf-sheet", ".xml"); return File.createTempFile("poi-sxssf-sheet", ".xml");
return fd;
} }
/** /**

View File

@ -93,14 +93,14 @@ public final class TestSXSSFWorkbook extends BaseTestWorkbook {
xssfWorkbook.createSheet("S1"); xssfWorkbook.createSheet("S1");
SXSSFWorkbook wb = new SXSSFWorkbook(xssfWorkbook); SXSSFWorkbook wb = new SXSSFWorkbook(xssfWorkbook);
xssfWorkbook = (XSSFWorkbook) SXSSFITestDataProvider.instance.writeOutAndReadBack(wb); xssfWorkbook = (XSSFWorkbook) SXSSFITestDataProvider.instance.writeOutAndReadBack(wb);
wb.dispose(); assertTrue(wb.dispose());
wb = new SXSSFWorkbook(xssfWorkbook); wb = new SXSSFWorkbook(xssfWorkbook);
assertEquals(1, wb.getNumberOfSheets()); assertEquals(1, wb.getNumberOfSheets());
Sheet sheet = wb.getSheetAt(0); Sheet sheet = wb.getSheetAt(0);
assertNotNull(sheet); assertNotNull(sheet);
assertEquals("S1", sheet.getSheetName()); assertEquals("S1", sheet.getSheetName());
wb.dispose(); assertTrue(wb.dispose());
} }
@ -151,7 +151,7 @@ public final class TestSXSSFWorkbook extends BaseTestWorkbook {
cell.setCellValue("value 2_1_1"); cell.setCellValue("value 2_1_1");
SXSSFWorkbook wb = new SXSSFWorkbook(xssfWorkbook); SXSSFWorkbook wb = new SXSSFWorkbook(xssfWorkbook);
xssfWorkbook = (XSSFWorkbook) SXSSFITestDataProvider.instance.writeOutAndReadBack(wb); xssfWorkbook = (XSSFWorkbook) SXSSFITestDataProvider.instance.writeOutAndReadBack(wb);
wb.dispose(); assertTrue(wb.dispose());
wb = new SXSSFWorkbook(xssfWorkbook); wb = new SXSSFWorkbook(xssfWorkbook);
@ -218,7 +218,7 @@ public final class TestSXSSFWorkbook extends BaseTestWorkbook {
File tmp = wr.getTempFile(); File tmp = wr.getTempFile();
assertTrue(tmp.getName().startsWith("poi-sxssf-sheet")); assertTrue(tmp.getName().startsWith("poi-sxssf-sheet"));
assertTrue(tmp.getName().endsWith(".xml")); assertTrue(tmp.getName().endsWith(".xml"));
wb.dispose(); assertTrue(wb.dispose());
wb = new SXSSFWorkbook(); wb = new SXSSFWorkbook();
wb.setCompressTempFiles(true); wb.setCompressTempFiles(true);
@ -228,7 +228,7 @@ public final class TestSXSSFWorkbook extends BaseTestWorkbook {
tmp = wr.getTempFile(); tmp = wr.getTempFile();
assertTrue(tmp.getName().startsWith("poi-sxssf-sheet-xml")); assertTrue(tmp.getName().startsWith("poi-sxssf-sheet-xml"));
assertTrue(tmp.getName().endsWith(".gz")); assertTrue(tmp.getName().endsWith(".gz"));
wb.dispose(); assertTrue(wb.dispose());
//Test escaping of Unicode control characters //Test escaping of Unicode control characters
wb = new SXSSFWorkbook(); wb = new SXSSFWorkbook();
@ -237,7 +237,7 @@ public final class TestSXSSFWorkbook extends BaseTestWorkbook {
Cell cell = xssfWorkbook.getSheet("S1").getRow(0).getCell(0); Cell cell = xssfWorkbook.getSheet("S1").getRow(0).getCell(0);
assertEquals("value?", cell.getStringCellValue()); assertEquals("value?", cell.getStringCellValue());
wb.dispose(); assertTrue(wb.dispose());
} }
@ -280,7 +280,7 @@ public final class TestSXSSFWorkbook extends BaseTestWorkbook {
} }
} }
wb.dispose(); assertTrue(wb.dispose());
} }
@ -366,10 +366,10 @@ public final class TestSXSSFWorkbook extends BaseTestWorkbook {
} }
wb.write(outSteam); wb.write(outSteam);
// wb.dispose(); // assertTrue(wb.dispose());
outSteam.close(); outSteam.close();
} finally { } finally {
wb.dispose(); assertTrue(wb.dispose());
} }
} }
out.delete(); out.delete();