Fix deprecated warnings

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@960117 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nick Burch 2010-07-02 21:45:40 +00:00
parent 14b89b8d6a
commit 8c42604abf
9 changed files with 40 additions and 39 deletions

View File

@ -66,14 +66,17 @@ public class TestXSLFSlideShow extends TestCase {
// Should have 1 master
assertEquals(1, xml.getSlideMasterReferences().sizeOfSldMasterIdArray());
assertEquals(1, xml.getSlideMasterReferences().getSldMasterIdArray().length);
assertEquals(1, xml.getSlideMasterReferences().getSldMasterIdList().size());
// Should have three sheets
assertEquals(2, xml.getSlideReferences().sizeOfSldIdArray());
assertEquals(2, xml.getSlideReferences().getSldIdArray().length);
assertEquals(2, xml.getSlideReferences().getSldIdList().size());
// Check they're as expected
CTSlideIdListEntry[] slides = xml.getSlideReferences().getSldIdArray();
CTSlideIdListEntry[] slides = new CTSlideIdListEntry[
xml.getSlideReferences().getSldIdList().size()];
xml.getSlideReferences().getSldIdList().toArray(slides);
assertEquals(256, slides[0].getId());
assertEquals(257, slides[1].getId());
assertEquals("rId2", slides[0].getId2());
@ -88,8 +91,10 @@ public class TestXSLFSlideShow extends TestCase {
assertNotNull(xml.getNotes(slides[1]));
// And again for the master
CTSlideMasterIdListEntry[] masters =
xml.getSlideMasterReferences().getSldMasterIdArray();
CTSlideMasterIdListEntry[] masters = new CTSlideMasterIdListEntry[
xml.getSlideMasterReferences().getSldMasterIdList().size()];
xml.getSlideMasterReferences().getSldMasterIdList().toArray(masters);
assertEquals(2147483648l, masters[0].getId());
assertEquals("rId1", masters[0].getId2());
assertNotNull(xml.getSlideMaster(masters[0]));

View File

@ -32,7 +32,7 @@ public final class TestCalculationChain extends TestCase {
CalculationChain chain = wb.getCalculationChain();
//the bean holding the reference to the formula to be deleted
CTCalcCell c = chain.getCTCalcChain().getCArray(0);
int cnt = chain.getCTCalcChain().getCArray().length;
int cnt = chain.getCTCalcChain().getCList().size();
assertEquals(10, c.getI());
assertEquals("E1", c.getR());
@ -44,7 +44,7 @@ public final class TestCalculationChain extends TestCase {
//the count of items is less by one
c = chain.getCTCalcChain().getCArray(0);
int cnt2 = chain.getCTCalcChain().getCArray().length;
int cnt2 = chain.getCTCalcChain().getCList().size();
assertEquals(cnt - 1, cnt2);
//the first item in the calculation chain is the former second one
assertEquals(10, c.getI());

View File

@ -16,17 +16,16 @@
==================================================================== */
package org.apache.poi.xssf.model;
import junit.framework.TestCase;
import org.apache.poi.POIXMLDocumentPart;
import org.apache.poi.xssf.XSSFTestDataSamples;
import org.apache.poi.xssf.usermodel.XSSFMap;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSchema;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTMapInfo;
import org.w3c.dom.Node;
import junit.framework.TestCase;
/**
* @author Roberto Manicardi
*/
@ -51,9 +50,7 @@ public final class TestMapInfo extends TestCase {
assertNotNull(ctMapInfo);
CTSchema[] schemas = ctMapInfo.getSchemaArray();
assertEquals(1, schemas.length);
assertEquals(1, ctMapInfo.getSchemaList().size());
for (XSSFMap map : mapInfo.getAllXSSFMaps()) {
Node xmlSchema = map.getSchema();

View File

@ -142,10 +142,10 @@ public final class TestXSSFComment extends BaseTestCellComment {
assertSame(comment.getString(), richText);
//check that the rich text is set in the comment
CTRPrElt rPr = richText.getCTRst().getRArray(0).getRPr();
assertEquals(true, rPr.getIArray()[0].getVal());
assertEquals(8.5, rPr.getSzArray()[0].getVal());
assertEquals(IndexedColors.BLUE_GREY.getIndex(), rPr.getColorArray()[0].getIndexed());
assertEquals("Tahoma", rPr.getRFontArray()[0].getVal());
assertEquals(true, rPr.getIArray(0).getVal());
assertEquals(8.5, rPr.getSzArray(0).getVal());
assertEquals(IndexedColors.BLUE_GREY.getIndex(), rPr.getColorArray(0).getIndexed());
assertEquals("Tahoma", rPr.getRFontArray(0).getVal());
}
public void testAuthor() {

View File

@ -58,7 +58,7 @@ public final class TestXSSFFont extends BaseTestFont{
xssfFont.setBold(true);
assertEquals(ctFont.getBArray().length,1);
assertEquals(ctFont.getBList().size(),1);
assertEquals(true, ctFont.getBArray(0).getVal());
}
@ -113,7 +113,7 @@ public final class TestXSSFFont extends BaseTestFont{
assertEquals(false, xssfFont.getItalic());
xssfFont.setItalic(true);
assertEquals(ctFont.getIArray().length,1);
assertEquals(ctFont.getIList().size(),1);
assertEquals(true, ctFont.getIArray(0).getVal());
assertEquals(true,ctFont.getIArray(0).getVal());
}
@ -128,7 +128,7 @@ public final class TestXSSFFont extends BaseTestFont{
assertEquals(false, xssfFont.getStrikeout());
xssfFont.setStrikeout(true);
assertEquals(ctFont.getStrikeArray().length,1);
assertEquals(ctFont.getStrikeList().size(),1);
assertEquals(true, ctFont.getStrikeArray(0).getVal());
assertEquals(true,ctFont.getStrikeArray(0).getVal());
}
@ -169,11 +169,11 @@ public final class TestXSSFFont extends BaseTestFont{
assertEquals(Font.U_SINGLE, xssfFont.getUnderline());
xssfFont.setUnderline(Font.U_DOUBLE);
assertEquals(ctFont.getUArray().length,1);
assertEquals(ctFont.getUList().size(),1);
assertEquals(STUnderlineValues.DOUBLE,ctFont.getUArray(0).getVal());
xssfFont.setUnderline(FontUnderline.DOUBLE_ACCOUNTING);
assertEquals(ctFont.getUArray().length,1);
assertEquals(ctFont.getUList().size(),1);
assertEquals(STUnderlineValues.DOUBLE_ACCOUNTING,ctFont.getUArray(0).getVal());
}

View File

@ -287,7 +287,7 @@ public final class TestXSSFSheet extends BaseTestSheet {
sheet.groupColumn(10, 11);
CTCols cols = sheet.getCTWorksheet().getColsArray(0);
assertEquals(2, cols.sizeOfColArray());
CTCol[] colArray = cols.getColArray();
CTCol[] colArray = cols.getColList().toArray(new CTCol[2]);
assertNotNull(colArray);
assertEquals(2 + 1, colArray[0].getMin()); // 1 based
assertEquals(7 + 1, colArray[0].getMax()); // 1 based
@ -297,7 +297,7 @@ public final class TestXSSFSheet extends BaseTestSheet {
sheet.groupColumn(1, 2);
cols = sheet.getCTWorksheet().getColsArray(0);
assertEquals(4, cols.sizeOfColArray());
colArray = cols.getColArray();
colArray = cols.getColList().toArray(new CTCol[0]);
assertEquals(2, colArray[1].getOutlineLevel());
//three level
@ -305,17 +305,17 @@ public final class TestXSSFSheet extends BaseTestSheet {
sheet.groupColumn(2, 3);
cols = sheet.getCTWorksheet().getColsArray(0);
assertEquals(7, cols.sizeOfColArray());
colArray = cols.getColArray();
colArray = cols.getColList().toArray(new CTCol[0]);
assertEquals(3, colArray[1].getOutlineLevel());
assertEquals(3, sheet.getCTWorksheet().getSheetFormatPr().getOutlineLevelCol());
sheet.ungroupColumn(8, 10);
colArray = cols.getColArray();
colArray = cols.getColList().toArray(new CTCol[0]);
//assertEquals(3, colArray[1].getOutlineLevel());
sheet.ungroupColumn(4, 6);
sheet.ungroupColumn(2, 2);
colArray = cols.getColArray();
colArray = cols.getColList().toArray(new CTCol[0]);
assertEquals(4, colArray.length);
assertEquals(2, sheet.getCTWorksheet().getSheetFormatPr().getOutlineLevelCol());
}
@ -697,7 +697,7 @@ public final class TestXSSFSheet extends BaseTestSheet {
XSSFSheet xs = sheet;
CTWorksheet cts = xs.getCTWorksheet();
CTCols[] cols_s = cts.getColsArray();
CTCols[] cols_s = cts.getColsList().toArray(new CTCols[1]);
assertEquals(1, cols_s.length);
CTCols cols = cols_s[0];
assertEquals(1, cols.sizeOfColArray());
@ -712,7 +712,7 @@ public final class TestXSSFSheet extends BaseTestSheet {
// Now set another
sheet.setColumnWidth(3, 33 * 256);
cols_s = cts.getColsArray();
cols_s = cts.getColsList().toArray(new CTCols[1]);
assertEquals(1, cols_s.length);
cols = cols_s[0];
assertEquals(2, cols.sizeOfColArray());
@ -918,7 +918,7 @@ public final class TestXSSFSheet extends BaseTestSheet {
row3.createCell(5);
CTRow[] xrow = sheetData.getRowArray();
CTRow[] xrow = sheetData.getRowList().toArray(new CTRow[3]);
assertEquals(3, xrow.length);
//rows are unsorted: {2, 1, 0}
@ -934,7 +934,7 @@ public final class TestXSSFSheet extends BaseTestSheet {
assertEquals(1, xrow[2].getR());
assertTrue(xrow[2].equals(row3.getCTRow()));
CTCell[] xcell = xrow[2].getCArray();
CTCell[] xcell = xrow[2].getCList().toArray(new CTCell[4]);
assertEquals("D1", xcell[0].getR());
assertEquals("A1", xcell[1].getR());
assertEquals("C1", xcell[2].getR());
@ -950,14 +950,14 @@ public final class TestXSSFSheet extends BaseTestSheet {
workbook = XSSFTestDataSamples.writeOutAndReadBack(workbook);
sheet = workbook.getSheetAt(0);
wsh = sheet.getCTWorksheet();
xrow = sheetData.getRowArray();
xrow = sheetData.getRowList().toArray(new CTRow[3]);
assertEquals(3, xrow.length);
//rows are sorted: {0, 1, 2}
assertEquals(4, xrow[0].sizeOfCArray());
assertEquals(1, xrow[0].getR());
//cells are now sorted
xcell = xrow[0].getCArray();
xcell = xrow[0].getCList().toArray(new CTCell[4]);
assertEquals("A1", xcell[0].getR());
assertEquals("C1", xcell[1].getR());
assertEquals("D1", xcell[2].getR());

View File

@ -186,10 +186,9 @@ public final class TestColumnHelper extends TestCase {
helper.addCleanColIntoCols(cols1, col9);
// TODO - assert something interesting
CTCol[] colArray = cols1.getColArray();
assertEquals(12, colArray.length);
assertEquals(1, colArray[0].getMin());
assertEquals(16750, colArray[11].getMax());
assertEquals(12, cols1.getColList().size());
assertEquals(1, cols1.getColArray(0).getMin());
assertEquals(16750, cols1.getColArray(11).getMax());
}
public void testGetColumn() {

View File

@ -57,7 +57,7 @@ public final class TestXWPFParagraph extends TestCase {
assertEquals(1, ps.size());
XWPFParagraph p = ps.get(0);
assertEquals(5, p.getCTP().getRArray().length);
assertEquals(5, p.getCTP().getRList().size());
assertEquals("First header column!\tMid header\tRight header!", p
.getText());
}

View File

@ -170,7 +170,7 @@ public class TestXWPFRun extends TestCase {
run.addCarriageReturn();
run.setText("T2");
run.addCarriageReturn();
assertEquals(3, run.getCTR().getCrArray().length);
assertEquals(3, run.getCTR().getCrList().size());
}