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
public File createTempFile()throws IOException {
File fd = File.createTempFile("poi-sxssf-sheet-xml", ".gz");
return fd;
return File.createTempFile("poi-sxssf-sheet-xml", ".gz");
}
/**

View File

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

View File

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