bug 59030: revert r1746625 and restore r1731257, where XWPFTableCell#getVerticalAlignment() returns null rather than a default value (XWPFVertAlign.TOP) if vertical alignment is not set

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1782225 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Javen O'Neal 2017-02-08 18:35:04 +00:00
parent 61f69324c7
commit cc962432a4

View File

@ -110,12 +110,14 @@ public class TestXWPFTableCell {
List<XWPFTableRow> tableRows = table.getRows();
assertEquals(2, tableRows.size());
assertEquals(XWPFVertAlign.TOP, tableRows.get(0).getCell(0).getVerticalAlignment());
assertNull(tableRows.get(0).getCell(0).getVerticalAlignment());
assertEquals(XWPFVertAlign.BOTTOM, tableRows.get(0).getCell(1).getVerticalAlignment());
assertEquals(XWPFVertAlign.CENTER, tableRows.get(1).getCell(0).getVerticalAlignment());
assertEquals(XWPFVertAlign.TOP, tableRows.get(1).getCell(1).getVerticalAlignment());
assertNull(tableRows.get(1).getCell(1).getVerticalAlignment()); // should return null since alignment isn't set
}
// This is not a very useful test as written. It is not worth the execution time for a unit test
@Ignore
@Test
public void testCellVerticalAlignShouldNotThrowNPE() throws Exception {
XWPFDocument docx = XWPFTestDataSamples.openSampleDocument("TestTableCellAlign.docx");
@ -125,7 +127,8 @@ public class TestXWPFTableCell {
for (XWPFTableRow tableRow : tableRows) {
List<XWPFTableCell> tableCells = tableRow.getTableCells();
for (XWPFTableCell tableCell : tableCells) {
assertNotNull(tableCell.getVerticalAlignment());
// getVerticalAlignment should return either an XWPFVertAlign enum or null if not set
tableCell.getVerticalAlignment();
}
}
}