bug 59030: convert to junit4; whitespace

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

View File

@ -19,19 +19,20 @@
package org.apache.poi.xwpf.usermodel; package org.apache.poi.xwpf.usermodel;
import junit.framework.TestCase; import static org.junit.Assert.*;
import org.junit.Ignore;
import org.junit.Test;
import org.apache.poi.xwpf.XWPFTestDataSamples; import org.apache.poi.xwpf.XWPFTestDataSamples;
import org.apache.poi.xwpf.usermodel.XWPFTableCell.XWPFVertAlign; import org.apache.poi.xwpf.usermodel.XWPFTableCell.XWPFVertAlign;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.*; import org.openxmlformats.schemas.wordprocessingml.x2006.main.*;
import java.util.List; import java.util.List;
public class TestXWPFTableCell extends TestCase { public class TestXWPFTableCell {
@Override
protected void setUp() throws Exception {
super.setUp();
}
@Test
public void testSetGetVertAlignment() throws Exception { public void testSetGetVertAlignment() throws Exception {
// instantiate the following classes so they'll get picked up by // instantiate the following classes so they'll get picked up by
// the XmlBean process and added to the jar file. they are required // the XmlBean process and added to the jar file. they are required
@ -60,6 +61,7 @@ public class TestXWPFTableCell extends TestCase {
assertEquals(XWPFVertAlign.BOTH, al); assertEquals(XWPFVertAlign.BOTH, al);
} }
@Test
public void testSetGetColor() throws Exception { public void testSetGetColor() throws Exception {
// create a table // create a table
XWPFDocument doc = new XWPFDocument(); XWPFDocument doc = new XWPFDocument();
@ -77,9 +79,10 @@ public class TestXWPFTableCell extends TestCase {
} }
/** /**
* ensure that CTHMerge & CTTcBorders go in poi-ooxml.jar * ensure that CTHMerge and CTTcBorders go in poi-ooxml.jar
*/ */
@SuppressWarnings("unused") @SuppressWarnings("unused")
@Test
public void test54099() { public void test54099() {
XWPFDocument doc = new XWPFDocument(); XWPFDocument doc = new XWPFDocument();
CTTbl ctTable = CTTbl.Factory.newInstance(); CTTbl ctTable = CTTbl.Factory.newInstance();
@ -96,6 +99,7 @@ public class TestXWPFTableCell extends TestCase {
CTVMerge vMerge = tcPr.addNewVMerge(); CTVMerge vMerge = tcPr.addNewVMerge();
} }
@Test
public void testCellVerticalAlign() throws Exception{ public void testCellVerticalAlign() throws Exception{
XWPFDocument docx = XWPFTestDataSamples.openSampleDocument("59030.docx"); XWPFDocument docx = XWPFTestDataSamples.openSampleDocument("59030.docx");
List<XWPFTable> tables = docx.getTables(); List<XWPFTable> tables = docx.getTables();
@ -112,17 +116,18 @@ public class TestXWPFTableCell extends TestCase {
assertEquals(XWPFVertAlign.TOP, tableRows.get(1).getCell(1).getVerticalAlignment()); assertEquals(XWPFVertAlign.TOP, tableRows.get(1).getCell(1).getVerticalAlignment());
} }
public void testCellVerticalAlign2() throws Exception{ @Test
XWPFDocument docx = XWPFTestDataSamples.openSampleDocument("TestTableCellAlign.docx"); public void testCellVerticalAlignShouldNotThrowNPE() throws Exception {
List<XWPFTable> tables = docx.getTables(); XWPFDocument docx = XWPFTestDataSamples.openSampleDocument("TestTableCellAlign.docx");
List<XWPFTable> tables = docx.getTables();
for (XWPFTable table : tables) { for (XWPFTable table : tables) {
List<XWPFTableRow> tableRows = table.getRows(); List<XWPFTableRow> tableRows = table.getRows();
for (XWPFTableRow tableRow : tableRows) { for (XWPFTableRow tableRow : tableRows) {
List<XWPFTableCell> tableCells = tableRow.getTableCells(); List<XWPFTableCell> tableCells = tableRow.getTableCells();
for (XWPFTableCell tableCell : tableCells) { for (XWPFTableCell tableCell : tableCells) {
assertNotNull(tableCell.getVerticalAlignment()); assertNotNull(tableCell.getVerticalAlignment());
} }
} }
} }
} }
} }