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;
// 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());
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();
}
);
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,
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(
// 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();
// 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 {
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());
}
}
Cell cell = row.getCell(cellNum);
String fmtCellValue = formatter.formatCellValue(cell);
assertNotNull(fmtCellValue);
- assertFalse(fmtCellValue.equals("0"));
+ assertNotEquals("0", fmtCellValue);
}
}
}
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);
* 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());
* 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);
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;
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();
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
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...
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();
}
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());