Minor fixes to get junits working after r695832. Updates to align with new sample.xlsx, and moved SharedStringSource out of usermodel API.

git-svn-id: https://svn.apache.org/repos/asf/poi/branches/ooxml@696415 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Josh Micich 2008-09-17 19:52:55 +00:00
parent e2c8b4f4d4
commit bb3bf964bd
9 changed files with 183 additions and 214 deletions

View File

@ -1,20 +0,0 @@
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.ss.usermodel;
public interface SharedStringSource {}

View File

@ -15,11 +15,14 @@
limitations under the License.
==================================================================== */
package org.apache.poi.ss.usermodel;
package org.apache.poi.xssf.model;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTRst;
/**
* Allows the getting and saving of shared strings
*/
public interface SharedStringSource {
CTRst getEntryAt(int ref);
int addEntry(CTRst rst);
}

View File

@ -20,16 +20,16 @@ package org.apache.poi.xssf.model;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.poi.ss.usermodel.SharedStringSource;
import org.apache.poi.xssf.usermodel.XSSFRichTextString;
import org.apache.xmlbeans.XmlException;
import org.apache.xmlbeans.XmlOptions;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTRst;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSst;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.SstDocument;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTRElt;
/**
@ -204,5 +204,4 @@ public class SharedStringsTable implements SharedStringSource, XSSFModel {
sst.setSiArray(ctr);
doc.save(out, options);
}
}

View File

@ -26,13 +26,12 @@ import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.Comment;
import org.apache.poi.ss.usermodel.Hyperlink;
import org.apache.poi.ss.usermodel.RichTextString;
import org.apache.poi.ss.usermodel.SharedStringSource;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.StylesSource;
import org.apache.poi.ss.util.CellReference;
import org.apache.poi.util.POILogFactory;
import org.apache.poi.util.POILogger;
import org.apache.poi.ss.util.CellReference;
import org.apache.poi.xssf.model.SharedStringsTable;
import org.apache.poi.xssf.model.SharedStringSource;
import org.apache.poi.xssf.model.StylesTable;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCell;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCellFormula;
@ -48,7 +47,7 @@ public final class XSSFCell implements Cell {
private final CTCell cell;
private final XSSFRow row;
private int cellNum;
private SharedStringsTable sharedStringSource;
private SharedStringSource sharedStringSource;
private StylesTable stylesSource;
private POILogger logger = POILogFactory.getLogger(XSSFCell.class);
@ -67,7 +66,7 @@ public final class XSSFCell implements Cell {
if (cell.getR() != null) {
this.cellNum = parseCellNum(cell.getR());
}
this.sharedStringSource = (SharedStringsTable) row.getSheet().getWorkbook().getSharedStringSource();
this.sharedStringSource = row.getSheet().getWorkbook().getSharedStringSource();
this.stylesSource = (StylesTable)row.getSheet().getWorkbook().getStylesSource();
}

View File

@ -34,7 +34,6 @@ import org.apache.poi.ss.usermodel.Font;
import org.apache.poi.ss.usermodel.Palette;
import org.apache.poi.ss.usermodel.PictureData;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.SharedStringSource;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.StylesSource;
import org.apache.poi.ss.usermodel.Workbook;
@ -44,6 +43,7 @@ import org.apache.poi.util.POILogger;
import org.apache.poi.xssf.model.CommentsTable;
import org.apache.poi.xssf.model.Control;
import org.apache.poi.xssf.model.Drawing;
import org.apache.poi.xssf.model.SharedStringSource;
import org.apache.poi.xssf.model.SharedStringsTable;
import org.apache.poi.xssf.model.StylesTable;
import org.apache.poi.xssf.model.XSSFModel;
@ -64,7 +64,6 @@ import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBookViews;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTDefinedName;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTDefinedNames;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTDialogsheet;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTFont;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSheet;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorkbook;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorksheet;

View File

@ -0,0 +1,73 @@
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.xssf;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import org.apache.poi.hssf.HSSFTestDataSamples;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.openxml4j.exceptions.InvalidFormatException;
import org.openxml4j.opc.Package;
/**
* Centralises logic for finding/opening sample files in the src/testcases/org/apache/poi/hssf/hssf/data folder.
*
* @author Josh Micich
*/
public class XSSFTestDataSamples {
public static final XSSFWorkbook openSampleWorkbook(String sampleName) {
InputStream is = HSSFTestDataSamples.openSampleFileStream(sampleName);
try {
Package pkg = Package.open(is);
return new XSSFWorkbook(pkg);
} catch (InvalidFormatException e) {
throw new RuntimeException(e);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
public static <R extends Workbook> R writeOutAndReadBack(R wb) {
ByteArrayOutputStream baos = new ByteArrayOutputStream(8192);
Workbook result;
try {
wb.write(baos);
InputStream is = new ByteArrayInputStream(baos.toByteArray());
if (wb instanceof HSSFWorkbook) {
result = new HSSFWorkbook(is);
} else if (wb instanceof XSSFWorkbook) {
Package pkg = Package.open(is);
result = new XSSFWorkbook(pkg);
} else {
throw new RuntimeException("Unexpected workbook type ("
+ wb.getClass().getName() + ")");
}
} catch (InvalidFormatException e) {
throw new RuntimeException(e);
} catch (IOException e) {
throw new RuntimeException(e);
}
@SuppressWarnings("unchecked")
R r = (R) result;
return r;
}
}

View File

@ -14,77 +14,35 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.xssf.extractor;
import java.io.File;
import java.io.FileInputStream;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import junit.framework.TestCase;
import org.apache.poi.POITextExtractor;
import org.apache.poi.hssf.HSSFTestDataSamples;
import org.apache.poi.hssf.extractor.ExcelExtractor;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.apache.poi.xssf.XSSFTestDataSamples;
/**
* Tests for XSSFExcelExtractor
* Tests for {@link XSSFExcelExtractor}
*/
public class TestXSSFExcelExtractor extends TestCase {
/**
* A very simple file
*/
private File xmlA;
/**
* A fairly complex file
*/
private File xmlB;
public final class TestXSSFExcelExtractor extends TestCase {
/**
* A fairly simple file - ooxml
*/
private File simpleXLSX;
/**
* A fairly simple file - ole2
*/
private File simpleXLS;
protected void setUp() throws Exception {
super.setUp();
xmlA = new File(
System.getProperty("HSSF.testdata.path") +
File.separator + "sample.xlsx"
);
assertTrue(xmlA.exists());
xmlB = new File(
System.getProperty("HSSF.testdata.path") +
File.separator + "AverageTaxRates.xlsx"
);
assertTrue(xmlB.exists());
simpleXLSX = new File(
System.getProperty("HSSF.testdata.path") +
File.separator + "SampleSS.xlsx"
);
simpleXLS = new File(
System.getProperty("HSSF.testdata.path") +
File.separator + "SampleSS.xls"
);
assertTrue(simpleXLS.exists());
assertTrue(simpleXLSX.exists());
private static final XSSFExcelExtractor getExtractor(String sampleName) {
return new XSSFExcelExtractor(XSSFTestDataSamples.openSampleWorkbook(sampleName));
}
/**
* Get text out of the simple file
*/
public void testGetSimpleText() throws Exception {
new XSSFExcelExtractor(xmlA.toString());
new XSSFExcelExtractor(new XSSFWorkbook(xmlA.toString()));
XSSFExcelExtractor extractor =
new XSSFExcelExtractor(xmlA.toString());
public void testGetSimpleText() {
// a very simple file
XSSFExcelExtractor extractor = getExtractor("sample.xlsx");
extractor.getText();
String text = extractor.getText();
@ -97,73 +55,52 @@ public class TestXSSFExcelExtractor extends TestCase {
// Now without, will have text
extractor.setIncludeSheetNames(false);
text = extractor.getText();
String CHUNK1 =
"Lorem\t111\n" +
"ipsum\t222\n" +
"dolor\t333\n" +
"sit\t444\n" +
"amet\t555\n" +
"consectetuer\t666\n" +
"adipiscing\t777\n" +
"elit\t888\n" +
"Nunc\t999\n";
String CHUNK2 =
"The quick brown fox jumps over the lazy dog\n" +
"hello, xssf hello, xssf\n" +
"hello, xssf hello, xssf\n" +
"hello, xssf hello, xssf\n" +
"hello, xssf hello, xssf\n";
assertEquals(
"Lorem\t111\n" +
"ipsum\t222\n" +
"dolor\t333\n" +
"sit\t444\n" +
"amet\t555\n" +
"consectetuer\t666\n" +
"adipiscing\t777\n" +
"elit\t888\n" +
"Nunc\t999\n" +
CHUNK1 +
"at\t4995\n" +
"The quick brown fox jumps over the lazy dog\n" +
"hello, xssf\thello, xssf\n" +
"hello, xssf\thello, xssf\n" +
"hello, xssf\thello, xssf\n" +
"hello, xssf\thello, xssf\n", text);
CHUNK2
, text);
// Now get formulas not their values
extractor.setFormulasNotResults(true);
text = extractor.getText();
assertEquals(
"Lorem\t111\n" +
"ipsum\t222\n" +
"dolor\t333\n" +
"sit\t444\n" +
"amet\t555\n" +
"consectetuer\t666\n" +
"adipiscing\t777\n" +
"elit\t888\n" +
"Nunc\t999\n" +
CHUNK1 +
"at\tSUM(B1:B9)\n" +
"The quick brown fox jumps over the lazy dog\n" +
"hello, xssf\thello, xssf\n" +
"hello, xssf\thello, xssf\n" +
"hello, xssf\thello, xssf\n" +
"hello, xssf\thello, xssf\n", text);
CHUNK2, text);
// With sheet names too
extractor.setIncludeSheetNames(true);
text = extractor.getText();
assertEquals(
"Sheet1\n" +
"Lorem\t111\n" +
"ipsum\t222\n" +
"dolor\t333\n" +
"sit\t444\n" +
"amet\t555\n" +
"consectetuer\t666\n" +
"adipiscing\t777\n" +
"elit\t888\n" +
"Nunc\t999\n" +
CHUNK1 +
"at\tSUM(B1:B9)\n" +
"rich test\n" +
"The quick brown fox jumps over the lazy dog\n" +
"hello, xssf\thello, xssf\n" +
"hello, xssf\thello, xssf\n" +
"hello, xssf\thello, xssf\n" +
"hello, xssf\thello, xssf\n" +
CHUNK2 +
"Sheet3\n"
, text);
}
public void testGetComplexText() throws Exception {
new XSSFExcelExtractor(xmlB.toString());
XSSFExcelExtractor extractor =
new XSSFExcelExtractor(new XSSFWorkbook(xmlB.toString()));
public void testGetComplexText() {
// A fairly complex file
XSSFExcelExtractor extractor = getExtractor("AverageTaxRates.xlsx");
extractor.getText();
String text = extractor.getText();
@ -182,12 +119,12 @@ public class TestXSSFExcelExtractor extends TestCase {
* ExcelExtractor does, when we're both passed
* the same file, just saved as xls and xlsx
*/
public void testComparedToOLE2() throws Exception {
XSSFExcelExtractor ooxmlExtractor =
new XSSFExcelExtractor(simpleXLSX.toString());
public void testComparedToOLE2() {
// A fairly simple file - ooxml
XSSFExcelExtractor ooxmlExtractor = getExtractor("SampleSS.xlsx");
ExcelExtractor ole2Extractor =
new ExcelExtractor(new HSSFWorkbook(
new FileInputStream(simpleXLS)));
new ExcelExtractor(HSSFTestDataSamples.openSampleWorkbook("SampleSS.xls"));
POITextExtractor[] extractors =
new POITextExtractor[] { ooxmlExtractor, ole2Extractor };
@ -207,39 +144,26 @@ public class TestXSSFExcelExtractor extends TestCase {
/**
* From bug #45540
*/
public void testHeaderFooter() throws Exception {
public void testHeaderFooter() {
String[] files = new String[] {
"45540_classic_Header.xlsx", "45540_form_Header.xlsx",
"45540_classic_Footer.xlsx", "45540_form_Footer.xlsx",
};
for(String file : files) {
File xml = new File(
System.getProperty("HSSF.testdata.path") +
File.separator + file
);
assertTrue(xml.exists());
XSSFExcelExtractor extractor =
new XSSFExcelExtractor(new XSSFWorkbook(xml.toString()));
for(String sampleName : files) {
XSSFExcelExtractor extractor = getExtractor(sampleName);
String text = extractor.getText();
assertTrue("Unable to find expected word in text from " + file + "\n" + text, text.contains("testdoc"));
assertTrue("Unable to find expected word in text\n" + text, text.contains("test phrase"));
assertTrue("Unable to find expected word in text from " + sampleName + "\n" + text, text.contains("testdoc"));
assertTrue("Unable to find expected word in text\n" + text, text.contains("test phrase"));
}
}
/**
* From bug #45544
*/
public void testComments() throws Exception {
File xml = new File(
System.getProperty("HSSF.testdata.path") +
File.separator + "45544.xlsx"
);
assertTrue(xml.exists());
public void testComments() {
XSSFExcelExtractor extractor =
new XSSFExcelExtractor(new XSSFWorkbook(xml.toString()));
XSSFExcelExtractor extractor = getExtractor("45544.xlsx");
String text = extractor.getText();
// No comments there yet

View File

@ -19,37 +19,26 @@ package org.apache.poi.xssf.model;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.util.List;
import org.apache.poi.xssf.usermodel.XSSFCellStyle;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.apache.poi.xssf.usermodel.XSSFRichTextString;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTXf;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTRst;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTRElt;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTRPrElt;
import junit.framework.TestCase;
import org.apache.poi.xssf.XSSFTestDataSamples;
import org.apache.poi.xssf.usermodel.XSSFRichTextString;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTRElt;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTRPrElt;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTRst;
/**
* Test SharedStringsTable, the cache of strings in a workbook
* Test {@link SharedStringsTable}, the cache of strings in a workbook
*
* @author Yegor Kozlov
*/
public class TestSharedStringsTable extends TestCase {
private File xml;
public final class TestSharedStringsTable extends TestCase {
protected void setUp() throws Exception {
xml = new File(
System.getProperty("HSSF.testdata.path") +
File.separator + "sample.xlsx"
);
assertTrue(xml.exists());
}
public void testCreateNew() throws Exception {
public void testCreateNew() {
SharedStringsTable sst = new SharedStringsTable();
CTRst st;
@ -120,15 +109,19 @@ public class TestSharedStringsTable extends TestCase {
assertEquals("Second string", new XSSFRichTextString(sst.getEntryAt(2)).toString());
}
public void testReadWrite() throws Exception {
XSSFWorkbook wb = new XSSFWorkbook(xml.getPath());
public void testReadWrite() {
XSSFWorkbook wb = XSSFTestDataSamples.openSampleWorkbook("sample.xlsx");
SharedStringsTable sst1 = (SharedStringsTable)wb.getSharedStringSource();
ByteArrayOutputStream out = new ByteArrayOutputStream();
sst1.writeTo(out);
//serialize, read back and compare with the original
SharedStringsTable sst2 = new SharedStringsTable(new ByteArrayInputStream(out.toByteArray()));
SharedStringsTable sst2;
try {
ByteArrayOutputStream out = new ByteArrayOutputStream();
sst1.writeTo(out);
sst2 = new SharedStringsTable(new ByteArrayInputStream(out.toByteArray()));
} catch (IOException e) {
throw new RuntimeException(e);
}
assertEquals(sst1.getCount(), sst2.getCount());
assertEquals(sst1.getUniqueCount(), sst2.getUniqueCount());

View File

@ -17,8 +17,6 @@
package org.apache.poi.xssf.usermodel;
import java.io.File;
import java.io.FileOutputStream;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
@ -30,19 +28,24 @@ import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.Comment;
import org.apache.poi.ss.usermodel.CreationHelper;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.SharedStringSource;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.XSSFTestDataSamples;
import org.apache.poi.xssf.model.CommentsTable;
import org.apache.poi.xssf.model.SharedStringSource;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCell;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTComment;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTComments;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTRst;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSheet;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorksheet;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.STCellType;
public class TestXSSFCell extends TestCase {
/**
* Tests for {@link XSSFCell}
*
*/
public final class TestXSSFCell extends TestCase {
private static final String TEST_C10_AUTHOR = "test C10 author";
@ -160,7 +163,7 @@ public class TestXSSFCell extends TestCase {
assertEquals("Foo2", cell.getRichStringCellValue().getString());
}
public void testSetGetStringShared() throws Exception {
public void testSetGetStringShared() {
XSSFRow row = createParentObjects();
XSSFCell cell = new XSSFCell(row);
@ -176,7 +179,7 @@ public class TestXSSFCell extends TestCase {
/**
* Test that empty cells (no v element) return default values.
*/
public void testGetEmptyCellValue() throws Exception {
public void testGetEmptyCellValue() {
XSSFRow row = createParentObjects();
XSSFCell cell = new XSSFCell(row);
cell.setCellType(Cell.CELL_TYPE_BOOLEAN);
@ -216,12 +219,12 @@ public class TestXSSFCell extends TestCase {
}
public static class DummySharedStringSource implements SharedStringSource {
ArrayList<String> strs = new ArrayList<String>();
public String getSharedStringAt(int idx) {
ArrayList<CTRst> strs = new ArrayList<CTRst>();
public CTRst getEntryAt(int idx) {
return strs.get(idx);
}
public synchronized int putSharedString(String s) {
public synchronized int addEntry(CTRst s) {
if(strs.contains(s)) {
return strs.indexOf(s);
}
@ -241,8 +244,8 @@ public class TestXSSFCell extends TestCase {
// Create C10 cell
Row row = sheet.createRow(9);
Cell cell = row.createCell((short)2);
Cell cell3 = row.createCell((short)3);
row.createCell(2);
row.createCell(3);
// Set a comment for C10 cell
@ -267,8 +270,8 @@ public class TestXSSFCell extends TestCase {
// Create C10 cell
Row row = sheet.createRow(9);
Cell cell = row.createCell((short)2);
Cell cell3 = row.createCell((short)3);
Cell cell = row.createCell(2);
row.createCell(3);
// Create a comment
Comment comment = comments.addComment();
@ -295,10 +298,11 @@ public class TestXSSFCell extends TestCase {
assertEquals("A1", ctWorksheet.getSheetViews().getSheetViewArray(0).getSelectionArray(0).getActiveCell());
}
/**
* Tests that cell formatting stuff works as expected
*/
public void testCellFormatting() throws Exception {
public void testCellFormatting() {
Workbook workbook = new XSSFWorkbook();
Sheet sheet = workbook.createSheet();
CreationHelper creationHelper = workbook.getCreationHelper();
@ -324,18 +328,13 @@ public class TestXSSFCell extends TestCase {
// Save, re-load, and test again
File tmp = File.createTempFile("poi", "xlsx");
FileOutputStream out = new FileOutputStream(tmp);
workbook.write(out);
out.close();
Workbook wb2 = new XSSFWorkbook(tmp.toString());
Workbook wb2 = XSSFTestDataSamples.writeOutAndReadBack(workbook);
Cell c2 = wb2.getSheetAt(0).getRow(0).getCell(0);
assertEquals(new Date(654321), c2.getDateCellValue());
assertEquals("yyyy/mm/dd", c2.getCellStyle().getDataFormatString());
}
private XSSFRow createParentObjects() {
private static XSSFRow createParentObjects() {
XSSFWorkbook wb = new XSSFWorkbook();
wb.setSharedStringSource(new DummySharedStringSource());
XSSFSheet sheet = new XSSFSheet(wb);
@ -347,12 +346,12 @@ public class TestXSSFCell extends TestCase {
* Test to ensure we can only assign cell styles that belong
* to our workbook, and not those from other workbooks.
*/
public void testCellStyleWorkbookMatch() throws Exception {
public void testCellStyleWorkbookMatch() {
XSSFWorkbook wbA = new XSSFWorkbook();
XSSFWorkbook wbB = new XSSFWorkbook();
XSSFCellStyle styA = (XSSFCellStyle)wbA.createCellStyle();
XSSFCellStyle styB = (XSSFCellStyle)wbB.createCellStyle();
XSSFCellStyle styA = wbA.createCellStyle();
XSSFCellStyle styB = wbB.createCellStyle();
styA.verifyBelongsToStylesSource(wbA.getStylesSource());
styB.verifyBelongsToStylesSource(wbB.getStylesSource());