Author: onealj
Date: Wed Feb 8 18:35:04 2017
New Revision: 1782225
URL: http://svn.apache.org/viewvc?rev=1782225&view=rev
Log:
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
Modified:
poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFTableCell.java
Modified:
poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFTableCell.java
URL:
http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFTableCell.java?rev=1782225&r1=1782224&r2=1782225&view=diff
==============================================================================
---
poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFTableCell.java
(original)
+++
poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFTableCell.java
Wed Feb 8 18:35:04 2017
@@ -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();
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]