Streamline assertion-usage in some tests
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1830296 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d219fe085a
commit
2574fd2d3d
@ -20,6 +20,7 @@ package org.apache.poi.xssf.usermodel;
|
||||
import static org.junit.Assert.assertArrayEquals;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
@ -349,7 +350,7 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
|
||||
// Look at the low level xml elements
|
||||
assertEquals(2, cs.getCoreXf().getFillId());
|
||||
assertEquals(0, cs.getCoreXf().getXfId());
|
||||
assertEquals(true, cs.getCoreXf().getApplyFill());
|
||||
assertTrue(cs.getCoreXf().getApplyFill());
|
||||
|
||||
XSSFCellFill fg = wb.getStylesSource().getFillAt(2);
|
||||
assertNotNull(fg.getFillForegroundColor());
|
||||
@ -366,8 +367,8 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
|
||||
assertEquals("FFFF0000", cs.getFillForegroundColorColor().getARGBHex());
|
||||
|
||||
assertEquals(64, cs.getFillBackgroundColor());
|
||||
assertEquals(null, cs.getFillBackgroundXSSFColor().getARGBHex());
|
||||
assertEquals(null, cs.getFillBackgroundColorColor().getARGBHex());
|
||||
assertNull(cs.getFillBackgroundXSSFColor().getARGBHex());
|
||||
assertNull(cs.getFillBackgroundColorColor().getARGBHex());
|
||||
|
||||
wb.close();
|
||||
}
|
||||
@ -471,7 +472,7 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
|
||||
);
|
||||
assertEquals(" with spaces ", c.getRichStringCellValue().toString());
|
||||
assertEquals(0, c.getRichStringCellValue().getCTRst().sizeOfRArray());
|
||||
assertEquals(true, c.getRichStringCellValue().getCTRst().isSetT());
|
||||
assertTrue(c.getRichStringCellValue().getCTRst().isSetT());
|
||||
// Should have the preserve set
|
||||
assertEquals(
|
||||
1,
|
||||
@ -490,7 +491,7 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
|
||||
c = r.getCell(0);
|
||||
assertEquals(" with spaces ", c.getRichStringCellValue().toString());
|
||||
assertEquals(0, c.getRichStringCellValue().getCTRst().sizeOfRArray());
|
||||
assertEquals(true, c.getRichStringCellValue().getCTRst().isSetT());
|
||||
assertTrue(c.getRichStringCellValue().getCTRst().isSetT());
|
||||
|
||||
// Change the string
|
||||
c.setCellValue(
|
||||
@ -1069,36 +1070,36 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
|
||||
|
||||
// No print settings before repeating
|
||||
XSSFSheet s1 = wb1.createSheet();
|
||||
assertEquals(false, s1.getCTWorksheet().isSetPageSetup());
|
||||
assertEquals(true, s1.getCTWorksheet().isSetPageMargins());
|
||||
assertFalse(s1.getCTWorksheet().isSetPageSetup());
|
||||
assertTrue(s1.getCTWorksheet().isSetPageMargins());
|
||||
s1.setRepeatingColumns(cra);
|
||||
s1.setRepeatingRows(cra);
|
||||
|
||||
assertEquals(true, s1.getCTWorksheet().isSetPageSetup());
|
||||
assertEquals(true, s1.getCTWorksheet().isSetPageMargins());
|
||||
assertTrue(s1.getCTWorksheet().isSetPageSetup());
|
||||
assertTrue(s1.getCTWorksheet().isSetPageMargins());
|
||||
|
||||
PrintSetup ps1 = s1.getPrintSetup();
|
||||
assertEquals(false, ps1.getValidSettings());
|
||||
assertEquals(false, ps1.getLandscape());
|
||||
assertFalse(ps1.getValidSettings());
|
||||
assertFalse(ps1.getLandscape());
|
||||
|
||||
|
||||
// Had valid print settings before repeating
|
||||
XSSFSheet s2 = wb2.createSheet();
|
||||
PrintSetup ps2 = s2.getPrintSetup();
|
||||
assertEquals(true, s2.getCTWorksheet().isSetPageSetup());
|
||||
assertEquals(true, s2.getCTWorksheet().isSetPageMargins());
|
||||
assertTrue(s2.getCTWorksheet().isSetPageSetup());
|
||||
assertTrue(s2.getCTWorksheet().isSetPageMargins());
|
||||
|
||||
ps2.setLandscape(false);
|
||||
assertEquals(true, ps2.getValidSettings());
|
||||
assertEquals(false, ps2.getLandscape());
|
||||
assertTrue(ps2.getValidSettings());
|
||||
assertFalse(ps2.getLandscape());
|
||||
s2.setRepeatingColumns(cra);
|
||||
s2.setRepeatingRows(cra);
|
||||
|
||||
ps2 = s2.getPrintSetup();
|
||||
assertEquals(true, s2.getCTWorksheet().isSetPageSetup());
|
||||
assertEquals(true, s2.getCTWorksheet().isSetPageMargins());
|
||||
assertEquals(true, ps2.getValidSettings());
|
||||
assertEquals(false, ps2.getLandscape());
|
||||
assertTrue(s2.getCTWorksheet().isSetPageSetup());
|
||||
assertTrue(s2.getCTWorksheet().isSetPageMargins());
|
||||
assertTrue(ps2.getValidSettings());
|
||||
assertFalse(ps2.getLandscape());
|
||||
|
||||
wb1.close();
|
||||
wb2.close();
|
||||
@ -1887,9 +1888,9 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
|
||||
// Check the core properties - will be found but empty, due
|
||||
// to the expansion being too much to be considered valid
|
||||
POIXMLProperties props = new POIXMLProperties(pkg);
|
||||
assertEquals(null, props.getCoreProperties().getTitle());
|
||||
assertEquals(null, props.getCoreProperties().getSubject());
|
||||
assertEquals(null, props.getCoreProperties().getDescription());
|
||||
assertNull(props.getCoreProperties().getTitle());
|
||||
assertNull(props.getCoreProperties().getSubject());
|
||||
assertNull(props.getCoreProperties().getDescription());
|
||||
|
||||
// Now check the spreadsheet itself
|
||||
try {
|
||||
@ -2546,11 +2547,11 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
|
||||
private void checkCellsAreGone(CalculationChain chain) {
|
||||
for (CTCalcCell calc : chain.getCTCalcChain().getCList()) {
|
||||
// A2 to A6 should be gone
|
||||
assertFalse(calc.getR().equals("A2"));
|
||||
assertFalse(calc.getR().equals("A3"));
|
||||
assertFalse(calc.getR().equals("A4"));
|
||||
assertFalse(calc.getR().equals("A5"));
|
||||
assertFalse(calc.getR().equals("A6"));
|
||||
assertNotEquals("A2", calc.getR());
|
||||
assertNotEquals("A3", calc.getR());
|
||||
assertNotEquals("A4", calc.getR());
|
||||
assertNotEquals("A5", calc.getR());
|
||||
assertNotEquals("A6", calc.getR());
|
||||
}
|
||||
}
|
||||
|
||||
@ -2830,7 +2831,7 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
|
||||
Cell cell = row.getCell(cellNum);
|
||||
String fmtCellValue = formatter.formatCellValue(cell);
|
||||
assertNotNull(fmtCellValue);
|
||||
assertFalse(fmtCellValue.equals("0"));
|
||||
assertNotEquals("0", fmtCellValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3001,14 +3002,14 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
|
||||
assertTrue("Last row num: " + sheet.getLastRowNum(), sheet.getLastRowNum() > 20);
|
||||
assertEquals("Checked", sheet.getRow(0).getCell(0).getStringCellValue());
|
||||
assertEquals("Checked", sheet.getRow(9).getCell(2).getStringCellValue());
|
||||
assertEquals(false, sheet.getRow(70).getCell(8).getBooleanCellValue());
|
||||
assertFalse(sheet.getRow(70).getCell(8).getBooleanCellValue());
|
||||
assertEquals(71, sheet.getPhysicalNumberOfRows());
|
||||
assertEquals(70, sheet.getLastRowNum());
|
||||
assertEquals(70, sheet.getRow(sheet.getLastRowNum()).getRowNum());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWorkdayFunction() throws IOException {
|
||||
public void testWorkdayFunction() {
|
||||
XSSFWorkbook workbook = XSSFTestDataSamples.openSampleWorkbook("59106.xlsx");
|
||||
XSSFSheet sheet = workbook.getSheet("Test");
|
||||
Row row = sheet.getRow(1);
|
||||
@ -3063,7 +3064,7 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
|
||||
* part with a part number)
|
||||
*/
|
||||
@Test
|
||||
public void drawingNumbersAlreadyTaken_60255() throws Exception {
|
||||
public void drawingNumbersAlreadyTaken_60255() {
|
||||
Workbook wb = XSSFTestDataSamples.openSampleWorkbook("60255_extra_drawingparts.xlsx");
|
||||
assertEquals(4, wb.getNumberOfSheets());
|
||||
|
||||
@ -3262,7 +3263,7 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
|
||||
* TODO Get this to actually reproduce the bug...
|
||||
*/
|
||||
@Test
|
||||
public void test62108() throws IOException {
|
||||
public void test62108() {
|
||||
XSSFWorkbook wb = new XSSFWorkbook();
|
||||
XSSFSheet sheet = wb.createSheet();
|
||||
XSSFRow row = sheet.createRow(0);
|
||||
|
@ -21,6 +21,7 @@ import static org.apache.poi.POITestCase.assertContains;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNotSame;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertSame;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
@ -570,8 +571,8 @@ public final class TestBugs extends BaseTestBugzillaIssues {
|
||||
HSSFWorkbook wb = openSample("35564.xls");
|
||||
|
||||
HSSFSheet sheet = wb.getSheetAt(0);
|
||||
assertEquals(false, sheet.isGridsPrinted());
|
||||
assertEquals(false, sheet.getProtect());
|
||||
assertFalse(sheet.isGridsPrinted());
|
||||
assertFalse(sheet.getProtect());
|
||||
|
||||
writeOutAndReadBack(wb).close();
|
||||
|
||||
@ -1042,11 +1043,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
|
||||
wb.getFontAt(2),
|
||||
wb.getFontAt(2)
|
||||
);
|
||||
assertTrue(
|
||||
wb.getFontAt(0)
|
||||
!=
|
||||
wb.getFontAt(2)
|
||||
);
|
||||
assertNotSame(wb.getFontAt(0), wb.getFontAt(2));
|
||||
|
||||
// Look for a new font we have
|
||||
// yet to add
|
||||
@ -1727,10 +1724,10 @@ public final class TestBugs extends BaseTestBugzillaIssues {
|
||||
UnicodeString withoutExt = wb1.getWorkbook().getSSTString(31);
|
||||
|
||||
assertEquals("O:Alloc:Qty", withExt.getString());
|
||||
assertTrue((withExt.getOptionFlags() & 0x0004) == 0x0004);
|
||||
assertEquals(0x0004, (withExt.getOptionFlags() & 0x0004));
|
||||
|
||||
assertEquals("RT", withoutExt.getString());
|
||||
assertTrue((withoutExt.getOptionFlags() & 0x0004) == 0x0000);
|
||||
assertEquals(0x0000, (withoutExt.getOptionFlags() & 0x0004));
|
||||
|
||||
// Something about continues...
|
||||
|
||||
@ -1745,10 +1742,10 @@ public final class TestBugs extends BaseTestBugzillaIssues {
|
||||
withoutExt = wb2.getWorkbook().getSSTString(31);
|
||||
|
||||
assertEquals("O:Alloc:Qty", withExt.getString());
|
||||
assertTrue((withExt.getOptionFlags() & 0x0004) == 0x0004);
|
||||
assertEquals(0x0004, (withExt.getOptionFlags() & 0x0004));
|
||||
|
||||
assertEquals("RT", withoutExt.getString());
|
||||
assertTrue((withoutExt.getOptionFlags() & 0x0004) == 0x0000);
|
||||
assertEquals(0x0000, (withoutExt.getOptionFlags() & 0x0004));
|
||||
wb2.close();
|
||||
}
|
||||
|
||||
@ -2215,7 +2212,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
|
||||
HSSFWorkbook wb1 = openSample("50833.xls");
|
||||
HSSFSheet s = wb1.getSheetAt(0);
|
||||
assertEquals("Sheet1", s.getSheetName());
|
||||
assertEquals(false, s.getProtect());
|
||||
assertFalse(s.getProtect());
|
||||
|
||||
HSSFCell c = s.getRow(0).getCell(0);
|
||||
assertEquals("test cell value", c.getRichStringCellValue().getString());
|
||||
|
Loading…
Reference in New Issue
Block a user