Sonar fixes

JUnit5 test classes and methods should have default package visibility

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1885308 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andreas Beeker 2021-01-09 18:24:51 +00:00
parent 1d676a098d
commit a4ed4359cc
111 changed files with 755 additions and 785 deletions

View File

@ -58,8 +58,8 @@ public final class TestDeferredSXSSFWorkbook extends BaseTestXWorkbook {
*/
@Override
@Test
public void cloneSheet() throws IOException {
RuntimeException e = assertThrows(RuntimeException.class, super::cloneSheet);
protected void cloneSheet() throws IOException {
RuntimeException e = assertThrows(RuntimeException.class, () -> super.cloneSheet());
assertEquals("Not Implemented", e.getMessage());
}
@ -68,8 +68,8 @@ public final class TestDeferredSXSSFWorkbook extends BaseTestXWorkbook {
*/
@Override
@Test
public void sheetClone() throws IOException {
RuntimeException e = assertThrows(RuntimeException.class, super::sheetClone);
protected void sheetClone() throws IOException {
RuntimeException e = assertThrows(RuntimeException.class, () -> super.sheetClone());
assertEquals("Not Implemented", e.getMessage());
}
@ -78,17 +78,14 @@ public final class TestDeferredSXSSFWorkbook extends BaseTestXWorkbook {
*/
@Override
@Disabled("SXSSF doesn't update formulas on sheet name changes, as most cells probably aren't in memory at the time")
@Test
public void setSheetName() {}
protected void setSheetName() {}
@Override
@Disabled("DeferredSXSSF code disposes rows in a way that breaks this test")
@Test
public void parentReferences() {}
@Override
@Disabled("DeferredSXSSF code disposes rows in a way that breaks this test")
@Test
public void unicodeInAll() {}
@Test

View File

@ -138,7 +138,7 @@ public class TestSXSSFCell extends BaseTestXCell {
*/
@Override
@Disabled
public void setBlank_removesArrayFormula_ifCellIsPartOfAnArrayFormulaGroupContainingOnlyThisCell() {
protected void setBlank_removesArrayFormula_ifCellIsPartOfAnArrayFormulaGroupContainingOnlyThisCell() {
}
/**
@ -147,33 +147,29 @@ public class TestSXSSFCell extends BaseTestXCell {
*/
@Override
@Disabled
@Test // <- annotation is necessary to override expected exception
public void setBlank_throwsISE_ifCellIsPartOfAnArrayFormulaGroupContainingOtherCells() {
protected void setBlank_throwsISE_ifCellIsPartOfAnArrayFormulaGroupContainingOtherCells() {
}
@Override
@Disabled
@Test
public void setCellFormula_throwsISE_ifCellIsPartOfAnArrayFormulaGroupContainingOtherCells() {
protected void setCellFormula_throwsISE_ifCellIsPartOfAnArrayFormulaGroupContainingOtherCells() {
}
@Override
@Disabled
public void removeFormula_turnsCellToBlank_whenFormulaWasASingleCellArrayFormula() {
protected void removeFormula_turnsCellToBlank_whenFormulaWasASingleCellArrayFormula() {
}
@Override
@Disabled
public void setCellFormula_onASingleCellArrayFormulaCell_preservesTheValue() {
protected void setCellFormula_onASingleCellArrayFormulaCell_preservesTheValue() {
}
@Test
@Disabled
public void setCellFormula_isExceptionSafe_onBlankCell() {
protected void setCellFormula_isExceptionSafe_onBlankCell() {
}
@Test
@Disabled
public void setCellType_FORMULA_onAnArrayFormulaCell_doesNothing() {
protected void setCellType_FORMULA_onAnArrayFormulaCell_doesNothing() {
}
}

View File

@ -58,15 +58,15 @@ public final class TestSXSSFSheet extends BaseTestXSheet {
*/
@Override
@Test
public void cloneSheet() {
RuntimeException ex = assertThrows(RuntimeException.class, super::cloneSheet);
protected void cloneSheet() {
RuntimeException ex = assertThrows(RuntimeException.class, () -> super.cloneSheet());
assertEquals("Not Implemented", ex.getMessage());
}
@Override
@Test
public void cloneSheetMultipleTimes() {
RuntimeException ex = assertThrows(RuntimeException.class, super::cloneSheetMultipleTimes);
protected void cloneSheetMultipleTimes() {
RuntimeException ex = assertThrows(RuntimeException.class, () -> super.cloneSheetMultipleTimes());
assertEquals("Not Implemented", ex.getMessage());
}
@ -75,8 +75,8 @@ public final class TestSXSSFSheet extends BaseTestXSheet {
*/
@Override
@Test
public void shiftMerged() {
RuntimeException ex = assertThrows(RuntimeException.class, super::shiftMerged);
protected void shiftMerged() {
RuntimeException ex = assertThrows(RuntimeException.class, () -> super.shiftMerged());
assertEquals("Not Implemented", ex.getMessage());
}
@ -87,14 +87,13 @@ public final class TestSXSSFSheet extends BaseTestXSheet {
*/
@Override
@Test
public void bug35084() {
RuntimeException ex = assertThrows(RuntimeException.class, super::bug35084);
protected void bug35084() {
RuntimeException ex = assertThrows(RuntimeException.class, () -> super.bug35084());
assertEquals("Not Implemented", ex.getMessage());
}
@Override
@Test
public void getCellComment() {
protected void getCellComment() {
// TODO: reading cell comments via Sheet does not work currently as it tries
// to access the underlying sheet for this, but comments are stored as
// properties on Cells...

View File

@ -72,8 +72,8 @@ public final class TestSXSSFWorkbook extends BaseTestXWorkbook {
*/
@Override
@Test
public void cloneSheet() throws IOException {
RuntimeException e = assertThrows(RuntimeException.class, super::cloneSheet);
protected void cloneSheet() throws IOException {
RuntimeException e = assertThrows(RuntimeException.class, () -> super.cloneSheet());
assertEquals("Not Implemented", e.getMessage());
}
@ -82,8 +82,8 @@ public final class TestSXSSFWorkbook extends BaseTestXWorkbook {
*/
@Override
@Test
public void sheetClone() throws IOException {
RuntimeException e = assertThrows(RuntimeException.class, super::sheetClone);
protected void sheetClone() {
RuntimeException e = assertThrows(RuntimeException.class, () -> super.sheetClone());
assertEquals("Not Implemented", e.getMessage());
}

View File

@ -34,7 +34,7 @@ public final class TestMissingWorkbookOnXSSF extends BaseTestMissingWorkbook {
@Override
@BeforeEach
public void setUp() {
protected void setUp() {
mainWorkbook = XSSFTestDataSamples.openSampleWorkbook(MAIN_WORKBOOK_FILENAME);
sourceWorkbook = HSSFTestDataSamples.openSampleWorkbook(SOURCE_WORKBOOK_FILENAME);

View File

@ -54,15 +54,15 @@ public final class TestSXSSFBugs extends BaseTestBugzillaIssues {
// override some tests which do not work for SXSSF
@Override @Disabled("cloneSheet() not implemented") @Test
public void bug18800() { /* cloneSheet() not implemented */ }
protected void bug18800() { /* cloneSheet() not implemented */ }
@Override @Disabled("cloneSheet() not implemented") @Test
public void bug22720() { /* cloneSheet() not implemented */ }
protected void bug22720() { /* cloneSheet() not implemented */ }
@Override @Disabled("Evaluation is not fully supported") @Test
public void bug47815() { /* Evaluation is not supported */ }
protected void bug47815() { /* Evaluation is not supported */ }
@Override @Disabled("Evaluation is not fully supported") @Test
public void bug46729_testMaxFunctionArguments() { /* Evaluation is not supported */ }
protected void bug46729_testMaxFunctionArguments() { /* Evaluation is not supported */ }
@Override @Disabled("Reading data is not supported") @Test
public void bug57798() { /* Reading data is not supported */ }
protected void bug57798() { /* Reading data is not supported */ }
/**
* Setting repeating rows and columns shouldn't break
@ -105,7 +105,7 @@ public final class TestSXSSFBugs extends BaseTestBugzillaIssues {
// bug 60197: setSheetOrder should update sheet-scoped named ranges to maintain references to the sheets before the re-order
@Test
@Override
public void bug60197_NamedRangesReferToCorrectSheetWhenSheetOrderIsChanged() throws Exception {
protected void bug60197_NamedRangesReferToCorrectSheetWhenSheetOrderIsChanged() throws Exception {
try {
super.bug60197_NamedRangesReferToCorrectSheetWhenSheetOrderIsChanged();
} catch (final RuntimeException e) {

View File

@ -96,125 +96,121 @@ public final class TestXSSFSheet extends BaseTestXSheet {
//TODO column styles are not yet supported by XSSF
@Override
@Test
public void defaultColumnStyle() {
protected void defaultColumnStyle() {
//super.defaultColumnStyle();
}
@Test
public void existingHeaderFooter() throws IOException {
XSSFWorkbook wb1 = XSSFTestDataSamples.openSampleWorkbook("45540_classic_Header.xlsx");
XSSFOddHeader hdr;
XSSFOddFooter ftr;
try (XSSFWorkbook wb1 = XSSFTestDataSamples.openSampleWorkbook("45540_classic_Header.xlsx")) {
XSSFOddHeader hdr;
XSSFOddFooter ftr;
// Sheet 1 has a header with center and right text
XSSFSheet s1 = wb1.getSheetAt(0);
assertNotNull(s1.getHeader());
assertNotNull(s1.getFooter());
hdr = (XSSFOddHeader) s1.getHeader();
ftr = (XSSFOddFooter) s1.getFooter();
// Sheet 1 has a header with center and right text
XSSFSheet s1 = wb1.getSheetAt(0);
assertNotNull(s1.getHeader());
assertNotNull(s1.getFooter());
hdr = (XSSFOddHeader) s1.getHeader();
ftr = (XSSFOddFooter) s1.getFooter();
assertEquals("&Ctestdoc&Rtest phrase", hdr.getText());
assertNull(ftr.getText());
assertEquals("&Ctestdoc&Rtest phrase", hdr.getText());
assertNull(ftr.getText());
assertEquals("", hdr.getLeft());
assertEquals("testdoc", hdr.getCenter());
assertEquals("test phrase", hdr.getRight());
assertEquals("", hdr.getLeft());
assertEquals("testdoc", hdr.getCenter());
assertEquals("test phrase", hdr.getRight());
assertEquals("", ftr.getLeft());
assertEquals("", ftr.getCenter());
assertEquals("", ftr.getRight());
assertEquals("", ftr.getLeft());
assertEquals("", ftr.getCenter());
assertEquals("", ftr.getRight());
// Sheet 2 has a footer, but it's empty
XSSFSheet s2 = wb1.getSheetAt(1);
assertNotNull(s2.getHeader());
assertNotNull(s2.getFooter());
hdr = (XSSFOddHeader) s2.getHeader();
ftr = (XSSFOddFooter) s2.getFooter();
// Sheet 2 has a footer, but it's empty
XSSFSheet s2 = wb1.getSheetAt(1);
assertNotNull(s2.getHeader());
assertNotNull(s2.getFooter());
hdr = (XSSFOddHeader) s2.getHeader();
ftr = (XSSFOddFooter) s2.getFooter();
assertNull(hdr.getText());
assertEquals("&L&F", ftr.getText());
assertNull(hdr.getText());
assertEquals("&L&F", ftr.getText());
assertEquals("", hdr.getLeft());
assertEquals("", hdr.getCenter());
assertEquals("", hdr.getRight());
assertEquals("", hdr.getLeft());
assertEquals("", hdr.getCenter());
assertEquals("", hdr.getRight());
assertEquals("&F", ftr.getLeft());
assertEquals("", ftr.getCenter());
assertEquals("", ftr.getRight());
assertEquals("&F", ftr.getLeft());
assertEquals("", ftr.getCenter());
assertEquals("", ftr.getRight());
// Save and reload
XSSFWorkbook wb2 = XSSFTestDataSamples.writeOutAndReadBack(wb1);
wb1.close();
// Save and reload
try (XSSFWorkbook wb2 = XSSFTestDataSamples.writeOutAndReadBack(wb1)) {
hdr = (XSSFOddHeader) wb2.getSheetAt(0).getHeader();
ftr = (XSSFOddFooter) wb2.getSheetAt(0).getFooter();
hdr = (XSSFOddHeader) wb2.getSheetAt(0).getHeader();
ftr = (XSSFOddFooter) wb2.getSheetAt(0).getFooter();
assertEquals("", hdr.getLeft());
assertEquals("testdoc", hdr.getCenter());
assertEquals("test phrase", hdr.getRight());
assertEquals("", hdr.getLeft());
assertEquals("testdoc", hdr.getCenter());
assertEquals("test phrase", hdr.getRight());
assertEquals("", ftr.getLeft());
assertEquals("", ftr.getCenter());
assertEquals("", ftr.getRight());
wb2.close();
assertEquals("", ftr.getLeft());
assertEquals("", ftr.getCenter());
assertEquals("", ftr.getRight());
}
}
}
@Test
public void getAllHeadersFooters() throws IOException {
XSSFWorkbook workbook = new XSSFWorkbook();
XSSFSheet sheet = workbook.createSheet("Sheet 1");
assertNotNull(sheet.getOddFooter());
assertNotNull(sheet.getEvenFooter());
assertNotNull(sheet.getFirstFooter());
assertNotNull(sheet.getOddHeader());
assertNotNull(sheet.getEvenHeader());
assertNotNull(sheet.getFirstHeader());
try (XSSFWorkbook workbook = new XSSFWorkbook()) {
XSSFSheet sheet = workbook.createSheet("Sheet 1");
assertNotNull(sheet.getOddFooter());
assertNotNull(sheet.getEvenFooter());
assertNotNull(sheet.getFirstFooter());
assertNotNull(sheet.getOddHeader());
assertNotNull(sheet.getEvenHeader());
assertNotNull(sheet.getFirstHeader());
assertEquals("", sheet.getOddFooter().getLeft());
sheet.getOddFooter().setLeft("odd footer left");
assertEquals("odd footer left", sheet.getOddFooter().getLeft());
assertEquals("", sheet.getOddFooter().getLeft());
sheet.getOddFooter().setLeft("odd footer left");
assertEquals("odd footer left", sheet.getOddFooter().getLeft());
assertEquals("", sheet.getEvenFooter().getLeft());
sheet.getEvenFooter().setLeft("even footer left");
assertEquals("even footer left", sheet.getEvenFooter().getLeft());
assertEquals("", sheet.getEvenFooter().getLeft());
sheet.getEvenFooter().setLeft("even footer left");
assertEquals("even footer left", sheet.getEvenFooter().getLeft());
assertEquals("", sheet.getFirstFooter().getLeft());
sheet.getFirstFooter().setLeft("first footer left");
assertEquals("first footer left", sheet.getFirstFooter().getLeft());
assertEquals("", sheet.getFirstFooter().getLeft());
sheet.getFirstFooter().setLeft("first footer left");
assertEquals("first footer left", sheet.getFirstFooter().getLeft());
assertEquals("", sheet.getOddHeader().getLeft());
sheet.getOddHeader().setLeft("odd header left");
assertEquals("odd header left", sheet.getOddHeader().getLeft());
assertEquals("", sheet.getOddHeader().getLeft());
sheet.getOddHeader().setLeft("odd header left");
assertEquals("odd header left", sheet.getOddHeader().getLeft());
assertEquals("", sheet.getOddHeader().getRight());
sheet.getOddHeader().setRight("odd header right");
assertEquals("odd header right", sheet.getOddHeader().getRight());
assertEquals("", sheet.getOddHeader().getRight());
sheet.getOddHeader().setRight("odd header right");
assertEquals("odd header right", sheet.getOddHeader().getRight());
assertEquals("", sheet.getOddHeader().getCenter());
sheet.getOddHeader().setCenter("odd header center");
assertEquals("odd header center", sheet.getOddHeader().getCenter());
assertEquals("", sheet.getOddHeader().getCenter());
sheet.getOddHeader().setCenter("odd header center");
assertEquals("odd header center", sheet.getOddHeader().getCenter());
// Defaults are odd
assertEquals("odd footer left", sheet.getFooter().getLeft());
assertEquals("odd header center", sheet.getHeader().getCenter());
workbook.close();
// Defaults are odd
assertEquals("odd footer left", sheet.getFooter().getLeft());
assertEquals("odd header center", sheet.getHeader().getCenter());
}
}
@Test
public void autoSizeColumn() throws IOException {
XSSFWorkbook workbook = new XSSFWorkbook();
XSSFSheet sheet = workbook.createSheet("Sheet 1");
sheet.createRow(0).createCell(13).setCellValue("test");
try (XSSFWorkbook workbook = new XSSFWorkbook()) {
XSSFSheet sheet = workbook.createSheet("Sheet 1");
sheet.createRow(0).createCell(13).setCellValue("test");
sheet.autoSizeColumn(13);
sheet.autoSizeColumn(13);
ColumnHelper columnHelper = sheet.getColumnHelper();
CTCol col = columnHelper.getColumn(13, false);
assertTrue(col.getBestFit());
workbook.close();
ColumnHelper columnHelper = sheet.getColumnHelper();
CTCol col = columnHelper.getColumn(13, false);
assertTrue(col.getBestFit());
}
}
@ -925,7 +921,7 @@ public final class TestXSSFSheet extends BaseTestXSheet {
*/
@Override
@Test
public void createRow() throws IOException {
protected void createRow() throws IOException {
XSSFWorkbook wb1 = new XSSFWorkbook();
XSSFSheet sheet = wb1.createSheet();
CTWorksheet wsh = sheet.getCTWorksheet();

View File

@ -151,7 +151,7 @@ public final class POITestCase {
* }
*
* {@literal @}Test
* public void knownFailingUnitTest() {
* void knownFailingUnitTest() {
* try {
* assertEquals(2, add(1,1));
* // this test fails because the assumption that this bug had not been fixed is false
@ -164,7 +164,7 @@ public final class POITestCase {
*
* Once passing, this unit test can be rewritten as:
* {@literal @}Test
* public void knownPassingUnitTest() {
* void knownPassingUnitTest() {
* assertEquals(2, add(1,1));
* }
*
@ -177,7 +177,7 @@ public final class POITestCase {
* a clear message that it is a good thing to no longer get the expected
* exception once the test passes.
* {@literal @}Test(expected=UnsupportedOperationException.class)
* public void knownFailingUnitTest() {
* void knownFailingUnitTest() {
* assertEquals(2, add(1,1));
* }
*

View File

@ -50,13 +50,13 @@ public final class TestPOIDocumentMain {
* Set things up, two spreadsheets for our testing
*/
@BeforeEach
public void setUp() {
void setUp() {
doc = HSSFTestDataSamples.openSampleWorkbook("DateFormats.xls");
doc2 = HSSFTestDataSamples.openSampleWorkbook("StringFormulas.xls");
}
@Test
public void readProperties() {
void readProperties() {
readPropertiesHelper(doc);
}
@ -71,7 +71,7 @@ public final class TestPOIDocumentMain {
}
@Test
public void readProperties2() {
void readProperties2() {
// Check again on the word one
assertNotNull(doc2.getDocumentSummaryInformation());
assertNotNull(doc2.getSummaryInformation());
@ -82,7 +82,7 @@ public final class TestPOIDocumentMain {
}
@Test
public void writeProperties() throws IOException {
void writeProperties() throws IOException {
// Just check we can write them back out into a filesystem
POIFSFileSystem outFS = new POIFSFileSystem();
doc.readProperties();
@ -98,7 +98,7 @@ public final class TestPOIDocumentMain {
}
@Test
public void WriteReadProperties() throws IOException {
void WriteReadProperties() throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
// Write them out
@ -121,7 +121,7 @@ public final class TestPOIDocumentMain {
}
@Test
public void createNewProperties() throws IOException {
void createNewProperties() throws IOException {
POIDocument doc = new HSSFWorkbook();
// New document won't have them
@ -149,7 +149,7 @@ public final class TestPOIDocumentMain {
}
@Test
public void createNewPropertiesOnExistingFile() throws IOException {
void createNewPropertiesOnExistingFile() throws IOException {
POIDocument doc = new HSSFWorkbook();
// New document won't have them

View File

@ -33,41 +33,41 @@ import org.junit.jupiter.api.Test;
*/
public final class TestPOITestCase {
@Test
public void assertStartsWith() {
void assertStartsWith() {
POITestCase.assertStartsWith("Apache POI", "");
POITestCase.assertStartsWith("Apache POI", "Apache");
POITestCase.assertStartsWith("Apache POI", "Apache POI");
}
@Test
public void assertEndsWith() {
void assertEndsWith() {
POITestCase.assertEndsWith("Apache POI", "");
POITestCase.assertEndsWith("Apache POI", "POI");
POITestCase.assertEndsWith("Apache POI", "Apache POI");
}
@Test
public void assertContains() {
void assertContains() {
POITestCase.assertContains("There is a needle in this haystack", "needle");
}
@Test
public void assertContainsIgnoreCase_Locale() {
void assertContainsIgnoreCase_Locale() {
POITestCase.assertContainsIgnoreCase("There is a Needle in this haystack", "needlE", Locale.ROOT);
}
@Test
public void assertContainsIgnoreCase() {
void assertContainsIgnoreCase() {
POITestCase.assertContainsIgnoreCase("There is a Needle in this haystack", "needlE");
}
@Test
public void assertNotContained() {
void assertNotContained() {
POITestCase.assertNotContained("There is a needle in this haystack", "gold");
}
@Test
public void assertMapContains() {
void assertMapContains() {
Map<String, String> haystack = Collections.singletonMap("needle", "value");
POITestCase.assertContains(haystack, "needle");
}
@ -78,7 +78,7 @@ public final class TestPOITestCase {
* Only use this method in test cases!!!
*/
@Test
public void getFieldValue() throws IOException {
void getFieldValue() throws IOException {
try (POIFSFileSystem fs = new POIFSFileSystem()) {
PropertyTable actual = POITestCase.getFieldValue(POIFSFileSystem.class, fs, PropertyTable.class, "_property_table");
assertNotNull(actual);

View File

@ -68,7 +68,7 @@ public class TestEscherDump {
private PrintStream stream;
@BeforeEach
public void setup() throws UnsupportedEncodingException {
void setup() throws UnsupportedEncodingException {
stream = new PrintStream(baos, true, StandardCharsets.UTF_8.name());
}

View File

@ -72,7 +72,7 @@ public class TestVariantSupport {
}
@Test
public void newNumberTypes() throws Exception {
void newNumberTypes() throws Exception {
ClipboardData cd = new ClipboardData();
cd.setValue(new byte[10]);

View File

@ -35,7 +35,7 @@ public class POIFile
*
* @param name The POI file's name.
*/
public void setName(final String name)
void setName(final String name)
{
this.name = name;
}
@ -55,7 +55,7 @@ public class POIFile
*
* @param path The POI file's path.
*/
public void setPath(final POIFSDocumentPath path)
void setPath(final POIFSDocumentPath path)
{
this.path = path;
}
@ -75,7 +75,7 @@ public class POIFile
*
* @param bytes The POI file's content bytes.
*/
public void setBytes(final byte[] bytes)
void setBytes(final byte[] bytes)
{
this.bytes = bytes;
}

View File

@ -77,7 +77,7 @@ public final class TestBasic {
* @exception IOException if any other I/O exception occurs.
*/
@BeforeEach
public void setUp() throws IOException {
void setUp() throws IOException {
final File data = samples.getFile("TestGermanWord90.doc");
poiFiles = Util.readPOIFiles(data);
}
@ -177,7 +177,7 @@ public final class TestBasic {
}
@Test
public void bug52117LastPrinted() throws IOException, HPSFException {
void bug52117LastPrinted() throws IOException, HPSFException {
File f = samples.getFile("TestBug52117.doc");
POIFile poiFile = Util.readPOIFiles(f, new String[]{POI_FILES[0]}).get(0);
InputStream in = new ByteArrayInputStream(poiFile.getBytes());
@ -189,7 +189,7 @@ public final class TestBasic {
}
@Test
public void bug61809() throws IOException, HPSFException {
void bug61809() throws IOException, HPSFException {
InputStream is_si = new ByteArrayInputStream(poiFiles.get(0).getBytes());
final SummaryInformation si = (SummaryInformation)PropertySetFactory.create(is_si);
final Section s_si = si.getSections().get(0);

View File

@ -78,7 +78,7 @@ public final class TestClassID {
}
@Test
public void checkUUIDConversion() {
void checkUUIDConversion() {
String exp = "EABCECDB-CC1C-4A6F-B4E3-7F888A5ADFC8";
ClassID clsId = ClassIDPredefined.EXCEL_V14_ODS.getClassID();
assertEquals(exp, clsId.toUUIDString());

View File

@ -70,7 +70,7 @@ public final class TestEmptyProperties {
* @exception IOException if an I/O exception occurs
*/
@BeforeEach
public void setUp() throws IOException {
void setUp() throws IOException {
final File data = samples.getFile(POI_FS);
poiFiles = Util.readPOIFiles(data);
}

View File

@ -172,7 +172,7 @@ public final class TestHPSFBugs {
}
@Test
public void bug62451() throws IOException {
void bug62451() throws IOException {
final long millis = 920355314183864L;
try (HSSFWorkbook wb = new HSSFWorkbook()) {
wb.createSheet().createRow(0).createCell(0).setCellValue("foo");

View File

@ -53,7 +53,7 @@ public final class TestMetaDataIPI {
private SummaryInformation si;
@AfterEach
public void tearDown() throws Exception {
void tearDown() throws Exception {
poifs.close();
}
@ -62,7 +62,7 @@ public final class TestMetaDataIPI {
* SummaryInformation to reasonable values
*/
@BeforeEach
public void setUp() throws Exception {
void setUp() throws Exception {
poifs = new POIFSFileSystem();
dsi = PropertySetFactory.newDocumentSummaryInformation();
si = PropertySetFactory.newSummaryInformation();

View File

@ -70,7 +70,7 @@ public class TestReadAllFiles {
*/
@ParameterizedTest
@MethodSource("files")
public void read(File file) throws IOException, NoPropertySetStreamException, MarkUnsupportedException {
void read(File file) throws IOException, NoPropertySetStreamException, MarkUnsupportedException {
/* Read the POI filesystem's property set streams: */
for (POIFile pf : Util.readPropertySets(file)) {
try (InputStream in = new ByteArrayInputStream(pf.getBytes())) {
@ -96,7 +96,7 @@ public class TestReadAllFiles {
*/
@ParameterizedTest
@MethodSource("files")
public void recreate(File file) throws IOException, HPSFException {
void recreate(File file) throws IOException, HPSFException {
/* Read the POI filesystem's property set streams: */
Map<String,PropertySet> psMap = new HashMap<>();
@ -142,7 +142,7 @@ public class TestReadAllFiles {
*/
@ParameterizedTest
@MethodSource("files")
public void readDocumentSummaryInformation(File file) throws Exception {
void readDocumentSummaryInformation(File file) throws Exception {
/* Read a test document <em>doc</em> into a POI filesystem. */
try (POIFSFileSystem poifs = new POIFSFileSystem(file, true)) {
final DirectoryEntry dir = poifs.getRoot();
@ -185,7 +185,7 @@ public class TestReadAllFiles {
*/
@ParameterizedTest
@MethodSource("files")
public void readCustomPropertiesFromFiles(File file) throws Exception {
void readCustomPropertiesFromFiles(File file) throws Exception {
/* Read a test document <em>doc</em> into a POI filesystem. */
try (POIFSFileSystem poifs = new POIFSFileSystem(file)) {
/*

View File

@ -56,7 +56,7 @@ public class TestUnicode {
* @exception IOException if any other I/O exception occurs
*/
@BeforeEach
public void setUp() {
void setUp() {
POIDataSamples samples = POIDataSamples.getHPSFInstance();
data = samples.getFile(POI_FS);
}

View File

@ -123,7 +123,7 @@ public class TestWrite {
* @exception IOException if an I/O exception occurs
*/
@Test
public void withoutAFormatID() throws Exception {
void withoutAFormatID() throws Exception {
final File filename = TempFile.createTempFile(POI_FS, ".doc");
/* Create a mutable property set with a section that does not have the
@ -150,7 +150,7 @@ public class TestWrite {
* a variant type to be written
*/
@Test
public void writeEmptyPropertySet()
void writeEmptyPropertySet()
throws IOException, UnsupportedVariantTypeException {
final File dataDir = _samples.getFile("");
final File filename = new File(dataDir, POI_FS);
@ -186,7 +186,7 @@ public class TestWrite {
* a variant type to be written
*/
@Test
public void writeSimplePropertySet()
void writeSimplePropertySet()
throws IOException, UnsupportedVariantTypeException {
final String AUTHOR = "Rainer Klute";
final String TITLE = "Test Document";
@ -239,7 +239,7 @@ public class TestWrite {
* a variant type to be written
*/
@Test
public void writeTwoSections() throws WritingNotSupportedException, IOException {
void writeTwoSections() throws WritingNotSupportedException, IOException {
final String STREAM_NAME = "PropertySetStream";
final String SECTION1 = "Section 1";
final String SECTION2 = "Section 2";
@ -297,7 +297,7 @@ public class TestWrite {
* stuff that has been read back equals the stuff that was written.
*/
@Test
public void variantTypes() throws Exception {
void variantTypes() throws Exception {
final int codepage = CODEPAGE_DEFAULT;
Assumptions.assumeTrue(hasProperDefaultCharset(), IMPROPER_DEFAULT_CHARSET_MESSAGE);
@ -330,7 +330,7 @@ public class TestWrite {
* was written.
*/
@Test
public void codepages() throws UnsupportedVariantTypeException, IOException
void codepages() throws UnsupportedVariantTypeException, IOException
{
final int[] validCodepages = {CODEPAGE_DEFAULT, CodePageUtil.CP_UTF8, CodePageUtil.CP_UNICODE, CodePageUtil.CP_WINDOWS_1252};
for (final int cp : validCodepages) {
@ -363,7 +363,7 @@ public class TestWrite {
* Tests whether writing 8-bit characters to a Unicode property succeeds.
*/
@Test
public void unicodeWrite8Bit() throws WritingNotSupportedException, IOException, NoPropertySetStreamException {
void unicodeWrite8Bit() throws WritingNotSupportedException, IOException, NoPropertySetStreamException {
final String TITLE = "This is a sample title";
final PropertySet mps = new PropertySet();
final Section ms = mps.getSections().get(0);
@ -422,7 +422,7 @@ public class TestWrite {
* <p>Tests writing and reading back a proper dictionary.</p>
*/
@Test
public void dictionary() throws IOException, HPSFException {
void dictionary() throws IOException, HPSFException {
final File copy = TempFile.createTempFile("Test-HPSF", "ole2");
copy.deleteOnExit();
@ -465,7 +465,7 @@ public class TestWrite {
* without needing to stream in + out the whole kitchen sink
*/
@Test
public void inPlacePOIFSWrite() throws Exception {
void inPlacePOIFSWrite() throws Exception {
// We need to work on a File for in-place changes, so create a temp one
final File copy = TempFile.createTempFile("Test-HPSF", "ole2");
copy.deleteOnExit();
@ -673,7 +673,7 @@ public class TestWrite {
* codepage. (HPSF writes Unicode dictionaries only.)
*/
@Test
public void dictionaryWithInvalidCodepage() throws IOException, HPSFException {
void dictionaryWithInvalidCodepage() throws IOException, HPSFException {
final File copy = TempFile.createTempFile("Test-HPSF", "ole2");
copy.deleteOnExit();

View File

@ -145,7 +145,7 @@ public final class TestEventRecordFactory {
@Test
@Disabled("same as testContinuedUnknownRecord but with SequenceInputStream which causes the available() bug 59893")
public void bug59893() {
void bug59893() {
Iterator<ByteArrayInputStream> iter = Stream.of(CONTINUE_DATA).map(ByteArrayInputStream::new).iterator();
SequenceInputStream sis = new SequenceInputStream(IteratorUtils.asEnumeration(iter));
continueHelper(sis);

View File

@ -47,7 +47,7 @@ public final class TestEventWorkbookBuilder {
private SheetRecordCollectingListener listener;
@BeforeEach
public void setUp() throws IOException {
void setUp() throws IOException {
HSSFRequest req = new HSSFRequest();
fRecs.clear();
listener = new SheetRecordCollectingListener(this::addFormulaRecord);

View File

@ -29,7 +29,7 @@ public final class TestDrawingManager2 {
private EscherDggRecord dgg;
@BeforeEach
public void setUp() {
void setUp() {
dgg = new EscherDggRecord();
dgg.setFileIdClusters( new EscherDggRecord.FileIdCluster[0] );
drawingManager2 = new DrawingManager2( dgg );

View File

@ -84,7 +84,7 @@ public final class TestRVA {
@ParameterizedTest
@MethodSource("data")
public void confirmCell(HSSFCell formulaCell, String formula) {
void confirmCell(HSSFCell formulaCell, String formula) {
Ptg[] excelPtgs = FormulaExtractor.getPtgs(formulaCell);
Ptg[] poiPtgs = HSSFFormulaParser.parse(formula, workbook);
int nExcelTokens = excelPtgs.length;

View File

@ -61,7 +61,7 @@ public final class TestRecordFactoryInputStream {
* Makes sure that a default password mismatch condition is represented with {@link EncryptedDocumentException}
*/
@Test
public void defaultPasswordWrong() {
void defaultPasswordWrong() {
// This encodng depends on docId, password and stream position
final String SAMPLE_WINDOW1_ENCR1 = "3D 00 12 00"
+ "C4, 9B, 02, 50, 86, E0, DF, 34, FB, 57, 0E, 8C, CE, 25, 45, E3, 80, 01";
@ -80,7 +80,7 @@ public final class TestRecordFactoryInputStream {
}
@Test
public void defaultPasswordOK() {
void defaultPasswordOK() {
// This encodng depends on docId, password and stream position
final String SAMPLE_WINDOW1_ENCR1 = "3D 00 12 00"
+ "C4, 9B, 02, 50, 86, E0, DF, 34, FB, 57, 0E, 8C, CE, 25, 45, E3, 80, 01";
@ -100,7 +100,7 @@ public final class TestRecordFactoryInputStream {
* Makes sure that an incorrect user supplied password condition is represented with {@link EncryptedDocumentException}
*/
@Test
public void suppliedPasswordWrong() {
void suppliedPasswordWrong() {
// This encoding depends on docId, password and stream position
final String SAMPLE_WINDOW1_ENCR2 = "3D 00 12 00"
+ "45, B9, 90, FE, B6, C6, EC, 73, EE, 3F, 52, 45, 97, DB, E3, C1, D6, FE";
@ -124,7 +124,7 @@ public final class TestRecordFactoryInputStream {
}
@Test
public void suppliedPasswordOK() {
void suppliedPasswordOK() {
// This encoding depends on docId, password and stream position
final String SAMPLE_WINDOW1_ENCR2 = "3D 00 12 00"
+ "45, B9, 90, FE, B6, C6, EC, 73, EE, 3F, 52, 45, 97, DB, E3, C1, D6, FE";

View File

@ -80,7 +80,7 @@ public final class TestUnicodeString {
}
@Test
public void smallStringSize() {
void smallStringSize() {
//Test a basic string
UnicodeString s = makeUnicodeString("Test");
confirmSize(7, s);
@ -127,7 +127,7 @@ public final class TestUnicodeString {
}
@Test
public void perfectStringSize() {
void perfectStringSize() {
//Test a basic string
UnicodeString s = makeUnicodeString(MAX_DATA_SIZE-2-1);
confirmSize(MAX_DATA_SIZE, s);
@ -141,7 +141,7 @@ public final class TestUnicodeString {
}
@Test
public void perfectRichStringSize() {
void perfectRichStringSize() {
//Test a rich text string
UnicodeString s = makeUnicodeString(MAX_DATA_SIZE-2-1-8-2);
s.addFormatRun(new FormatRun((short)1,(short)0));
@ -160,7 +160,7 @@ public final class TestUnicodeString {
}
@Test
public void continuedStringSize() {
void continuedStringSize() {
//Test a basic string
UnicodeString s = makeUnicodeString(MAX_DATA_SIZE-2-1+20);
confirmSize(MAX_DATA_SIZE+4+1+20, s);
@ -168,7 +168,7 @@ public final class TestUnicodeString {
/** Tests that a string size calculation that fits neatly in two records, the second being a continue*/
@Test
public void perfectContinuedStringSize() {
void perfectContinuedStringSize() {
//Test a basic string
int strSize = MAX_DATA_SIZE*2;
//String overhead
@ -182,7 +182,7 @@ public final class TestUnicodeString {
}
@Test
public void formatRun() {
void formatRun() {
FormatRun fr = new FormatRun((short)4, (short)0x15c);
assertEquals(4, fr.getCharacterPos());
assertEquals(0x15c, fr.getFontIndex());
@ -208,7 +208,7 @@ public final class TestUnicodeString {
}
@Test
public void extRstFromEmpty() {
void extRstFromEmpty() {
ExtRst ext = new ExtRst();
assertEquals(0, ext.getNumberOfRuns());
@ -272,7 +272,7 @@ public final class TestUnicodeString {
}
@Test
public void extRstFromData() {
void extRstFromData() {
byte[] data = new byte[] {
1, 0, 0x0C, 0,
0, 0, 0x37, 0,
@ -296,7 +296,7 @@ public final class TestUnicodeString {
}
@Test
public void corruptExtRstDetection() {
void corruptExtRstDetection() {
byte[] data = new byte[] {
0x79, 0x79, 0x11, 0x11,
0x22, 0x22, 0x33, 0x33,
@ -323,7 +323,7 @@ public final class TestUnicodeString {
}
@Test
public void extRstEqualsAndHashCode() {
void extRstEqualsAndHashCode() {
byte[] buf = new byte[200];
LittleEndianByteArrayOutputStream bos = new LittleEndianByteArrayOutputStream(buf, 0);
String str = "\u1d02\u1d12\u1d22";
@ -350,7 +350,7 @@ public final class TestUnicodeString {
}
@Test
public void unicodeStringsNullPointer() throws IOException {
void unicodeStringsNullPointer() throws IOException {
try (HSSFWorkbook wb = new HSSFWorkbook()) {
Sheet sheet = wb.createSheet("styles");
@ -368,7 +368,7 @@ public final class TestUnicodeString {
}
@Test
public void copyExtRst() {
void copyExtRst() {
ExtRst ext = new ExtRst();
assertEquals(0, ext.getNumberOfRuns());
@ -389,7 +389,7 @@ public final class TestUnicodeString {
}
@Test
public void copyExtRstFromData() {
void copyExtRstFromData() {
byte[] data = new byte[]{
1, 0, 0x0C, 0,
0, 0, 0x37, 0,

View File

@ -191,7 +191,7 @@ public class SanityChecker {
checkRecordOrder(records, sheetRecords);
}
public void checkHSSFWorkbook(HSSFWorkbook wb) {
void checkHSSFWorkbook(HSSFWorkbook wb) {
checkWorkbookRecords(wb.getWorkbook());
for (int i = 0; i < wb.getNumberOfSheets(); i++)
checkSheetRecords(wb.getSheetAt(i).getSheet());

View File

@ -153,7 +153,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* open resulting file in Excel to check results!
*/
@Test
public void bug15375() throws Exception {
void bug15375() throws Exception {
try (HSSFWorkbook wb1 = openSampleWorkbook("15375.xls")) {
HSSFSheet sheet = wb1.getSheetAt(0);
@ -184,12 +184,12 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* Double byte strings
*/
@Test
public void bug15556() throws Exception {
void bug15556() throws Exception {
simpleTest("15556.xls", wb -> assertNotNull(wb.getSheetAt(0).getRow(45)));
}
@Test
public void bug24215() throws Exception {
void bug24215() throws Exception {
try (HSSFWorkbook wb = openSampleWorkbook("24215.xls")) {
for (int sheetIndex = 0; sheetIndex < wb.getNumberOfSheets(); sheetIndex++) {
@ -216,7 +216,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* The file contains THAI unicode characters.
*/
@Test
public void bugUnicodeStringFormulaRead() throws Exception {
void bugUnicodeStringFormulaRead() throws Exception {
try (HSSFWorkbook w = openSampleWorkbook("25695.xls")) {
@ -281,7 +281,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* names and macros
*/
@Test
public void bug27852() throws Exception {
void bug27852() throws Exception {
try (HSSFWorkbook wb = openSampleWorkbook("27852.xls")) {
for (HSSFName name : wb.getAllNames()) {
assertNotNull(name.getNameName());
@ -296,7 +296,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* Bug 29206: NPE on HSSFSheet.getRow for blank rows
*/
@Test
public void bug29206() throws Exception {
void bug29206() throws Exception {
//the first check with blank workbook
try (HSSFWorkbook wb = openSampleWorkbook("Simple.xls")) {
HSSFSheet sheet = wb.createSheet();
@ -311,7 +311,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* Bug 29942: Importing Excel files that have been created by Open Office on Linux
*/
@Test
public void bug29942() throws Exception {
void bug29942() throws Exception {
try (HSSFWorkbook wb = openSampleWorkbook("29942.xls")) {
HSSFSheet sheet = wb.getSheetAt(0);
@ -336,7 +336,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* Bug 30540: HSSFSheet.setRowBreak throws NullPointerException
*/
@Test
public void bug30540() throws Exception {
void bug30540() throws Exception {
try (HSSFWorkbook wb = openSampleWorkbook("30540.xls")) {
HSSFSheet s1 = wb.getSheetAt(0);
@ -355,7 +355,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* when HSSFWorkbook is created from file
*/
@Test
public void bug35564() throws Exception {
void bug35564() throws Exception {
simpleTest("35564.xls", wb -> {
HSSFSheet sheet = wb.getSheetAt(0);
assertFalse(sheet.isGridsPrinted());
@ -367,7 +367,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* Bug 35565: HSSFCell.java: NullPtrExc in getColumnBreaks() when HSSFWorkbook is created from file
*/
@Test
public void bug35565() throws Exception {
void bug35565() throws Exception {
simpleTest("35565.xls", wb -> assertNotNull(wb.getSheetAt(0)));
}
@ -375,7 +375,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* Bug 40285: CellIterator Skips First Column
*/
@Test
public void bug40285() throws Exception {
void bug40285() throws Exception {
try (HSSFWorkbook wb = openSampleWorkbook("40285.xls")) {
HSSFSheet sheet = wb.getSheetAt(0);
@ -403,7 +403,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* 4. Get a NullPointerException
*/
@Test
public void bug38266() throws Exception {
void bug38266() throws Exception {
String[] files = {"Simple.xls", "SimpleMultiCell.xls", "duprich1.xls"};
for (String file : files) {
try (HSSFWorkbook wb = openSampleWorkbook(file)) {
@ -424,7 +424,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* Bug 44200: Sheet not cloneable when Note added to excel cell
*/
@Test
public void bug44200() throws Exception {
void bug44200() throws Exception {
simpleTest("44200.xls", wb -> assertDoesNotThrow(() -> wb.cloneSheet(0)));
}
@ -433,7 +433,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* Unknown Ptg in Formula: 0x1a (26)
*/
@Test
public void bug41546() throws Exception {
void bug41546() throws Exception {
simpleTest("41546.xls", wb -> assertEquals(1, wb.getNumberOfSheets()));
}
@ -442,7 +442,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* =CHOOSE(2,A2,A3,A4)
*/
@Test
public void bug42618() throws Exception {
void bug42618() throws Exception {
try (HSSFWorkbook wb1 = openSampleWorkbook("SimpleWithChoose.xls");
HSSFWorkbook wb2 = writeOutAndReadBack(wb1)){
// Check we detect the string properly too
@ -473,7 +473,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* Something up with the FileSharingRecord
*/
@Test
public void bug43251() throws Exception {
void bug43251() throws Exception {
// Used to blow up with an IllegalArgumentException when creating a FileSharingRecord
simpleTest("43251.xls", wb -> assertEquals(1, wb.getNumberOfSheets()));
}
@ -483,7 +483,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* StyleRecords, which is against the spec
*/
@Test
public void bug44471() throws Exception {
void bug44471() throws Exception {
// Used to blow up with an ArrayIndexOutOfBounds when creating a StyleRecord
simpleTest("OddStyleRecord.xls", wb -> assertEquals(1, wb.getNumberOfSheets()));
}
@ -493,7 +493,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* grief on the FileSharingRecord
*/
@Test
public void bug44536() throws Exception {
void bug44536() throws Exception {
// Used to blow up with an IllegalArgumentException when creating a FileSharingRecord
simpleTest("ReadOnlyRecommended.xls", wb -> {
// Check read only advised
@ -511,7 +511,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* probably due to dropdowns
*/
@Test
public void bug44593() throws Exception {
void bug44593() throws Exception {
// Used to blow up with an IllegalArgumentException when creating a DVRecord
// Now won't, but no idea if this means we have rubbish in the DVRecord or not...
simpleTest("44593.xls", wb -> assertEquals(2, wb.getNumberOfSheets()));
@ -522,7 +522,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* length string, but that's now properly handled
*/
@Test
public void bug44643() throws Exception {
void bug44643() throws Exception {
// Used to blow up with an IllegalArgumentException
simpleTest("44643.xls", wb -> assertEquals(1, wb.getNumberOfSheets()));
}
@ -532,7 +532,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* iterator, but we can't replicate that
*/
@Test
public void bug44693() throws Exception {
void bug44693() throws Exception {
try (HSSFWorkbook wb = openSampleWorkbook("44693.xls")) {
HSSFSheet s = wb.getSheetAt(0);
@ -557,7 +557,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* HSSFObjectData
*/
@Test
public void bug44840() throws Exception {
void bug44840() throws Exception {
try (HSSFWorkbook wb = openSampleWorkbook("WithCheckBoxes.xls")) {
// Take a look at the embedded objects
@ -592,7 +592,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* used for printing stuff.
*/
@Test
public void bug30978() throws Exception {
void bug30978() throws Exception {
try (HSSFWorkbook wb1 = openSampleWorkbook("30978-alt.xls")) {
assertEquals(1, wb1.getNumberOfNames());
assertEquals(3, wb1.getNumberOfSheets());
@ -637,7 +637,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* Test that fonts get added properly
*/
@Test
public void bug45338() throws IOException {
void bug45338() throws IOException {
try (HSSFWorkbook wb = new HSSFWorkbook()) {
assertEquals(4, wb.getNumberOfFonts());
@ -694,7 +694,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* containing a zip code, eg ="70164"
*/
@Test
public void bugZipCodeFormulas() throws Exception {
void bugZipCodeFormulas() throws Exception {
try (HSSFWorkbook wb1 = new HSSFWorkbook()) {
HSSFSheet s = wb1.createSheet();
s.createRow(0);
@ -832,7 +832,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* row and cell number
*/
@Test
public void bug30635() throws IOException {
void bug30635() throws IOException {
try (HSSFWorkbook wb = new HSSFWorkbook()) {
HSSFSheet s = wb.createSheet();
@ -883,7 +883,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* Data Tables - ptg 0x2
*/
@Test
public void bug44958() throws Exception {
void bug44958() throws Exception {
try (HSSFWorkbook wb = openSampleWorkbook("44958.xls")) {
HSSFSheet s;
HSSFRow r;
@ -916,7 +916,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* 45322: HSSFSheet.autoSizeColumn fails when style.getDataFormat() returns -1
*/
@Test
public void bug45322() throws Exception {
void bug45322() throws Exception {
try (HSSFWorkbook wb = openSampleWorkbook("44958.xls")) {
HSSFSheet sh = wb.getSheetAt(0);
for (short i = 0; i < 30; i++) {
@ -931,7 +931,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* with diagrams on. Don't any more
*/
@Test
public void bug45414() throws Exception {
void bug45414() throws Exception {
try (HSSFWorkbook wb1 = openSampleWorkbook("WithThreeCharts.xls")) {
wb1.getSheetAt(0).setForceFormulaRecalculation(true);
wb1.getSheetAt(1).setForceFormulaRecalculation(false);
@ -953,7 +953,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* Very hidden sheets not displaying as such
*/
@Test
public void bug45761() throws Exception {
void bug45761() throws Exception {
try (HSSFWorkbook wb1 = openSampleWorkbook("45761.xls")) {
assertEquals(3, wb1.getNumberOfSheets());
@ -984,7 +984,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* POI now supports header / footer text lengths beyond 256 bytes.
*/
@Test
public void bug45777() throws Exception {
void bug45777() throws Exception {
try (HSSFWorkbook wb = new HSSFWorkbook()) {
HSSFSheet s = wb.createSheet();
@ -1034,7 +1034,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* Charts with long titles
*/
@Test
public void bug45784() throws Exception {
void bug45784() throws Exception {
simpleTest("45784.xls", wb -> assertEquals(1, wb.getNumberOfSheets()));
}
@ -1042,7 +1042,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* Cell background colours
*/
@Test
public void bug45492() throws Exception {
void bug45492() throws Exception {
try (HSSFWorkbook wb = openSampleWorkbook("45492.xls")) {
HSSFSheet s = wb.getSheetAt(0);
HSSFRow r = s.getRow(0);
@ -1080,7 +1080,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* ContinueRecord after EOF
*/
@Test
public void bug46137() throws Exception {
void bug46137() throws Exception {
simpleTest("46137.xls", wb -> assertEquals(7, wb.getNumberOfSheets()));
}
@ -1089,7 +1089,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* block[ 44 ] already removed from org.apache.poi.poifs.storage.BlockListImpl.remove
*/
@Test
public void bug45290() throws Exception {
void bug45290() throws Exception {
simpleTest("45290.xls", wb -> assertEquals(1, wb.getNumberOfSheets()));
}
@ -1098,7 +1098,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* =MY_VBA_FUNCTION("lskdjflsk")
*/
@Test
public void bug30070() throws Exception {
void bug30070() throws Exception {
//contains custom VBA function 'Commission'
try (HSSFWorkbook wb = openSampleWorkbook("30070.xls")) {
HSSFSheet sh = wb.getSheetAt(0);
@ -1131,7 +1131,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* Sheet1!$A$3
*/
@Test
public void bug27364() throws Exception {
void bug27364() throws Exception {
try (HSSFWorkbook wb = openSampleWorkbook("27364.xls")) {
HSSFSheet sheet = wb.getSheetAt(0);
@ -1146,7 +1146,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* HSSFCell.getCellFormula() fails with references to external workbooks
*/
@Test
public void bug31661() throws Exception {
void bug31661() throws Exception {
try (HSSFWorkbook wb = openSampleWorkbook("31661.xls")) {
HSSFSheet sheet = wb.getSheetAt(0);
HSSFCell cell = sheet.getRow(11).getCell(10); //K11
@ -1158,7 +1158,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* Incorrect handling of non-ISO 8859-1 characters in Windows ANSII Code Page 1252
*/
@Test
public void bug27394() throws Exception {
void bug27394() throws Exception {
try (HSSFWorkbook wb = openSampleWorkbook("27394.xls")) {
assertEquals("\u0161\u017E", wb.getSheetName(0));
assertEquals("\u0161\u017E\u010D\u0148\u0159", wb.getSheetName(1));
@ -1173,7 +1173,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* Multiple calls of HSSFWorkbook.write result in corrupted xls
*/
@Test
public void bug32191() throws IOException {
void bug32191() throws IOException {
try (HSSFWorkbook wb = openSampleWorkbook("27394.xls");
ByteArrayOutputStream out1 = new ByteArrayOutputStream();
ByteArrayOutputStream out2 = new ByteArrayOutputStream();
@ -1191,7 +1191,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* non-unicode data for a name record
*/
@Test
public void bug47034() throws Exception {
void bug47034() throws Exception {
simpleTest("47034.xls", wb -> {
assertEquals(893, wb.getNumberOfNames());
assertEquals("Matthew\\Matthew11_1\\Matthew2331_1\\Matthew2351_1\\Matthew2361_1___lab", wb.getNameName(300));
@ -1203,7 +1203,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* The test file was created in OpenOffice 3.0 as Excel does not allow cell text longer than 32,767 characters
*/
@Test
public void bug46368() throws Exception {
void bug46368() throws Exception {
try (HSSFWorkbook wb = openSampleWorkbook("46368.xls")) {
HSSFSheet s = wb.getSheetAt(0);
HSSFCell cell1 = s.getRow(0).getCell(0);
@ -1218,7 +1218,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* Short records on certain sheets with charts in them
*/
@Test
public void bug48180() throws Exception {
void bug48180() throws Exception {
try (HSSFWorkbook wb = openSampleWorkbook("48180.xls")) {
HSSFSheet s = wb.getSheetAt(0);
@ -1234,7 +1234,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* Round trip a file with an unusual UnicodeString/ExtRst record parts
*/
@Test
public void bug47847() throws Exception {
void bug47847() throws Exception {
try (HSSFWorkbook wb1 = openSampleWorkbook("47847.xls")) {
assertEquals(3, wb1.getNumberOfSheets());
@ -1273,7 +1273,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* contained in it.
*/
@Test
public void bug49096() throws Exception {
void bug49096() throws Exception {
try (HSSFWorkbook wb1 = openSampleWorkbook("49096.xls")) {
assertEquals(1, wb1.getNumberOfSheets());
@ -1295,7 +1295,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* by reference not value
*/
@Test
public void bug46664() throws Exception {
void bug46664() throws Exception {
try (HSSFWorkbook wb1 = new HSSFWorkbook()) {
HSSFSheet sheet = wb1.createSheet("new_sheet");
HSSFRow row = sheet.createRow((short) 0);
@ -1353,7 +1353,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* sheets via URLs
*/
@Test
public void bug45970() throws Exception {
void bug45970() throws Exception {
try (HSSFWorkbook wb1 = openSampleWorkbook("FormulaRefs.xls")) {
assertEquals(3, wb1.getNumberOfSheets());
@ -1445,7 +1445,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* Test for a file with NameRecord with NameCommentRecord comments
*/
@Test
public void bug49185() throws Exception {
void bug49185() throws Exception {
try (HSSFWorkbook wb1 = openSampleWorkbook("49185.xls")) {
Name name = wb1.getName("foobarName");
assertNotNull(name);
@ -1477,7 +1477,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
/** Vertically aligned text */
@Test
public void bug49524() throws Exception {
void bug49524() throws Exception {
try (HSSFWorkbook wb1 = openSampleWorkbook("49524.xls")) {
Sheet s = wb1.getSheetAt(0);
Row r = s.getRow(0);
@ -1516,7 +1516,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* Setting the user style name on custom styles
*/
@Test
public void bug49689() throws Exception {
void bug49689() throws Exception {
try (HSSFWorkbook wb1 = new HSSFWorkbook()) {
HSSFSheet s = wb1.createSheet("Test");
HSSFRow r = s.createRow(0);
@ -1549,7 +1549,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
}
@Test
public void bug49751() throws Exception {
void bug49751() throws Exception {
Set<String> exp = new HashSet<>(Arrays.asList(
"20% - Accent1", "20% - Accent2", "20% - Accent3", "20% - Accent4", "20% - Accent5",
"20% - Accent6", "40% - Accent1", "40% - Accent2", "40% - Accent3", "40% - Accent4",
@ -1574,7 +1574,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* Regression with the PageSettingsBlock
*/
@Test
public void bug49931() throws Exception {
void bug49931() throws Exception {
simpleTest("49931.xls", wb -> {
assertEquals(1, wb.getNumberOfSheets());
assertEquals("Foo", wb.getSheetAt(0).getRow(0).getCell(0).getRichStringCellValue().toString());
@ -1585,7 +1585,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* Missing left/right/centre options on a footer
*/
@Test
public void bug48325() throws Exception {
void bug48325() throws Exception {
try (HSSFWorkbook wb = openSampleWorkbook("48325.xls")) {
HSSFSheet sh = wb.getSheetAt(0);
HSSFFooter f = sh.getFooter();
@ -1603,7 +1603,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* Last row number when shifting rows
*/
@Test
public void bug50416LastRowNumber() throws IOException {
void bug50416LastRowNumber() throws IOException {
// Create the workbook with 1 sheet which contains 3 rows
try (HSSFWorkbook wb = new HSSFWorkbook()) {
Sheet sheet = wb.createSheet("Bug50416");
@ -1661,7 +1661,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* will turn the "General" format into "GENERAL"
*/
@Test
public void bug50756() throws Exception {
void bug50756() throws Exception {
try (HSSFWorkbook wb = openSampleWorkbook("50756.xls")) {
HSSFSheet s = wb.getSheetAt(0);
HSSFRow r17 = s.getRow(16);
@ -1697,7 +1697,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* the bit excel cares about
*/
@Test
public void bug50833() throws Exception {
void bug50833() throws Exception {
HSSFWorkbook wb1 = openSampleWorkbook("50833.xls");
HSSFSheet s = wb1.getSheetAt(0);
assertEquals("Sheet1", s.getSheetName());
@ -1732,12 +1732,12 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* bytes on the end, but we sometimes find files without...
*/
@Test
public void bug50939() throws Exception {
void bug50939() throws Exception {
simpleTest("50939.xls", wb -> assertEquals(2, wb.getNumberOfSheets()));
}
@Test
public void bug49219() throws Exception {
void bug49219() throws Exception {
simpleTest("49219.xls", wb -> {
assertEquals(1, wb.getNumberOfSheets());
assertEquals("DGATE", wb.getSheetAt(0).getRow(1).getCell(0).getStringCellValue());
@ -1745,7 +1745,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
}
@Test
public void bug48968() throws Exception {
void bug48968() throws Exception {
TimeZone userTimeZone = LocaleUtil.getUserTimeZone();
LocaleUtil.setUserTimeZone(TimeZone.getTimeZone("CET"));
try {
@ -1806,7 +1806,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* NameComment record
*/
@Test
public void bug51143() throws Exception {
void bug51143() throws Exception {
simpleTest("51143.xls", wb -> assertEquals(1, wb.getNumberOfSheets()));
}
@ -1815,7 +1815,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* shouldn't break on POIFS loading
*/
@Test
public void bug51461() throws Exception {
void bug51461() throws Exception {
byte[] data = HSSFITestDataProvider.instance.getTestDataFileContent("51461.xls");
HSSFWorkbook wbPOIFS = new HSSFWorkbook(new POIFSFileSystem(
@ -1828,7 +1828,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
}
@Test
public void bug51535() throws Exception {
void bug51535() throws Exception {
try (HSSFWorkbook wb = openSampleWorkbook("51535.xls")) {
assertEquals(3, wb.getNumberOfSheets());
@ -1875,14 +1875,14 @@ public final class TestBugs extends BaseTestBugzillaIssues {
}
@Test
public void bug49896() throws Exception {
void bug49896() throws Exception {
String exp = "VLOOKUP(A2,'[C:Documents and Settings/Yegor/My Documents/csco.xls]Sheet1'!$A$2:$B$3,2,FALSE)"
.replace("/", File.separator);
simpleTest("49896.xls", wb -> assertEquals(exp, wb.getSheetAt(0).getRow(1).getCell(1).getCellFormula()));
}
@Test
public void bug49529() throws Exception {
void bug49529() throws Exception {
// user code reported in Bugzilla #49529
simpleTest("49529.xls", wb -> {
wb.getSheetAt(0).createDrawingPatriarch();
@ -1893,7 +1893,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
}
@Test
public void bug49612_part() throws IOException {
void bug49612_part() throws IOException {
try (HSSFWorkbook wb = openSampleWorkbook("49612.xls")) {
HSSFSheet sh = wb.getSheetAt(0);
HSSFRow row = sh.getRow(0);
@ -1915,7 +1915,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
}
@Test
public void bug51675() throws Exception {
void bug51675() throws Exception {
try (HSSFWorkbook wb = openSampleWorkbook("51675.xls")) {
HSSFSheet sh = wb.getSheetAt(0);
InternalSheet ish = HSSFTestHelper.getSheetForTest(sh);
@ -1928,7 +1928,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
}
@Test
public void bug52272() throws IOException {
void bug52272() throws IOException {
try (HSSFWorkbook wb = new HSSFWorkbook()) {
HSSFSheet sh = wb.createSheet();
HSSFPatriarch p = sh.createDrawingPatriarch();
@ -1942,7 +1942,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
}
@Test
public void bug53432() throws IOException {
void bug53432() throws IOException {
try (HSSFWorkbook wb1 = new HSSFWorkbook()) {
wb1.addPicture(new byte[]{123, 22}, Workbook.PICTURE_TYPE_JPEG);
assertEquals(wb1.getAllPictures().size(), 1);
@ -1961,7 +1961,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
}
@Test
public void bug46250() throws Exception {
void bug46250() throws Exception {
try (HSSFWorkbook wb = openSampleWorkbook("46250.xls")) {
Sheet sh = wb.getSheet("Template");
Sheet cSh = wb.cloneSheet(wb.getSheetIndex(sh));
@ -1982,7 +1982,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
}
@Test
public void bug53404() throws Exception {
void bug53404() throws Exception {
try (HSSFWorkbook wb = openSampleWorkbook("53404.xls")) {
Sheet sheet = wb.getSheet("test-sheet");
int rowCount = sheet.getLastRowNum() + 1;
@ -2012,7 +2012,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* Row style information is 12 not 16 bits
*/
@Test
public void bug49237() throws Exception {
void bug49237() throws Exception {
try (Workbook wb = openSampleWorkbook("49237.xls")) {
Sheet sheet = wb.getSheetAt(0);
Row row = sheet.getRow(0);
@ -2030,7 +2030,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
"xor-encryption-abc.xls, abc",
"35897-type4.xls, freedom"
})
public void bug35897(String file, String pass) throws Exception {
void bug35897(String file, String pass) throws Exception {
Biff8EncryptionKey.setCurrentUserPassword(pass);
try {
simpleTest(file, null);
@ -2040,7 +2040,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
}
@Test
public void bug56450() throws Exception {
void bug56450() throws Exception {
try (HSSFWorkbook wb = openSampleWorkbook("56450.xls")) {
HSSFSheet sheet = wb.getSheetAt(0);
int comments = 0;
@ -2060,7 +2060,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* Files initially created with Excel 2010 can have >3 CF rules
*/
@Test
public void bug56482() throws Exception {
void bug56482() throws Exception {
try (HSSFWorkbook wb = openSampleWorkbook("56482.xls")) {
assertEquals(1, wb.getNumberOfSheets());
@ -2072,7 +2072,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
}
@Test
public void bug56325() throws IOException {
void bug56325() throws IOException {
try (HSSFWorkbook wb1 = openSampleWorkbook("56325.xls")) {
assertEquals(3, wb1.getNumberOfSheets());
wb1.removeSheetAt(0);
@ -2093,7 +2093,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
}
@Test
public void bug56325a() throws IOException {
void bug56325a() throws IOException {
try (HSSFWorkbook wb1 = openSampleWorkbook("56325a.xls")) {
HSSFSheet sheet = wb1.cloneSheet(2);
@ -2121,7 +2121,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* java.lang.RuntimeException: Unexpected eval class (org.apache.poi.ss.formula.eval.NameXEval)
*/
@Test
public void bug56737() throws IOException {
void bug56737() throws IOException {
try (Workbook wb = openSampleWorkbook("56737.xls")) {
// Check the named range definitions
@ -2162,7 +2162,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* ExtendedFormatRecord when removing un-used styles
*/
@Test
public void bug54443() throws Exception {
void bug54443() throws Exception {
try (HSSFWorkbook workbook = new HSSFWorkbook()) {
HSSFCellStyle style = workbook.createCellStyle();
HSSFCellStyle newStyle = workbook.createCellStyle();
@ -2187,7 +2187,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* Intersection formula ranges, eg =(C2:D3 D3:E4)
*/
@Test
public void bug52111() throws Exception {
void bug52111() throws Exception {
try (Workbook wb = openSampleWorkbook("Intersection-52111.xls")) {
Sheet s = wb.getSheetAt(0);
assertFormula(wb, s.getRow(2).getCell(0), "(C2:D3 D3:E4)", "4.0");
@ -2197,7 +2197,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
}
@Test
public void bug42016() throws Exception {
void bug42016() throws Exception {
try (Workbook wb = openSampleWorkbook("42016.xls")) {
Sheet s = wb.getSheetAt(0);
for (int row = 0; row < 7; row++) {
@ -2210,7 +2210,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* Unexpected record type (org.apache.poi.hssf.record.ColumnInfoRecord)
*/
@Test
public void bug53984() throws Exception {
void bug53984() throws Exception {
try (Workbook wb = openSampleWorkbook("53984.xls")) {
Sheet s = wb.getSheetAt(0);
assertEquals("International Communication Services SA", s.getRow(2).getCell(0).getStringCellValue());
@ -2226,7 +2226,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
* See base-test-class for some related tests that still fail
*/
@Test
public void bug46670_existing() throws Exception {
void bug46670_existing() throws Exception {
// Expected values
String refLocal = "'[refs" + File.separator + "airport.xls]Sheet1'!$A$2";
String refHttp = "'[9http://www.principlesofeconometrics.com/excel/airline.xls]Sheet1'!$A$2";
@ -2542,7 +2542,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
"50779_2.xls", "51670.xls", "54016.xls", "57456.xls", "53109.xls", "com.aida-tour.www_SPO_files_maldives%20august%20october.xls",
"named-cell-in-formula-test.xls", "named-cell-test.xls", "bug55505.xls", "SUBSTITUTE.xls", "64261.xls"
})
public void simpleTest(String fileName) throws IOException {
void simpleTest(String fileName) throws IOException {
simpleTest(fileName, null);
}
@ -2552,7 +2552,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
"46904.xls, org.apache.poi.hssf.OldExcelFormatException, The supplied spreadsheet seems to be Excel",
"51832.xls, org.apache.poi.EncryptedDocumentException, Default password is invalid for salt/verifier/verifierHash"
})
public void simpleTest(String fileName, String exClazz, String exMessage) throws IOException, ClassNotFoundException {
void simpleTest(String fileName, String exClazz, String exMessage) throws IOException, ClassNotFoundException {
Class<? extends Exception> ex = (Class<? extends Exception>)Class.forName(exClazz);
Exception e = assertThrows(ex, () -> simpleTest(fileName, null));
assertTrue(e.getMessage().startsWith(exMessage));

View File

@ -30,7 +30,7 @@ public class TestCryptoAPI {
final HSSFITestDataProvider ssTests = HSSFITestDataProvider.instance;
@Test
public void bug59857() throws IOException {
void bug59857() throws IOException {
// XOR-Obfuscation
// TODO: XOR-Obfuscation is currently flawed - although the de-/obfuscation initially works,
// it suddenly differs from the result of encrypted files via Office ...

View File

@ -60,7 +60,7 @@ public final class TestDataValidation extends BaseTestDataValidation {
}
public void assertDataValidation(Workbook wb) {
void assertDataValidation(Workbook wb) {
byte[] generatedContent;
try (ByteArrayOutputStream baos = new ByteArrayOutputStream(22000)) {

View File

@ -46,7 +46,7 @@ public final class TestEscherGraphics {
private EscherGraphics graphics;
@BeforeEach
public void setUp() throws IOException {
void setUp() throws IOException {
workbook = new HSSFWorkbook();
HSSFSheet sheet = workbook.createSheet("test");
@ -57,7 +57,7 @@ public final class TestEscherGraphics {
}
@AfterEach
public void closeResources() throws IOException {
void closeResources() throws IOException {
workbook.close();
}

View File

@ -39,7 +39,7 @@ public final class TestEscherGraphics2d {
private EscherGraphics2d graphics;
@BeforeEach
public void setUp() {
void setUp() {
workbook = new HSSFWorkbook();
HSSFSheet sheet = workbook.createSheet("test");
escherGroup = sheet.createDrawingPatriarch().createGroup(new HSSFClientAnchor(0,0,1023,255,(short)0,0,(short) 0,0));
@ -49,7 +49,7 @@ public final class TestEscherGraphics2d {
}
@AfterEach
public void closeResources() throws IOException {
void closeResources() throws IOException {
workbook.close();
}

View File

@ -31,7 +31,7 @@ public final class TestFontDetails {
private FontDetails fontDetails;
@BeforeEach
public void setUp() {
void setUp() {
Properties properties = new Properties();
properties.setProperty("font.Arial.height", "13");
properties.setProperty("font.Arial.characters", "a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ");

View File

@ -431,7 +431,7 @@ public final class TestFormulas {
/**
* Writes a function then tests to see if its correct
*/
public void refArrayFunctionTest(String function) throws IOException {
void refArrayFunctionTest(String function) throws IOException {
try (HSSFWorkbook wb1 = new HSSFWorkbook()) {
HSSFSheet s = wb1.createSheet();
HSSFRow r = s.createRow(0);
@ -454,7 +454,7 @@ public final class TestFormulas {
* Writes a function then tests to see if its correct
*
*/
public void refAreaArrayFunctionTest(String function) throws IOException {
void refAreaArrayFunctionTest(String function) throws IOException {
try (HSSFWorkbook wb1 = new HSSFWorkbook()) {
HSSFSheet s = wb1.createSheet();

View File

@ -409,7 +409,7 @@ public final class TestHSSFCell extends BaseTestCell {
}
@Test
public void getErrorCellValue_throwsISE_onABlankCell() throws IOException {
void getErrorCellValue_throwsISE_onABlankCell() throws IOException {
try (HSSFWorkbook wb = new HSSFWorkbook()) {
Cell cell = wb.createSheet().createRow(0).createCell(0);
assertThrows(IllegalStateException.class, cell::getErrorCellValue);

View File

@ -58,7 +58,7 @@ public final class TestHSSFComment extends BaseTestCellComment {
}
@Test
public void defaultShapeType() {
void defaultShapeType() {
HSSFComment comment = new HSSFComment(null, new HSSFClientAnchor());
assertEquals(HSSFSimpleShape.OBJECT_TYPE_COMMENT, comment.getShapeType());
}
@ -68,7 +68,7 @@ public final class TestHSSFComment extends BaseTestCellComment {
* when matching cells and their cell comments. The correct algorithm is to map
*/
@Test
public void bug47924() throws IOException {
void bug47924() throws IOException {
HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("47924.xls");
HSSFSheet sheet = wb.getSheetAt(0);
HSSFCell cell;
@ -203,7 +203,7 @@ public final class TestHSSFComment extends BaseTestCellComment {
}
@Test
public void resultEqualsToNonExistingAbstractShape() throws IOException {
void resultEqualsToNonExistingAbstractShape() throws IOException {
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sh = wb.createSheet();
HSSFPatriarch patriarch = sh.createDrawingPatriarch();
@ -268,7 +268,7 @@ public final class TestHSSFComment extends BaseTestCellComment {
}
@Test
public void addToExistingFile() throws IOException {
void addToExistingFile() throws IOException {
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sh = wb.createSheet();
HSSFPatriarch patriarch = sh.createDrawingPatriarch();
@ -315,7 +315,7 @@ public final class TestHSSFComment extends BaseTestCellComment {
}
@Test
public void setGetProperties() throws IOException {
void setGetProperties() throws IOException {
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sh = wb.createSheet();
HSSFPatriarch patriarch = sh.createDrawingPatriarch();
@ -371,7 +371,7 @@ public final class TestHSSFComment extends BaseTestCellComment {
}
@Test
public void existingFileWithComment() throws IOException {
void existingFileWithComment() throws IOException {
HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("drawings.xls");
HSSFSheet sheet = wb.getSheet("comments");
HSSFPatriarch drawing = sheet.getDrawingPatriarch();
@ -385,7 +385,7 @@ public final class TestHSSFComment extends BaseTestCellComment {
}
@Test
public void findComments() throws IOException{
void findComments() throws IOException{
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sh = wb.createSheet();
HSSFPatriarch patriarch = sh.createDrawingPatriarch();
@ -409,7 +409,7 @@ public final class TestHSSFComment extends BaseTestCellComment {
}
@Test
public void initState() throws IOException{
void initState() throws IOException{
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sh = wb.createSheet();
HSSFPatriarch patriarch = sh.createDrawingPatriarch();
@ -429,7 +429,7 @@ public final class TestHSSFComment extends BaseTestCellComment {
}
@Test
public void shapeId() throws IOException{
void shapeId() throws IOException{
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sh = wb.createSheet();
HSSFPatriarch patriarch = sh.createDrawingPatriarch();

View File

@ -54,10 +54,9 @@ public class TestHSSFDateUtil {
/**
* Test that against a real, test file, we still do everything
* correctly
* @throws IOException
*/
@Test
public void onARealFile() throws IOException {
void onARealFile() throws IOException {
HSSFWorkbook workbook = HSSFTestDataSamples.openSampleWorkbook("DateFormats.xls");
HSSFSheet sheet = workbook.getSheetAt(0);

View File

@ -41,7 +41,7 @@ public final class TestHSSFPalette {
@BeforeEach
public void setUp() {
void setUp() {
PaletteRecord _palette = new PaletteRecord();
_hssfPalette = new HSSFPalette(_palette);
}

View File

@ -53,7 +53,7 @@ public final class TestHSSFPicture extends BaseTestPicture {
* Bug # 45829 reported ArithmeticException (/ by zero) when resizing png with zero DPI.
*/
@Test
public void bug45829() throws IOException {
void bug45829() throws IOException {
try (HSSFWorkbook wb = new HSSFWorkbook()) {
HSSFSheet sh1 = wb.createSheet();
HSSFPatriarch p1 = sh1.createDrawingPatriarch();
@ -67,7 +67,7 @@ public final class TestHSSFPicture extends BaseTestPicture {
@Test
public void addPictures() throws IOException {
void addPictures() throws IOException {
try (HSSFWorkbook wb1 = new HSSFWorkbook()) {
HSSFSheet sh = wb1.createSheet("Pictures");
@ -166,7 +166,7 @@ public final class TestHSSFPicture extends BaseTestPicture {
@SuppressWarnings("unused")
@Test
public void bsePictureRef() throws IOException {
void bsePictureRef() throws IOException {
try (HSSFWorkbook wb = new HSSFWorkbook()) {
HSSFSheet sh = wb.createSheet("Pictures");
HSSFPatriarch dr = sh.createDrawingPatriarch();
@ -193,7 +193,7 @@ public final class TestHSSFPicture extends BaseTestPicture {
}
@Test
public void readExistingImage() throws IOException {
void readExistingImage() throws IOException {
try (HSSFWorkbook wb = openSampleWorkbook("drawings.xls")) {
HSSFSheet sheet = wb.getSheet("picture");
HSSFPatriarch drawing = sheet.getDrawingPatriarch();
@ -206,7 +206,7 @@ public final class TestHSSFPicture extends BaseTestPicture {
@SuppressWarnings("resource")
@Test
public void setGetProperties() throws IOException {
void setGetProperties() throws IOException {
try (HSSFWorkbook wb1 = new HSSFWorkbook()) {
HSSFSheet sh = wb1.createSheet("Pictures");
@ -234,7 +234,7 @@ public final class TestHSSFPicture extends BaseTestPicture {
@SuppressWarnings("resource")
@Test
public void bug49658() throws IOException {
void bug49658() throws IOException {
// test if inserted EscherMetafileBlip will be read again
try (HSSFWorkbook wb1 = new HSSFWorkbook()) {

View File

@ -33,7 +33,7 @@ public class TestHSSFRangeCopier extends BaseTestRangeCopier {
}
@BeforeEach
public void init() {
void init() {
workbook = HSSFTestDataSamples.openSampleWorkbook("tile-range-test.xls");
initSheets();
rangeCopier = new HSSFRangeCopier(sheet1, sheet1);

View File

@ -67,7 +67,7 @@ public final class TestHSSFSheet extends BaseTestSheet {
* Moved from TestHSSFWorkbook#testSetRepeatingRowsAndColumns().
*/
@Test
public void setRepeatingRowsAndColumnsBug29747() throws IOException {
void setRepeatingRowsAndColumnsBug29747() throws IOException {
try (HSSFWorkbook wb = new HSSFWorkbook()) {
wb.createSheet();
wb.createSheet();
@ -82,7 +82,7 @@ public final class TestHSSFSheet extends BaseTestSheet {
* Test the gridset field gets set as expected.
*/
@Test
public void backupRecord() throws IOException {
void backupRecord() throws IOException {
try (HSSFWorkbook wb = new HSSFWorkbook()) {
HSSFSheet s = wb.createSheet();
GridsetRecord gridsetRec = s.getSheet().getGridsetRecord();
@ -96,7 +96,7 @@ public final class TestHSSFSheet extends BaseTestSheet {
* Test vertically centered output.
*/
@Test
public void verticallyCenter() throws IOException {
void verticallyCenter() throws IOException {
try (HSSFWorkbook wb = new HSSFWorkbook()) {
HSSFSheet s = wb.createSheet();
VCenterRecord record = s.getSheet().getPageSettings().getVCenter();
@ -113,7 +113,7 @@ public final class TestHSSFSheet extends BaseTestSheet {
* Test horizontally centered output.
*/
@Test
public void horizontallyCenter() throws IOException {
void horizontallyCenter() throws IOException {
try (HSSFWorkbook wb = new HSSFWorkbook()) {
HSSFSheet s = wb.createSheet();
HCenterRecord record = s.getSheet().getPageSettings().getHCenter();
@ -131,7 +131,7 @@ public final class TestHSSFSheet extends BaseTestSheet {
* Test WSBoolRecord fields get set in the user model.
*/
@Test
public void wsBool() throws IOException {
void wsBool() throws IOException {
try (HSSFWorkbook wb = new HSSFWorkbook()) {
HSSFSheet s = wb.createSheet();
WSBoolRecord record = (WSBoolRecord) s.getSheet().findFirstRecordBySid(WSBoolRecord.sid);
@ -181,7 +181,7 @@ public final class TestHSSFSheet extends BaseTestSheet {
* Setting landscape and portrait stuff on existing sheets
*/
@Test
public void printSetupLandscapeExisting() throws IOException {
void printSetupLandscapeExisting() throws IOException {
try (HSSFWorkbook wb1 = HSSFTestDataSamples.openSampleWorkbook("SimpleWithPageBreaks.xls")) {
assertEquals(3, wb1.getNumberOfSheets());
@ -228,7 +228,7 @@ public final class TestHSSFSheet extends BaseTestSheet {
}
@Test
public void groupRows() throws IOException {
void groupRows() throws IOException {
try (HSSFWorkbook wb1 = new HSSFWorkbook()) {
HSSFSheet s = wb1.createSheet();
HSSFRow r1 = s.createRow(0);
@ -270,7 +270,7 @@ public final class TestHSSFSheet extends BaseTestSheet {
}
@Test
public void groupRowsExisting() throws IOException {
void groupRowsExisting() throws IOException {
try (HSSFWorkbook wb1 = HSSFTestDataSamples.openSampleWorkbook("NoGutsRecords.xls")) {
HSSFSheet s = wb1.getSheetAt(0);
@ -320,7 +320,7 @@ public final class TestHSSFSheet extends BaseTestSheet {
}
@Test
public void createDrawings() throws IOException {
void createDrawings() throws IOException {
try (HSSFWorkbook workbook = new HSSFWorkbook()) {
HSSFSheet sheet = workbook.createSheet();
HSSFPatriarch p1 = sheet.createDrawingPatriarch();
@ -330,7 +330,7 @@ public final class TestHSSFSheet extends BaseTestSheet {
}
@Test
public void getDrawings() throws IOException {
void getDrawings() throws IOException {
try (HSSFWorkbook wb1c = HSSFTestDataSamples.openSampleWorkbook("WithChart.xls");
HSSFWorkbook wb2c = HSSFTestDataSamples.openSampleWorkbook("WithTwoCharts.xls")) {
@ -356,7 +356,7 @@ public final class TestHSSFSheet extends BaseTestSheet {
* Test that the ProtectRecord is included when creating or cloning a sheet
*/
@Test
public void cloneWithProtect() throws IOException {
void cloneWithProtect() throws IOException {
String passwordA = "secrect";
int expectedHashA = -6810;
String passwordB = "admin";
@ -387,7 +387,7 @@ public final class TestHSSFSheet extends BaseTestSheet {
}
@Test
public void protectSheetA() throws IOException {
void protectSheetA() throws IOException {
int expectedHash = (short)0xfef1;
try (HSSFWorkbook wb = new HSSFWorkbook()) {
HSSFSheet s = wb.createSheet();
@ -405,7 +405,7 @@ public final class TestHSSFSheet extends BaseTestSheet {
* (which should be before {@link DimensionsRecord}).
*/
@Test
public void protectSheetRecordOrder_bug47363a() throws IOException {
void protectSheetRecordOrder_bug47363a() throws IOException {
try (HSSFWorkbook wb = new HSSFWorkbook()) {
HSSFSheet s = wb.createSheet();
s.protectSheet("secret");
@ -427,7 +427,7 @@ public final class TestHSSFSheet extends BaseTestSheet {
* There should be no problem with adding data validations after sheet protection
*/
@Test
public void dvProtectionOrder_bug47363b() throws IOException {
void dvProtectionOrder_bug47363b() throws IOException {
try (HSSFWorkbook workbook = new HSSFWorkbook()) {
HSSFSheet sheet = workbook.createSheet("Sheet1");
sheet.protectSheet("secret");
@ -452,7 +452,7 @@ public final class TestHSSFSheet extends BaseTestSheet {
}
@Test
public void zoom() throws IOException {
void zoom() throws IOException {
try (HSSFWorkbook wb = new HSSFWorkbook()) {
HSSFSheet sheet = wb.createSheet();
assertEquals(-1, sheet.getSheet().findFirstRecordLocBySid(SCLRecord.sid));
@ -489,7 +489,7 @@ public final class TestHSSFSheet extends BaseTestSheet {
* Make sure the excel file loads work
*/
@Test
public void pageBreakFiles() throws IOException {
void pageBreakFiles() throws IOException {
try (HSSFWorkbook wb1 = HSSFTestDataSamples.openSampleWorkbook("SimpleWithPageBreaks.xls")) {
HSSFSheet sheet = wb1.getSheetAt(0);
@ -520,7 +520,7 @@ public final class TestHSSFSheet extends BaseTestSheet {
}
@Test
public void dbcsName () throws IOException {
void dbcsName () throws IOException {
try (HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("DBCSSheetName.xls")) {
wb.getSheetAt(1);
assertEquals(wb.getSheetName(1), "\u090f\u0915", "DBCS Sheet Name 2");
@ -534,7 +534,7 @@ public final class TestHSSFSheet extends BaseTestSheet {
* of the sheet when it is first opened.
*/
@Test
public void topRow() throws IOException {
void topRow() throws IOException {
try (HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("SimpleWithPageBreaks.xls")) {
HSSFSheet sheet = wb.getSheetAt(0);
assertNotNull(sheet);
@ -548,7 +548,7 @@ public final class TestHSSFSheet extends BaseTestSheet {
}
@Test
public void addEmptyRow() throws IOException {
void addEmptyRow() throws IOException {
//try to add 5 empty rows to a new sheet
try (HSSFWorkbook wb1 = new HSSFWorkbook()) {
HSSFSheet sheet = wb1.createSheet();
@ -577,7 +577,7 @@ public final class TestHSSFSheet extends BaseTestSheet {
}
@Test
public void autoSizeColumn() throws IOException {
void autoSizeColumn() throws IOException {
try (HSSFWorkbook wb1 = HSSFTestDataSamples.openSampleWorkbook("43902.xls")) {
String sheetName = "my sheet";
HSSFSheet sheet = wb1.getSheet(sheetName);
@ -626,7 +626,7 @@ public final class TestHSSFSheet extends BaseTestSheet {
* Setting ForceFormulaRecalculation on sheets
*/
@Test
public void forceRecalculation() throws IOException {
void forceRecalculation() throws IOException {
try (HSSFWorkbook wb1 = HSSFTestDataSamples.openSampleWorkbook("UncalcedRecord.xls")) {
HSSFSheet sheet = wb1.getSheetAt(0);
@ -680,7 +680,7 @@ public final class TestHSSFSheet extends BaseTestSheet {
}
@Test
public void columnWidthA() throws IOException {
void columnWidthA() throws IOException {
// check we can correctly read column widths from a reference workbook
try (HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("colwidth.xls")) {
@ -743,7 +743,7 @@ public final class TestHSSFSheet extends BaseTestSheet {
@Test
public void defaultColumnWidth() throws IOException {
void defaultColumnWidth() throws IOException {
try (HSSFWorkbook wb1 = HSSFTestDataSamples.openSampleWorkbook( "12843-1.xls" )) {
HSSFSheet sheet = wb1.getSheetAt(7);
// shall not be NPE
@ -773,7 +773,7 @@ public final class TestHSSFSheet extends BaseTestSheet {
* Now POI is too.
*/
@Test
public void missingRowRecords_bug41187() throws IOException {
void missingRowRecords_bug41187() throws IOException {
try (HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("ex41187-19267.xls")) {
HSSFSheet sheet = wb.getSheetAt(0);
HSSFRow row = sheet.getRow(0);
@ -796,7 +796,7 @@ public final class TestHSSFSheet extends BaseTestSheet {
* See bug #45720.
*/
@Test
public void cloneSheetWithDrawings() throws IOException {
void cloneSheetWithDrawings() throws IOException {
try (HSSFWorkbook wb1 = HSSFTestDataSamples.openSampleWorkbook("45720.xls")) {
HSSFSheet sheet1 = wb1.getSheetAt(0);
@ -831,7 +831,7 @@ public final class TestHSSFSheet extends BaseTestSheet {
* 31 chars.
*/
@Test
public void longSheetNames() throws IOException {
void longSheetNames() throws IOException {
try (HSSFWorkbook wb = new HSSFWorkbook()) {
final String SAME_PREFIX = "A123456789B123456789C123456789"; // 30 chars
@ -848,7 +848,7 @@ public final class TestHSSFSheet extends BaseTestSheet {
* Tests that we can read existing column styles
*/
@Test
public void readColumnStyles() throws IOException {
void readColumnStyles() throws IOException {
try (HSSFWorkbook wbNone = HSSFTestDataSamples.openSampleWorkbook("ColumnStyleNone.xls");
HSSFWorkbook wbSimple = HSSFTestDataSamples.openSampleWorkbook("ColumnStyle1dp.xls");
HSSFWorkbook wbComplex = HSSFTestDataSamples.openSampleWorkbook("ColumnStyle1dpColoured.xls")) {
@ -891,7 +891,7 @@ public final class TestHSSFSheet extends BaseTestSheet {
* Tests the arabic setting
*/
@Test
public void arabic() throws IOException {
void arabic() throws IOException {
try (HSSFWorkbook wb = new HSSFWorkbook()) {
HSSFSheet s = wb.createSheet();
@ -902,7 +902,7 @@ public final class TestHSSFSheet extends BaseTestSheet {
}
@Test
public void autoFilter() throws IOException {
void autoFilter() throws IOException {
try (HSSFWorkbook wb1 = new HSSFWorkbook()) {
HSSFSheet sh = wb1.createSheet();
InternalWorkbook iwb = wb1.getWorkbook();
@ -955,7 +955,7 @@ public final class TestHSSFSheet extends BaseTestSheet {
}
@Test
public void getSetColumnHiddenShort() throws IOException {
void getSetColumnHiddenShort() throws IOException {
try (Workbook workbook = new HSSFWorkbook()) {
Sheet sheet = workbook.createSheet("Sheet 1");
sheet.setColumnHidden((short) 2, true);
@ -964,7 +964,7 @@ public final class TestHSSFSheet extends BaseTestSheet {
}
@Test
public void columnWidthShort() throws IOException {
void columnWidthShort() throws IOException {
try (HSSFWorkbook wb1 = new HSSFWorkbook()) {
Sheet sheet = wb1.createSheet();
@ -1023,7 +1023,7 @@ public final class TestHSSFSheet extends BaseTestSheet {
}
@Test
public void showInPane() throws IOException {
void showInPane() throws IOException {
try (Workbook wb = new HSSFWorkbook()) {
Sheet sheet = wb.createSheet();
sheet.showInPane(2, 3);
@ -1037,7 +1037,7 @@ public final class TestHSSFSheet extends BaseTestSheet {
}
@Test
public void drawingRecords() throws IOException {
void drawingRecords() throws IOException {
try (HSSFWorkbook wb = new HSSFWorkbook()) {
HSSFSheet sheet = wb.createSheet();
@ -1049,7 +1049,7 @@ public final class TestHSSFSheet extends BaseTestSheet {
}
@Test
public void bug55723b() throws IOException {
void bug55723b() throws IOException {
try (HSSFWorkbook wb = new HSSFWorkbook()) {
Sheet sheet = wb.createSheet();
@ -1095,7 +1095,7 @@ public final class TestHSSFSheet extends BaseTestSheet {
}
@Test
public void bug59135() throws IOException {
void bug59135() throws IOException {
try (HSSFWorkbook wb1 = new HSSFWorkbook()) {
wb1.createSheet().protectSheet("1111.2222.3333.1234");
try (HSSFWorkbook wb2 = writeOutAndReadBack(wb1)) {

View File

@ -34,53 +34,51 @@ public class TestHSSFSheetShiftColumns extends BaseTestSheetShiftColumns {
_testDataProvider = HSSFITestDataProvider.instance;
}
protected Workbook openWorkbook(String spreadsheetFileName)
throws IOException {
protected Workbook openWorkbook(String spreadsheetFileName) {
return HSSFTestDataSamples.openSampleWorkbook(spreadsheetFileName);
}
protected Workbook getReadBackWorkbook(Workbook wb) throws IOException {
protected Workbook getReadBackWorkbook(Workbook wb) {
return HSSFTestDataSamples.writeOutAndReadBack((HSSFWorkbook)wb);
}
@Override
@Disabled("see <https://bz.apache.org/bugzilla/show_bug.cgi?id=62030>")
@Test
public void shiftMergedColumnsToMergedColumnsLeft() throws IOException {
protected void shiftMergedColumnsToMergedColumnsLeft() {
// This override is used only in order to test failing for HSSF. Please remove method after code is fixed on hssf,
// so that original method from BaseTestSheetShiftColumns can be executed.
}
@Override
@Disabled("see <https://bz.apache.org/bugzilla/show_bug.cgi?id=62030>")
@Test
public void shiftMergedColumnsToMergedColumnsRight() throws IOException {
protected void shiftMergedColumnsToMergedColumnsRight() {
// This override is used only in order to test failing for HSSF. Please remove method after code is fixed on hssf,
// so that original method from BaseTestSheetShiftColumns can be executed.
}
@Override
@Disabled("see <https://bz.apache.org/bugzilla/show_bug.cgi?id=62030>")
@Test
protected void testBug54524() throws IOException {
protected void testBug54524() {
// This override is used only in order to test failing for HSSF. Please remove method after code is fixed on hssf,
// so that original method from BaseTestSheetShiftColumns can be executed.
}
@Override
@Disabled("see <https://bz.apache.org/bugzilla/show_bug.cgi?id=62030>")
@Test
protected void testCommentsShifting() throws IOException {
protected void testCommentsShifting() {
// This override is used only in order to test failing for HSSF. Please remove method after code is fixed on hssf,
// so that original method from BaseTestSheetShiftColumns can be executed.
}
@Override
@Disabled("see <https://bz.apache.org/bugzilla/show_bug.cgi?id=62030>")
@Test
protected void testShiftWithMergedRegions() throws IOException {
protected void testShiftWithMergedRegions() {
// This override is used only in order to test failing for HSSF. Please remove method after code is fixed on hssf,
// so that original method from BaseTestSheetShiftColumns can be executed.
// After removing, you can re-add 'final' keyword to specification of original method.
}
@Override
@Disabled("see <https://bz.apache.org/bugzilla/show_bug.cgi?id=62030>")
@Test
protected void testShiftHyperlinks() throws IOException {}
protected void testShiftHyperlinks() {}
}

View File

@ -98,7 +98,7 @@ public final class TestHSSFWorkbook extends BaseTestWorkbook {
* Tests for {@link HSSFWorkbook#isHidden()} etc
*/
@Test
public void hidden() throws IOException {
void hidden() throws IOException {
HSSFWorkbook wb = new HSSFWorkbook();
WindowOneRecord w1 = wb.getWorkbook().getWindowOne();
@ -126,7 +126,7 @@ public final class TestHSSFWorkbook extends BaseTestWorkbook {
}
@Test
public void readWriteWithCharts() throws IOException {
void readWriteWithCharts() throws IOException {
Sheet s;
// Single chart, two sheets
@ -196,7 +196,7 @@ public final class TestHSSFWorkbook extends BaseTestWorkbook {
}
@Test
public void selectedSheet_bug44523() throws IOException {
void selectedSheet_bug44523() throws IOException {
HSSFWorkbook wb=new HSSFWorkbook();
HSSFSheet sheet1 = wb.createSheet("Sheet1");
HSSFSheet sheet2 = wb.createSheet("Sheet2");
@ -243,7 +243,7 @@ public final class TestHSSFWorkbook extends BaseTestWorkbook {
}
@Test
public void selectMultiple() throws IOException {
void selectMultiple() throws IOException {
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet0 = wb.createSheet("Sheet0");
HSSFSheet sheet1 = wb.createSheet("Sheet1");
@ -287,7 +287,7 @@ public final class TestHSSFWorkbook extends BaseTestWorkbook {
@Test
public void activeSheetAfterDelete_bug40414() throws IOException {
void activeSheetAfterDelete_bug40414() throws IOException {
HSSFWorkbook wb=new HSSFWorkbook();
HSSFSheet sheet0 = wb.createSheet("Sheet0");
HSSFSheet sheet1 = wb.createSheet("Sheet1");
@ -369,7 +369,7 @@ public final class TestHSSFWorkbook extends BaseTestWorkbook {
* a specific exception as soon as the situation is detected. See bugzilla 45066
*/
@Test
public void sheetSerializeSizeMismatch_bug45066() throws IOException {
void sheetSerializeSizeMismatch_bug45066() throws IOException {
try (HSSFWorkbook wb = new HSSFWorkbook()) {
InternalSheet sheet = wb.createSheet("Sheet1").getSheet();
List<RecordBase> sheetRecords = sheet.getRecords();
@ -386,7 +386,7 @@ public final class TestHSSFWorkbook extends BaseTestWorkbook {
* that point to deleted sheets
*/
@Test
public void namesToDeleteSheets() throws IOException {
void namesToDeleteSheets() throws IOException {
HSSFWorkbook b = openSampleWorkbook("30978-deleted.xls");
assertEquals(3, b.getNumberOfNames());
@ -508,7 +508,7 @@ public final class TestHSSFWorkbook extends BaseTestWorkbook {
* The sample file provided with bug 45582 seems to have one extra byte after the EOFRecord
*/
@Test
public void extraDataAfterEOFRecord() throws IOException {
void extraDataAfterEOFRecord() throws IOException {
// bug 45582 - RecordFormatException - getCause() instanceof LittleEndian.BufferUnderrunException
try (HSSFWorkbook wb = openSampleWorkbook("ex45582-22397.xls")) {
assertNotNull(wb);
@ -520,7 +520,7 @@ public final class TestHSSFWorkbook extends BaseTestWorkbook {
* 1-based sheet tab index (not a 1-based extern sheet index)
*/
@Test
public void findBuiltInNameRecord() throws IOException {
void findBuiltInNameRecord() throws IOException {
// testRRaC has multiple (3) built-in name records
// The second print titles name record has getSheetNumber()==4
HSSFWorkbook wb1 = openSampleWorkbook("testRRaC.xls");
@ -553,7 +553,7 @@ public final class TestHSSFWorkbook extends BaseTestWorkbook {
* Test that the storage clsid property is preserved
*/
@Test
public void bug47920() throws IOException {
void bug47920() throws IOException {
POIFSFileSystem fs1 = new POIFSFileSystem(samples.openResourceAsStream("47920.xls"));
HSSFWorkbook wb = new HSSFWorkbook(fs1);
ClassID clsid1 = fs1.getRoot().getStorageClsid();
@ -581,7 +581,7 @@ public final class TestHSSFWorkbook extends BaseTestWorkbook {
"testEXCEL_5.xls,BIFF5",
"testEXCEL_95.xls,BIFF5"
})
public void helpfulExceptionOnOldFiles(String file, String format) throws Exception {
void helpfulExceptionOnOldFiles(String file, String format) throws Exception {
POIDataSamples xlsData = samples;
try (InputStream is = xlsData.openResourceAsStream(file)) {
OldExcelFormatException e = assertThrows(OldExcelFormatException.class, () -> new HSSFWorkbook(is),
@ -595,7 +595,7 @@ public final class TestHSSFWorkbook extends BaseTestWorkbook {
* and {@link POIFSFileSystem}
*/
@Test
public void differentPOIFS() throws Exception {
void differentPOIFS() throws Exception {
// Open the two filesystems
DirectoryNode[] files = new DirectoryNode[2];
try (POIFSFileSystem poifsFileSystem = new POIFSFileSystem(HSSFTestDataSamples.openSampleFileStream("Simple.xls"))) {
@ -627,7 +627,7 @@ public final class TestHSSFWorkbook extends BaseTestWorkbook {
}
@Test
public void wordDocEmbeddedInXls() throws IOException {
void wordDocEmbeddedInXls() throws IOException {
// Open the two filesystems
DirectoryNode[] files = new DirectoryNode[2];
try (POIFSFileSystem poifsFileSystem = new POIFSFileSystem(HSSFTestDataSamples.openSampleFileStream("WithEmbeddedObjects.xls"))) {
@ -665,7 +665,7 @@ public final class TestHSSFWorkbook extends BaseTestWorkbook {
* again (via POIFS) and have it be valid
*/
@Test
public void writeWorkbookFromPOIFS() throws IOException {
void writeWorkbookFromPOIFS() throws IOException {
try (InputStream is = HSSFTestDataSamples.openSampleFileStream("WithEmbeddedObjects.xls");
POIFSFileSystem fs = new POIFSFileSystem(is)) {
@ -683,7 +683,7 @@ public final class TestHSSFWorkbook extends BaseTestWorkbook {
}
@Test
public void cellStylesLimit() throws IOException {
void cellStylesLimit() throws IOException {
try (Workbook wb = new HSSFWorkbook()) {
int numBuiltInStyles = wb.getNumCellStyles();
int MAX_STYLES = 4030;
@ -701,7 +701,7 @@ public final class TestHSSFWorkbook extends BaseTestWorkbook {
}
@Test
public void setSheetOrderHSSF() throws IOException{
void setSheetOrderHSSF() throws IOException{
Workbook wb = new HSSFWorkbook();
Sheet s1 = wb.createSheet("first sheet");
Sheet s2 = wb.createSheet("other sheet");
@ -762,7 +762,7 @@ public final class TestHSSFWorkbook extends BaseTestWorkbook {
}
@Test
public void clonePictures() throws IOException {
void clonePictures() throws IOException {
HSSFWorkbook wb = openSampleWorkbook("SimpleWithImages.xls");
InternalWorkbook iwb = wb.getWorkbook();
iwb.findDrawingGroup();
@ -789,14 +789,14 @@ public final class TestHSSFWorkbook extends BaseTestWorkbook {
// Should throw exception about invalid POIFSFileSystem
@Test
public void emptyDirectoryNode() throws IOException {
void emptyDirectoryNode() throws IOException {
try (POIFSFileSystem fs = new POIFSFileSystem()) {
assertThrows(IllegalArgumentException.class, () -> new HSSFWorkbook(fs).close());
}
}
@Test
public void selectedSheetShort() throws IOException {
void selectedSheetShort() throws IOException {
HSSFWorkbook wb=new HSSFWorkbook();
HSSFSheet sheet1 = wb.createSheet("Sheet1");
@ -830,7 +830,7 @@ public final class TestHSSFWorkbook extends BaseTestWorkbook {
}
@Test
public void names() throws IOException {
void names() throws IOException {
HSSFWorkbook wb=new HSSFWorkbook();
IllegalStateException ex1 = assertThrows(IllegalStateException.class, () -> wb.getNameAt(0));
@ -866,7 +866,7 @@ public final class TestHSSFWorkbook extends BaseTestWorkbook {
}
@Test
public void writeProtection() throws IOException {
void writeProtection() throws IOException {
HSSFWorkbook wb=new HSSFWorkbook();
assertFalse(wb.isWriteProtected());
@ -881,7 +881,7 @@ public final class TestHSSFWorkbook extends BaseTestWorkbook {
}
@Test
public void bug50298() throws Exception {
void bug50298() throws Exception {
HSSFWorkbook wb = openSampleWorkbook("50298.xls");
assertSheetOrder(wb, "Invoice", "Invoice1", "Digest", "Deferred", "Received");
@ -915,7 +915,7 @@ public final class TestHSSFWorkbook extends BaseTestWorkbook {
}
@Test
public void bug50298a() throws Exception {
void bug50298a() throws Exception {
HSSFWorkbook wb = openSampleWorkbook("50298.xls");
assertSheetOrder(wb, "Invoice", "Invoice1", "Digest", "Deferred", "Received");
@ -957,7 +957,7 @@ public final class TestHSSFWorkbook extends BaseTestWorkbook {
}
@Test
public void bug54500() throws Exception {
void bug54500() throws Exception {
String nameName = "AName";
String sheetName = "ASheet";
HSSFWorkbook wb = openSampleWorkbook("54500.xls");
@ -1092,7 +1092,7 @@ public final class TestHSSFWorkbook extends BaseTestWorkbook {
}
@Test
public void closeDoesNotModifyWorkbook() throws IOException {
void closeDoesNotModifyWorkbook() throws IOException {
final String filename = "SampleSS.xls";
final File file = samples.getFile(filename);
Workbook wb;
@ -1107,7 +1107,7 @@ public final class TestHSSFWorkbook extends BaseTestWorkbook {
}
@Test
public void setSheetOrderToEnd() throws Exception {
void setSheetOrderToEnd() throws Exception {
try (HSSFWorkbook workbook = new HSSFWorkbook()) {
workbook.createSheet("A");
workbook.createSheet("B");
@ -1118,7 +1118,7 @@ public final class TestHSSFWorkbook extends BaseTestWorkbook {
}
@Test
public void invalidInPlaceWrite() throws Exception {
void invalidInPlaceWrite() throws Exception {
// Can't work for new files
try (HSSFWorkbook wb = new HSSFWorkbook()) {
assertThrows(IllegalStateException.class, wb::write, "Shouldn't work for new files");
@ -1138,7 +1138,7 @@ public final class TestHSSFWorkbook extends BaseTestWorkbook {
}
@Test
public void inPlaceWrite() throws Exception {
void inPlaceWrite() throws Exception {
// Setup as a copy of a known-good file
final File file = TempFile.createTempFile("TestHSSFWorkbook", ".xls");
try (InputStream inputStream = samples.openResourceAsStream("SampleSS.xls");
@ -1183,7 +1183,7 @@ public final class TestHSSFWorkbook extends BaseTestWorkbook {
}
}
public void createDrawing() throws Exception {
void createDrawing() throws Exception {
// the dimensions for this image are different than for XSSF and SXSSF
}
}

View File

@ -140,7 +140,7 @@ public final class TestMatrixFormulasFromBinarySpreadsheet {
@ParameterizedTest
@MethodSource("data")
public void processFunctionRow(String targetFunctionName, int formulasRowIdx) {
void processFunctionRow(String targetFunctionName, int formulasRowIdx) {
int endColNum = Navigator.START_RESULT_COL_INDEX + Navigator.COL_OFF_EXPECTED_RESULT;

View File

@ -67,43 +67,43 @@ public final class TestCellReference {
}
@Test
public void testAbsRef2(){
void testAbsRef2(){
CellReference cf = new CellReference(4,1,true,true);
confirmCell(cf, null, 4, 1, true, true, "$B$5");
}
@Test
public void testAbsRef3(){
void testAbsRef3(){
CellReference cf = new CellReference("B$5");
confirmCell(cf, null, 4, 1, true, false, "B$5");
}
@Test
public void testAbsRef4(){
void testAbsRef4(){
CellReference cf = new CellReference(4,1,true,false);
confirmCell(cf, null, 4, 1, true, false, "B$5");
}
@Test
public void testAbsRef5(){
void testAbsRef5(){
CellReference cf = new CellReference("$B5");
confirmCell(cf, null, 4, 1, false, true, "$B5");
}
@Test
public void testAbsRef6(){
void testAbsRef6(){
CellReference cf = new CellReference(4,1,false,true);
confirmCell(cf, null, 4, 1, false, true, "$B5");
}
@Test
public void testAbsRef7(){
void testAbsRef7(){
CellReference cf = new CellReference("B5");
confirmCell(cf, null, 4, 1, false, false, "B5");
}
@Test
public void testAbsRef8(){
void testAbsRef8(){
CellReference cf = new CellReference(4,1,false,false);
confirmCell(cf, null, 4, 1, false, false, "B5");
}

View File

@ -77,7 +77,7 @@ public final class TestBiff8DecryptingStream {
* Used to 'skip over' the uninteresting middle bits of the key blocks.
* Also confirms that read position of the underlying stream is aligned.
*/
public void rollForward(int fromPosition, int toPosition) {
void rollForward(int fromPosition, int toPosition) {
assertEquals(fromPosition, _bds.getPosition());
for (int i = fromPosition; i < toPosition; i++) {
_bds.readByte();
@ -85,15 +85,15 @@ public final class TestBiff8DecryptingStream {
assertEquals(toPosition, _bds.getPosition());
}
public void confirmByte(int expVal) {
void confirmByte(int expVal) {
assertEquals(expVal, _bds.readUByte());
}
public void confirmShort(int expVal) {
void confirmShort(int expVal) {
assertEquals((short)expVal, _bds.readShort());
}
public void confirmUShort(int expVal) {
void confirmUShort(int expVal) {
assertEquals(expVal, _bds.readUShort());
}
@ -105,15 +105,15 @@ public final class TestBiff8DecryptingStream {
return _bds.readUShort();
}
public void confirmInt(int expVal) {
void confirmInt(int expVal) {
assertEquals(expVal, _bds.readInt());
}
public void confirmLong(long expVal) {
void confirmLong(long expVal) {
assertEquals(expVal, _bds.readLong());
}
public void confirmData(String expHexData) {
void confirmData(String expHexData) {
byte[] expData = HexRead.readFromString(expHexData);
byte[] actData = new byte[expData.length];
@ -126,7 +126,7 @@ public final class TestBiff8DecryptingStream {
* Tests reading of 64,32,16 and 8 bit integers aligned with key changing boundaries
*/
@Test
public void readsAlignedWithBoundary() {
void readsAlignedWithBoundary() {
StreamTester st = createStreamTester();
st.rollForward(0x0004, 0x03FF);
@ -156,7 +156,7 @@ public final class TestBiff8DecryptingStream {
* Tests reading of 64,32 and 16 bit integers <i>across</i> key changing boundaries
*/
@Test
public void readsSpanningBoundary() {
void readsSpanningBoundary() {
StreamTester st = createStreamTester();
st.rollForward(0x0004, 0x03FC);
@ -172,7 +172,7 @@ public final class TestBiff8DecryptingStream {
* and that the RC4 stream stays aligned during these calls
*/
@Test
public void readHeaderUShort() {
void readHeaderUShort() {
StreamTester st = createStreamTester();
st.rollForward(0x0004, 0x03FF);
@ -195,7 +195,7 @@ public final class TestBiff8DecryptingStream {
* Tests reading of byte sequences <i>across</i> and <i>aligned with</i> key changing boundaries
*/
@Test
public void readByteArrays() {
void readByteArrays() {
StreamTester st = createStreamTester();
st.rollForward(0x0004, 0x2FFC);

View File

@ -25,7 +25,7 @@ import org.junit.jupiter.api.Test;
public class TestCipherAlgorithm {
@Test
public void validInputs() {
void validInputs() {
assertEquals(128, CipherAlgorithm.aes128.defaultKeySize);
for(CipherAlgorithm alg : CipherAlgorithm.values()) {
@ -37,7 +37,7 @@ public class TestCipherAlgorithm {
}
@Test
public void invalidInputs() {
void invalidInputs() {
assertThrows(EncryptedDocumentException.class, () -> CipherAlgorithm.fromEcmaId(0));
assertThrows(EncryptedDocumentException.class, () -> CipherAlgorithm.fromXmlId("AES", 1));
assertThrows(EncryptedDocumentException.class, () -> CipherAlgorithm.fromXmlId("RC1", 0x40));

View File

@ -74,7 +74,7 @@ public class TestXorEncryption {
@Test
@Disabled("currently not supported")
public void encrypt() throws IOException {
void encrypt() throws IOException {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
try {
try (HSSFWorkbook hwb = HSSFTestDataSamples.openSampleWorkbook("SampleSS.xls")) {

View File

@ -32,7 +32,7 @@ import org.junit.jupiter.api.Test;
public class TestBinaryRC4 {
@Test
public void createKeyDigest() {
void createKeyDigest() {
byte[] docIdData = readFromString("17 F6 D1 6B 09 B1 5F 7B 4C 9D 03 B4 81 B5 B4 4A");
byte[] expResult = readFromString("C2 D9 56 B2 6B");

View File

@ -75,7 +75,7 @@ public class TestPOIFSDump {
};
@AfterEach
public void tearDown() throws IOException {
void tearDown() throws IOException {
// clean up the directory that POIFSDump writes to
deleteDirectory(new File(new File(TEST_FILE+"_dump").getName()));
}

View File

@ -46,7 +46,7 @@ public final class TestDocumentInputStream {
private static final int _buffer_size = 6;
@BeforeEach
public void setUp() throws Exception {
void setUp() throws Exception {
int blocks = (_workbook_size + 511) / 512;
_workbook_data = new byte[512 * blocks];

View File

@ -43,7 +43,7 @@ public final class TestFileSystemBugs {
private List<POIFSFileSystem> openedFSs;
@AfterEach
public void tearDown() {
void tearDown() {
if (openedFSs != null && !openedFSs.isEmpty()) {
for (POIFSFileSystem fs : openedFSs) {
try {

View File

@ -47,7 +47,7 @@ public final class TestFilteringDirectoryNode {
private DocumentEntry eAA;
@BeforeEach
public void setUp() throws Exception {
void setUp() throws Exception {
fs = new POIFSFileSystem();
dirA = fs.createDirectory("DirA");
dirB = fs.createDirectory("DirB");

View File

@ -1183,7 +1183,7 @@ public final class TestPOIFSStream {
}
@Test
public void basicOpen() throws IOException {
void basicOpen() throws IOException {
POIFSFileSystem fsA, fsB;
// With a simple 512 block file
@ -1206,7 +1206,7 @@ public final class TestPOIFSStream {
}
@Test
public void propertiesAndFatOnRead() throws IOException {
void propertiesAndFatOnRead() throws IOException {
POIFSFileSystem fsA, fsB;
// With a simple 512 block file
@ -1341,7 +1341,7 @@ public final class TestPOIFSStream {
* out what the next one is
*/
@Test
public void nextBlock() throws IOException {
void nextBlock() throws IOException {
POIFSFileSystem fsA = new POIFSFileSystem(_inst.getFile("BlockSize512.zvi"));
POIFSFileSystem fsB = new POIFSFileSystem(_inst.openResourceAsStream("BlockSize512.zvi"));
for (POIFSFileSystem fs : new POIFSFileSystem[]{fsA, fsB}) {
@ -1403,7 +1403,7 @@ public final class TestPOIFSStream {
* Check we get the right data back for each block
*/
@Test
public void getBlock() throws IOException {
void getBlock() throws IOException {
POIFSFileSystem fsA = new POIFSFileSystem(_inst.getFile("BlockSize512.zvi"));
POIFSFileSystem fsB = new POIFSFileSystem(_inst.openResourceAsStream("BlockSize512.zvi"));
for (POIFSFileSystem fs : new POIFSFileSystem[]{fsA, fsB}) {
@ -1477,7 +1477,7 @@ public final class TestPOIFSStream {
* to be had from the FAT
*/
@Test
public void getFreeBlockWithSpare() throws IOException {
void getFreeBlockWithSpare() throws IOException {
POIFSFileSystem fs = new POIFSFileSystem(_inst.getFile("BlockSize512.zvi"));
// Our first BAT block has spares
@ -1508,7 +1508,7 @@ public final class TestPOIFSStream {
* file needs to be extended and another BAT/XBAT added
*/
@Test
public void getFreeBlockWithNoneSpare() throws IOException {
void getFreeBlockWithNoneSpare() throws IOException {
POIFSFileSystem fs1 = new POIFSFileSystem(_inst.openResourceAsStream("BlockSize512.zvi"));
int free;
@ -1637,7 +1637,7 @@ public final class TestPOIFSStream {
* entries, and the details on the files in them
*/
@Test
public void listEntries() throws IOException {
void listEntries() throws IOException {
for (POIFSFileSystem fs : get512and4kFileAndInput()) {
DirectoryEntry root = fs.getRoot();
assertEquals(5, root.getEntryCount());
@ -1676,7 +1676,7 @@ public final class TestPOIFSStream {
* a document in the filesystem
*/
@Test
public void getDocumentEntry() throws Exception {
void getDocumentEntry() throws Exception {
for (POIFSFileSystem fs : get512and4kFileAndInput()) {
DirectoryEntry root = fs.getRoot();
Entry si = root.getEntry("\u0005SummaryInformation");
@ -1722,7 +1722,7 @@ public final class TestPOIFSStream {
* Then, alter+add some streams, write and read
*/
@Test
public void readWriteRead() throws Exception {
void readWriteRead() throws Exception {
SummaryInformation sinf;
DocumentSummaryInformation dinf;
DirectoryEntry root, testDir;
@ -1996,7 +1996,7 @@ public final class TestPOIFSStream {
* Then, add some streams, write and read
*/
@Test
public void createWriteRead() throws IOException {
void createWriteRead() throws IOException {
POIFSFileSystem fs1 = new POIFSFileSystem();
DocumentEntry miniDoc;
DocumentEntry normDoc;
@ -2239,7 +2239,7 @@ public final class TestPOIFSStream {
}
@Test
public void addBeforeWrite() throws IOException {
void addBeforeWrite() throws IOException {
POIFSFileSystem fs1 = new POIFSFileSystem();
DocumentEntry miniDoc;
DocumentEntry normDoc;
@ -2392,7 +2392,7 @@ public final class TestPOIFSStream {
}
@Test
public void readZeroLengthEntries() throws IOException {
void readZeroLengthEntries() throws IOException {
POIFSFileSystem fs = new POIFSFileSystem(_inst.getFile("only-zero-byte-streams.ole2"));
DirectoryNode testDir = fs.getRoot();
assertEquals(3, testDir.getEntryCount());
@ -2423,7 +2423,7 @@ public final class TestPOIFSStream {
}
@Test
public void writeZeroLengthEntries() throws IOException {
void writeZeroLengthEntries() throws IOException {
POIFSFileSystem fs1 = new POIFSFileSystem();
DirectoryNode testDir = fs1.getRoot();
DocumentEntry miniDoc;
@ -2526,7 +2526,7 @@ public final class TestPOIFSStream {
* write it out, read it with POIFS, and see the original data
*/
@Test
public void POIFSReadCopyWritePOIFSRead() throws IOException {
void POIFSReadCopyWritePOIFSRead() throws IOException {
File testFile = POIDataSamples.getSpreadSheetInstance().getFile("Simple.xls");
POIFSFileSystem src = new POIFSFileSystem(testFile);
byte[] wbDataExp = IOUtils.toByteArray(src.createDocumentInputStream("Workbook"));
@ -2551,7 +2551,7 @@ public final class TestPOIFSStream {
* contents
*/
@Test
public void RecursiveDelete() throws IOException {
void RecursiveDelete() throws IOException {
File testFile = POIDataSamples.getSpreadSheetInstance().getFile("SimpleMacro.xls");
POIFSFileSystem src = new POIFSFileSystem(testFile);
@ -2619,7 +2619,7 @@ public final class TestPOIFSStream {
*/
@Test
@Disabled("Work in progress test for #60670")
public void creationAndExtensionPast2GB() throws Exception {
void creationAndExtensionPast2GB() throws Exception {
File big = TempFile.createTempFile("poi-test-", ".ole2");
assumeTrue(big.getFreeSpace() > 2.5 * 1024 * 1024 * 1024,
"2.5gb of free space is required on your tmp/temp partition/disk to run large file tests");
@ -2739,7 +2739,7 @@ public final class TestPOIFSStream {
@Disabled("Takes a long time to run")
@Test
public void performance() throws Exception {
void performance() throws Exception {
int iterations = 200;//1_000;
System.out.println("NPOI:");

View File

@ -76,95 +76,95 @@ public class TestVBAMacroReader {
//////////////////////////////// From Stream /////////////////////////////
@Test
public void HSSFFromStream() throws Exception {
void HSSFFromStream() throws Exception {
fromStream(POIDataSamples.getSpreadSheetInstance(), "SimpleMacro.xls");
}
@Test
public void XSSFFromStream() throws Exception {
void XSSFFromStream() throws Exception {
fromStream(POIDataSamples.getSpreadSheetInstance(), "SimpleMacro.xlsm");
}
@Disabled("bug 59302: Found 0 macros; See org.apache.poi.hslf.usermodel.TestBugs.getMacrosFromHSLF()" +
"for an example of how to get macros out of ppt. TODO: make integration across file formats more elegant")
@Test
public void HSLFFromStream() throws Exception {
void HSLFFromStream() throws Exception {
fromStream(POIDataSamples.getSlideShowInstance(), "SimpleMacro.ppt");
}
@Test
public void XSLFFromStream() throws Exception {
void XSLFFromStream() throws Exception {
fromStream(POIDataSamples.getSlideShowInstance(), "SimpleMacro.pptm");
}
@Test
public void HWPFFromStream() throws Exception {
void HWPFFromStream() throws Exception {
fromStream(POIDataSamples.getDocumentInstance(), "SimpleMacro.doc");
}
@Test
public void XWPFFromStream() throws Exception {
void XWPFFromStream() throws Exception {
fromStream(POIDataSamples.getDocumentInstance(), "SimpleMacro.docm");
}
@Disabled("Found 0 macros")
@Test
public void HDGFFromStream() throws Exception {
void HDGFFromStream() throws Exception {
fromStream(POIDataSamples.getDiagramInstance(), "SimpleMacro.vsd");
}
@Test
public void XDGFFromStream() throws Exception {
void XDGFFromStream() throws Exception {
fromStream(POIDataSamples.getDiagramInstance(), "SimpleMacro.vsdm");
}
//////////////////////////////// From File /////////////////////////////
@Test
public void HSSFFromFile() throws Exception {
void HSSFFromFile() throws Exception {
fromFile(POIDataSamples.getSpreadSheetInstance(), "SimpleMacro.xls");
}
@Test
public void XSSFFromFile() throws Exception {
void XSSFFromFile() throws Exception {
fromFile(POIDataSamples.getSpreadSheetInstance(), "SimpleMacro.xlsm");
}
@Disabled("bug 59302: Found 0 macros; See org.apache.poi.hslf.usermodel.TestBugs.getMacrosFromHSLF()" +
"for an example of how to get macros out of ppt. TODO: make integration across file formats more elegant")
@Test
public void HSLFFromFile() throws Exception {
void HSLFFromFile() throws Exception {
fromFile(POIDataSamples.getSlideShowInstance(), "SimpleMacro.ppt");
}
@Test
public void XSLFFromFile() throws Exception {
void XSLFFromFile() throws Exception {
fromFile(POIDataSamples.getSlideShowInstance(), "SimpleMacro.pptm");
}
@Test
public void HWPFFromFile() throws Exception {
void HWPFFromFile() throws Exception {
fromFile(POIDataSamples.getDocumentInstance(), "SimpleMacro.doc");
}
@Test
public void XWPFFromFile() throws Exception {
void XWPFFromFile() throws Exception {
fromFile(POIDataSamples.getDocumentInstance(), "SimpleMacro.docm");
}
@Disabled("Found 0 macros")
@Test
public void HDGFFromFile() throws Exception {
void HDGFFromFile() throws Exception {
fromFile(POIDataSamples.getDiagramInstance(), "SimpleMacro.vsd");
}
@Test
public void XDGFFromFile() throws Exception {
void XDGFFromFile() throws Exception {
fromFile(POIDataSamples.getDiagramInstance(), "SimpleMacro.vsdm");
}
//////////////////////////////// From POIFS /////////////////////////////
@Test
public void HSSFFromPOIFS() throws Exception {
void HSSFFromPOIFS() throws Exception {
fromPOIFS(POIDataSamples.getSpreadSheetInstance(), "SimpleMacro.xls");
}
@Disabled("bug 59302: Found 0 macros")
@Test
public void HSLFFromPOIFS() throws Exception {
void HSLFFromPOIFS() throws Exception {
fromPOIFS(POIDataSamples.getSlideShowInstance(), "SimpleMacro.ppt");
}
@Test
public void HWPFFromPOIFS() throws Exception {
void HWPFFromPOIFS() throws Exception {
fromPOIFS(POIDataSamples.getDocumentInstance(), "SimpleMacro.doc");
}
@Disabled("Found 0 macros")
@Test
public void HDGFFromPOIFS() throws Exception {
void HDGFFromPOIFS() throws Exception {
fromPOIFS(POIDataSamples.getDiagramInstance(), "SimpleMacro.vsd");
}
@ -230,7 +230,7 @@ public class TestVBAMacroReader {
}
@Test
public void bug59830() throws IOException {
void bug59830() throws IOException {
//test file is "609751.xls" in govdocs1
File f = POIDataSamples.getSpreadSheetInstance().getFile("59830.xls");
VBAMacroReader r = new VBAMacroReader(f);
@ -242,7 +242,7 @@ public class TestVBAMacroReader {
}
@Test
public void bug59858() throws IOException {
void bug59858() throws IOException {
File f = POIDataSamples.getSpreadSheetInstance().getFile("59858.xls");
VBAMacroReader r = new VBAMacroReader(f);
Map<String, String> macros = r.readMacros();
@ -253,7 +253,7 @@ public class TestVBAMacroReader {
}
@Test
public void bug60158() throws IOException {
void bug60158() throws IOException {
File f = POIDataSamples.getDocumentInstance().getFile("60158.docm");
VBAMacroReader r = new VBAMacroReader(f);
Map<String, String> macros = r.readMacros();
@ -264,7 +264,7 @@ public class TestVBAMacroReader {
}
@Test
public void bug60273() throws IOException {
void bug60273() throws IOException {
//test file derives from govdocs1 147240.xls
File f = POIDataSamples.getSpreadSheetInstance().getFile("60273.xls");
VBAMacroReader r = new VBAMacroReader(f);
@ -276,7 +276,7 @@ public class TestVBAMacroReader {
}
@Test
public void bug60279() throws IOException {
void bug60279() throws IOException {
File f = POIDataSamples.getDocumentInstance().getFile("60279.doc");
VBAMacroReader r = new VBAMacroReader(f);
Map<String, String> macros = r.readMacros();
@ -288,7 +288,7 @@ public class TestVBAMacroReader {
}
@Test
public void bug62624() throws IOException {
void bug62624() throws IOException {
//macro comes from Common Crawl: HRLOXHGMGLFIJQQU27RIWXOARRHAAAAS
File f = POIDataSamples.getSpreadSheetInstance().getFile("62624.bin");
VBAMacroReader r = new VBAMacroReader(f);
@ -302,7 +302,7 @@ public class TestVBAMacroReader {
}
@Test
public void bug62625() throws IOException {
void bug62625() throws IOException {
//macro comes from Common Crawl: 4BZ22N5QG5R2SUU2MNN47PO7VBQLNYIQ
//A REFERENCE_NAME can sometimes only have an ascii string without
//a reserved byte followed by the unicode string.

View File

@ -44,35 +44,20 @@ import org.junit.jupiter.api.Test;
*/
public final class TestPropertyTable {
private static class MyPOIFSStream extends POIFSStream {
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
MyPOIFSStream() {
super(null);
}
public void write(byte[] b, int off, int len) {
bos.write(b, off, len);
}
@Override
public OutputStream getOutputStream() {
return bos;
}
}
private static void confirmBlockEncoding(String expectedDataStr, PropertyTable table) throws IOException {
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
byte[] expectedData = RawDataUtil.decompress(expectedDataStr);
MyPOIFSStream stream = new MyPOIFSStream();
try {
table.write(stream);
} catch (IOException e) {
throw new RuntimeException(e);
}
byte[] output = stream.bos.toByteArray();
assertArrayEquals(expectedData, output);
POIFSStream stream = new POIFSStream(null) {
@Override
public OutputStream getOutputStream() {
return bos;
}
};
table.write(stream);
assertArrayEquals(expectedData, bos.toByteArray());
}
/**
@ -93,7 +78,7 @@ public final class TestPropertyTable {
void testWriterPropertyTable() throws IOException {
// create the PropertyTable
HeaderBlock headerBlock = new HeaderBlock(POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS);
HeaderBlock headerBlock = new HeaderBlock(POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS);
PropertyTable table = new PropertyTable(headerBlock);
// create three DocumentProperty instances and add them to the

View File

@ -47,7 +47,7 @@ public abstract class BaseTestSlideShow<
public abstract SlideShow<S,P> reopen(SlideShow<S,P> show) throws IOException;
@Test
public void addPicture_File() throws IOException {
void addPicture_File() throws IOException {
SlideShow<S,P> show = createSlideShow();
File f = slTests.getFile("clock.jpg");
@ -60,7 +60,7 @@ public abstract class BaseTestSlideShow<
}
@Test
public void addPicture_Stream() throws IOException {
void addPicture_Stream() throws IOException {
try (SlideShow<S,P> show = createSlideShow();
InputStream stream = slTests.openResourceAsStream("clock.jpg")) {
assertEquals(0, show.getPictureData().size());
@ -71,7 +71,7 @@ public abstract class BaseTestSlideShow<
}
@Test
public void addPicture_ByteArray() throws IOException {
void addPicture_ByteArray() throws IOException {
SlideShow<S,P> show = createSlideShow();
byte[] data = slTests.readFile("clock.jpg");
@ -84,7 +84,7 @@ public abstract class BaseTestSlideShow<
}
@Test
public void findPicture() throws IOException {
void findPicture() throws IOException {
SlideShow<S,P> show = createSlideShow();
byte[] data = slTests.readFile("clock.jpg");
@ -98,7 +98,7 @@ public abstract class BaseTestSlideShow<
}
@Test
public void addTabStops() throws IOException {
void addTabStops() throws IOException {
try (final SlideShow<S,P> show1 = createSlideShow()) {
// first set the TabStops in the Master sheet
final MasterSheet<S,P> master1 = show1.getSlideMasters().get(0);
@ -158,7 +158,7 @@ public abstract class BaseTestSlideShow<
}
@Test
public void shapeAndSlideName() throws IOException {
void shapeAndSlideName() throws IOException {
final String file = "SampleShow.ppt"+(getClass().getSimpleName().contains("XML")?"x":"");
//noinspection unchecked
try (final InputStream is = slTests.openResourceAsStream(file);
@ -178,7 +178,7 @@ public abstract class BaseTestSlideShow<
}
@Test
public void addFont() throws IOException {
void addFont() throws IOException {
try (SlideShow<S,P> ppt = createSlideShow()) {
ppt.createSlide();
try (InputStream fontData = slTests.openResourceAsStream("font.fntdata")) {

View File

@ -136,7 +136,7 @@ public abstract class BaseTestExternalFunctions {
* @param testFile either atp.xls or atp.xlsx
*/
@Test
public void baseTestInvokeATP() throws IOException {
void baseTestInvokeATP() throws IOException {
Workbook wb = _testDataProvider.openSampleWorkbook(atpFile);
FormulaEvaluator evaluator = wb.getCreationHelper().createFormulaEvaluator();

View File

@ -55,7 +55,7 @@ public abstract class BaseTestMissingWorkbook {
}
@BeforeEach
public void setUp() throws Exception {
protected void setUp() throws Exception {
mainWorkbook = HSSFTestDataSamples.openSampleWorkbook(MAIN_WORKBOOK_FILENAME);
sourceWorkbook = HSSFTestDataSamples.openSampleWorkbook(SOURCE_WORKBOOK_FILENAME);
@ -64,7 +64,7 @@ public abstract class BaseTestMissingWorkbook {
}
@AfterEach
public void tearDown() throws Exception {
void tearDown() throws Exception {
if(mainWorkbook != null) {
mainWorkbook.close();
}

View File

@ -23,42 +23,42 @@ import org.junit.jupiter.api.Test;
public class SheetRangeAndWorkbookIndexFormatterTest {
@Test
public void noDelimiting_ifASingleSheetNameDoesntNeedDelimiting() {
void noDelimiting_ifASingleSheetNameDoesntNeedDelimiting() {
StringBuilder sb = new StringBuilder();
String result = SheetRangeAndWorkbookIndexFormatter.format(sb, 0, "noDelimiting", null);
assertEquals("[0]noDelimiting", result);
}
@Test
public void everythingIsScreened_ifASingleSheetNameNeedsDelimiting() {
void everythingIsScreened_ifASingleSheetNameNeedsDelimiting() {
StringBuilder sb = new StringBuilder();
String result = SheetRangeAndWorkbookIndexFormatter.format(sb, 0, "1delimiting", null);
assertEquals("'[0]1delimiting'", result);
}
@Test
public void noDelimiting_ifBothSheetNamesDontNeedDelimiting() {
void noDelimiting_ifBothSheetNamesDontNeedDelimiting() {
StringBuilder sb = new StringBuilder();
String result = SheetRangeAndWorkbookIndexFormatter.format(sb, 0, "noDelimiting1", "noDelimiting2");
assertEquals("[0]noDelimiting1:noDelimiting2", result);
}
@Test
public void everythingIsScreened_ifFirstSheetNamesNeedsDelimiting() {
void everythingIsScreened_ifFirstSheetNamesNeedsDelimiting() {
StringBuilder sb = new StringBuilder();
String result = SheetRangeAndWorkbookIndexFormatter.format(sb, 0, "1delimiting", "noDelimiting");
assertEquals("'[0]1delimiting:noDelimiting'", result);
}
@Test
public void everythingIsScreened_ifLastSheetNamesNeedsDelimiting() {
void everythingIsScreened_ifLastSheetNamesNeedsDelimiting() {
StringBuilder sb = new StringBuilder();
String result = SheetRangeAndWorkbookIndexFormatter.format(sb, 0, "noDelimiting", "1delimiting");
assertEquals("'[0]noDelimiting:1delimiting'", result);
}
@Test
public void everythingIsScreened_ifBothSheetNamesNeedDelimiting() {
void everythingIsScreened_ifBothSheetNamesNeedDelimiting() {
StringBuilder sb = new StringBuilder();
String result = SheetRangeAndWorkbookIndexFormatter.format(sb, 0, "1delimiting", "2delimiting");
assertEquals("'[0]1delimiting:2delimiting'", result);

View File

@ -51,7 +51,7 @@ public class TestFunctionRegistry {
HSSFFormulaEvaluator fe;
@BeforeEach
public void setup() {
void setup() {
wb = new HSSFWorkbook();
sheet = wb.createSheet("Sheet1");
row = sheet.createRow(0);
@ -59,7 +59,7 @@ public class TestFunctionRegistry {
}
@AfterEach
public void teardown() throws IOException {
void teardown() throws IOException {
wb.close();
wb = null;
sheet = null;

View File

@ -41,7 +41,7 @@ public class TestRandBetween {
private Cell formulaCell;
@BeforeEach
public void setUp() throws Exception {
void setUp() {
Workbook wb = HSSFTestDataSamples.openSampleWorkbook("TestRandBetween.xls");
evaluator = wb.getCreationHelper().createFormulaEvaluator();

View File

@ -151,7 +151,7 @@ public final class TestFormulasFromSpreadsheet {
@ParameterizedTest
@MethodSource("data")
public void processFunctionRow(String targetFunctionName, int formulasRowIdx, int expectedValuesRowIdx) {
void processFunctionRow(String targetFunctionName, int formulasRowIdx, int expectedValuesRowIdx) {
Row formulasRow = sheet.getRow(formulasRowIdx);
Row expectedValuesRow = sheet.getRow(expectedValuesRowIdx);

View File

@ -133,7 +133,7 @@ public abstract class BaseTestFunctionsFromSpreadsheet {
@ParameterizedTest
@MethodSource("data")
public void processFunctionRow(
void processFunctionRow(
String testName, String filename, HSSFSheet sheet, int formulasRowIdx, HSSFFormulaEvaluator evaluator, int precisionColumnIndex
) throws Exception {
HSSFRow r = sheet.getRow(formulasRowIdx);

View File

@ -37,7 +37,7 @@ public final class TestCalendarFieldFunction {
private HSSFFormulaEvaluator evaluator;
@BeforeEach
public void setUp() {
void setUp() {
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet("new sheet");
cell11 = sheet.createRow(0).createCell(0);

View File

@ -38,7 +38,7 @@ public final class TestDate {
private HSSFFormulaEvaluator evaluator;
@BeforeEach
public void setUp() {
void setUp() {
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet("new sheet");
cell11 = sheet.createRow(0).createCell(0);

View File

@ -94,7 +94,7 @@ public class TestEOMonth {
}
@Test
public void checkOffset() {
void checkOffset() {
for (int offset=-12; offset<=12; offset++) {
Calendar cal = LocaleUtil.getLocaleCalendar();
Date startDate = cal.getTime();

View File

@ -43,7 +43,7 @@ public final class TestFixed {
private HSSFFormulaEvaluator evaluator;
@BeforeEach
public void setUp() throws IOException {
void setUp() throws IOException {
try (HSSFWorkbook wb = new HSSFWorkbook()) {
HSSFSheet sheet = wb.createSheet("new sheet");
cell11 = sheet.createRow(0).createCell(0);

View File

@ -41,7 +41,7 @@ import org.junit.jupiter.api.Test;
*/
public class TestGeomean {
@Test
public void acceptanceTest() {
void acceptanceTest() {
Function geomean = getInstance();
final ValueEval result = geomean.evaluate(new ValueEval[]{new NumberEval(2), new NumberEval(3)}, 0, 0);
@ -49,35 +49,35 @@ public class TestGeomean {
}
@Test
public void booleansByValueAreCoerced() {
void booleansByValueAreCoerced() {
final ValueEval[] args = {BoolEval.TRUE};
final ValueEval result = getInstance().evaluate(args, 0, 0);
verifyNumericResult(1.0, result);
}
@Test
public void stringsByValueAreCoerced() {
void stringsByValueAreCoerced() {
final ValueEval[] args = {new StringEval("2")};
final ValueEval result = getInstance().evaluate(args, 0, 0);
verifyNumericResult(2.0, result);
}
@Test
public void nonCoerceableStringsByValueCauseValueInvalid() {
void nonCoerceableStringsByValueCauseValueInvalid() {
final ValueEval[] args = {new StringEval("foo")};
final ValueEval result = getInstance().evaluate(args, 0, 0);
assertEquals(ErrorEval.VALUE_INVALID, result);
}
@Test
public void booleansByReferenceAreSkipped() {
void booleansByReferenceAreSkipped() {
final ValueEval[] args = new ValueEval[]{new NumberEval(2.0), EvalFactory.createRefEval("A1", BoolEval.TRUE)};
final ValueEval result = getInstance().evaluate(args, 0, 0);
verifyNumericResult(2.0, result);
}
@Test
public void booleansStringsAndBlanksByReferenceAreSkipped() {
void booleansStringsAndBlanksByReferenceAreSkipped() {
ValueEval ref = EvalFactory.createAreaEval("A1:A3", new ValueEval[]{new StringEval("foo"), BoolEval.FALSE, BlankEval.instance});
final ValueEval[] args = {ref, new NumberEval(2.0)};
final ValueEval result = getInstance().evaluate(args, 0, 0);
@ -85,14 +85,14 @@ public class TestGeomean {
}
@Test
public void stringsByValueAreCounted() {
void stringsByValueAreCounted() {
final ValueEval[] args = {new StringEval("2.0")};
final ValueEval result = getInstance().evaluate(args, 0, 0);
verifyNumericResult(2.0, result);
}
@Test
public void missingArgCountAsZero() {
void missingArgCountAsZero() {
// and, naturally, produces a NUM_ERROR
final ValueEval[] args = {new NumberEval(1.0), MissingArgEval.instance};
final ValueEval result = getInstance().evaluate(args, 0, 0);
@ -103,21 +103,21 @@ public class TestGeomean {
* Implementation-specific: the math lib returns 0 for the input [1.0, 0.0], but a NUM_ERROR should be returned.
*/
@Test
public void sequence_1_0_shouldReturnError() {
void sequence_1_0_shouldReturnError() {
final ValueEval[] args = {new NumberEval(1.0), new NumberEval(0)};
final ValueEval result = getInstance().evaluate(args, 0, 0);
assertEquals(ErrorEval.NUM_ERROR, result);
}
@Test
public void minusOneShouldReturnError() {
void minusOneShouldReturnError() {
final ValueEval[] args = {new NumberEval(1.0), new NumberEval(-1.0)};
final ValueEval result = getInstance().evaluate(args, 0, 0);
assertEquals(ErrorEval.NUM_ERROR, result);
}
@Test
public void firstErrorPropagates() {
void firstErrorPropagates() {
final ValueEval[] args = {ErrorEval.DIV_ZERO, ErrorEval.NUM_ERROR};
final ValueEval result = getInstance().evaluate(args, 0, 0);
assertEquals(ErrorEval.DIV_ZERO, result);

View File

@ -45,7 +45,7 @@ public class TestLogicalFunction {
private Cell cell2;
@BeforeEach
public void setUp() throws IOException {
void setUp() throws IOException {
try (Workbook wb = new HSSFWorkbook()) {
buildWorkbook(wb);
}

View File

@ -42,7 +42,7 @@ public class TestMultiOperandNumericFunction {
}
@Test
public void missingArgEvalsAreCountedAsZeroIfPolicyIsCoerce() {
void missingArgEvalsAreCountedAsZeroIfPolicyIsCoerce() {
MultiOperandNumericFunction instance = new Stub(true, true, MultiOperandNumericFunction.Policy.COERCE);
ValueEval result = instance.evaluate(new ValueEval[]{MissingArgEval.instance}, 0, 0);
assertTrue(result instanceof NumberEval);
@ -50,7 +50,7 @@ public class TestMultiOperandNumericFunction {
}
@Test
public void missingArgEvalsAreSkippedIfZeroIfPolicyIsSkipped() {
void missingArgEvalsAreSkippedIfZeroIfPolicyIsSkipped() {
MultiOperandNumericFunction instance = new Stub(true, true, MultiOperandNumericFunction.Policy.SKIP);
ValueEval result = instance.evaluate(new ValueEval[]{new NumberEval(1), MissingArgEval.instance}, 0, 0);
assertTrue(result instanceof NumberEval);

View File

@ -28,7 +28,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
public class TestProduct {
@Test
public void missingArgsAreIgnored() {
void missingArgsAreIgnored() {
ValueEval result = getInstance().evaluate(new ValueEval[]{new NumberEval(2.0), MissingArgEval.instance}, 0, 0);
assertTrue(result instanceof NumberEval);
assertEquals(2, ((NumberEval)result).getNumberValue(), 0);
@ -39,21 +39,22 @@ public class TestProduct {
* However, PRODUCT(,) is a valid call (which should return 0). So it makes sense to
* assert that PRODUCT() is also 0 (at least, nothing explodes).
*/
public void missingArgEvalReturns0() {
@Test
void missingArgEvalReturns0() {
ValueEval result = getInstance().evaluate(new ValueEval[0], 0, 0);
assertTrue(result instanceof NumberEval);
assertEquals(0, ((NumberEval)result).getNumberValue(), 0);
}
@Test
public void twoMissingArgEvalsReturn0() {
void twoMissingArgEvalsReturn0() {
ValueEval result = getInstance().evaluate(new ValueEval[]{MissingArgEval.instance, MissingArgEval.instance}, 0, 0);
assertTrue(result instanceof NumberEval);
assertEquals(0, ((NumberEval)result).getNumberValue(), 0);
}
@Test
public void acceptanceTest() {
void acceptanceTest() {
final ValueEval[] args = {
new NumberEval(2.0),
MissingArgEval.instance,

View File

@ -46,7 +46,7 @@ public final class TestTime {
private HSSFCellStyle style;
@BeforeEach
public void setUp() {
void setUp() {
wb = new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet("new sheet");
style = wb.createCellStyle();

View File

@ -35,7 +35,7 @@ public final class TestAreaPtg {
AreaPtg absolute;
@BeforeEach
public void setUp() {
void setUp() {
short firstRow=5;
short lastRow=13;
short firstCol=7;

View File

@ -26,12 +26,12 @@ public class TestAggregatingUDFFinder extends BaseTestUDFFinder {
}
@Test
public void findFunction() {
void findFunction() {
confirmFindFunction("BESSELJ");
}
@Test
public void add() {
void add() {
((AggregatingUDFFinder)_instance).add(AnalysisToolPak.instance);
}
}

View File

@ -29,7 +29,7 @@ public class TestDefaultUDFFinder extends BaseTestUDFFinder {
}
@Test
public void findFunction() {
void findFunction() {
confirmFindFunction("NotImplemented");
}
}

View File

@ -143,7 +143,7 @@ public abstract class BaseTestBugzillaIssues {
* Merged regions were being removed from the parent in cloned sheets
*/
@Test
public void bug22720() throws IOException {
protected void bug22720() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
wb.createSheet("TEST");
Sheet template = wb.getSheetAt(0);
@ -276,7 +276,7 @@ public abstract class BaseTestBugzillaIssues {
}
@Test
public void bug18800() throws IOException {
protected void bug18800() throws IOException {
try (Workbook wb1 = _testDataProvider.createWorkbook()) {
wb1.createSheet("TEST");
Sheet sheet = wb1.cloneSheet(0);
@ -307,7 +307,7 @@ public abstract class BaseTestBugzillaIssues {
}
@Test
public void bug43093() throws IOException {
void bug43093() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
addNewSheetWithCellsA1toD4(wb, 1);
@ -329,7 +329,7 @@ public abstract class BaseTestBugzillaIssues {
}
@Test
public void bug46729_testMaxFunctionArguments() throws IOException {
protected void bug46729_testMaxFunctionArguments() throws IOException {
String[] func = {"COUNT", "AVERAGE", "MAX", "MIN", "OR", "SUBTOTAL", "SKEW"};
SpreadsheetVersion ssVersion = _testDataProvider.getSpreadsheetVersion();
@ -524,7 +524,7 @@ public abstract class BaseTestBugzillaIssues {
* CreateFreezePane column/row order check
*/
@Test
public void bug49381() throws IOException {
void bug49381() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
int colSplit = 1;
int rowSplit = 2;
@ -578,7 +578,7 @@ public abstract class BaseTestBugzillaIssues {
* open resulting file in excel, and check that there is a link to Google
*/
@Test
public void bug15353() throws IOException {
void bug15353() throws IOException {
String hyperlinkF = "HYPERLINK(\"http://google.com\",\"Google\")";
try (Workbook wb1 = _testDataProvider.createWorkbook()) {
@ -604,7 +604,7 @@ public abstract class BaseTestBugzillaIssues {
* HLookup and VLookup with optional arguments
*/
@Test
public void bug51024() throws IOException {
void bug51024() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
Sheet s = wb.createSheet();
Row r1 = s.createRow(0);
@ -640,7 +640,7 @@ public abstract class BaseTestBugzillaIssues {
}
@Test
public void stackoverflow23114397() throws IOException {
void stackoverflow23114397() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
DataFormat format = wb.getCreationHelper().createDataFormat();
@ -709,7 +709,7 @@ public abstract class BaseTestBugzillaIssues {
* =ISNUMBER(SEARCH("AM",A1)) evaluation
*/
@Test
public void stackoverflow26437323() throws IOException {
void stackoverflow26437323() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
Sheet s = wb.createSheet();
Row r1 = s.createRow(0);
@ -866,7 +866,7 @@ public abstract class BaseTestBugzillaIssues {
*/
@Disabled("Fix this to evaluate for XSSF, Fix this to work at all for HSSF")
@Test
public void bug46670() throws IOException {
void bug46670() throws IOException {
try (Workbook wb1 = _testDataProvider.createWorkbook()) {
Sheet s = wb1.createSheet();
Row r1 = s.createRow(0);
@ -981,7 +981,7 @@ public abstract class BaseTestBugzillaIssues {
* that it now is again
*/
@Test
public void bug48718() throws IOException {
void bug48718() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
int startingFonts = wb instanceof HSSFWorkbook ? 4 : 1;
@ -1004,7 +1004,7 @@ public abstract class BaseTestBugzillaIssues {
}
@Test
public void bug57430() throws IOException {
void bug57430() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
wb.createSheet("Sheet1");
@ -1015,7 +1015,7 @@ public abstract class BaseTestBugzillaIssues {
}
@Test
public void bug56981() throws IOException {
void bug56981() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
CellStyle vertTop = wb.createCellStyle();
vertTop.setVerticalAlignment(VerticalAlignment.TOP);
@ -1098,7 +1098,7 @@ public abstract class BaseTestBugzillaIssues {
* kind of value from a Formula cell
*/
@Test
public void bug47815() throws IOException {
protected void bug47815() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
Sheet s = wb.createSheet();
Row r = s.createRow(0);
@ -1186,7 +1186,7 @@ public abstract class BaseTestBugzillaIssues {
* Mid in it, can give #VALUE in Excel
*/
@Test
public void bug55747() throws IOException {
void bug55747() throws IOException {
try (Workbook wb1 = _testDataProvider.createWorkbook()) {
FormulaEvaluator ev = wb1.getCreationHelper().createFormulaEvaluator();
Sheet s = wb1.createSheet();
@ -1249,7 +1249,7 @@ public abstract class BaseTestBugzillaIssues {
}
@Test
public void bug58260() throws IOException {
void bug58260() throws IOException {
//Create workbook and worksheet
try (Workbook wb = _testDataProvider.createWorkbook()) {
//Sheet worksheet = wb.createSheet("sample");
@ -1443,7 +1443,7 @@ public abstract class BaseTestBugzillaIssues {
@Disabled("bug 59393")
@Test
public void bug59393_commentsCanHaveSameAnchor() throws IOException {
void bug59393_commentsCanHaveSameAnchor() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
Sheet sheet = wb.createSheet();
@ -1486,7 +1486,7 @@ public abstract class BaseTestBugzillaIssues {
@Test
public void bug57798() throws Exception {
protected void bug57798() throws Exception {
String fileName = "57798." + _testDataProvider.getStandardFileNameExtension();
try (Workbook workbook = _testDataProvider.openSampleWorkbook(fileName)) {
@ -1615,7 +1615,7 @@ public abstract class BaseTestBugzillaIssues {
// bug 60197: setSheetOrder should update sheet-scoped named ranges to maintain references to the sheets before the re-order
@Test
public void bug60197_NamedRangesReferToCorrectSheetWhenSheetOrderIsChanged() throws Exception {
protected void bug60197_NamedRangesReferToCorrectSheetWhenSheetOrderIsChanged() throws Exception {
try (Workbook wb = _testDataProvider.createWorkbook()) {
Sheet sheet1 = wb.createSheet("Sheet1");
Sheet sheet2 = wb.createSheet("Sheet2");

View File

@ -971,7 +971,7 @@ public abstract class BaseTestCell {
* Tests that the setAsActiveCell and getActiveCell function pairs work together
*/
@Test
public void setAsActiveCell() throws IOException {
void setAsActiveCell() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
Sheet sheet = wb.createSheet();
Row row = sheet.createRow(0);
@ -987,7 +987,7 @@ public abstract class BaseTestCell {
}
@Test
public void getCellComment() throws IOException {
void getCellComment() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
Sheet sheet = wb.createSheet();
CreationHelper factory = wb.getCreationHelper();
@ -1120,7 +1120,7 @@ public abstract class BaseTestCell {
}
@Test
public void getDateCellValue_returnsNull_onABlankCell() throws IOException {
void getDateCellValue_returnsNull_onABlankCell() throws IOException {
try (Workbook workbook = _testDataProvider.createWorkbook()) {
Cell cell = workbook.createSheet().createRow(0).createCell(0);
assertEquals(CellType.BLANK, cell.getCellType());
@ -1130,7 +1130,7 @@ public abstract class BaseTestCell {
}
@Test
public void getBooleanCellValue_returnsFalse_onABlankCell() throws IOException {
void getBooleanCellValue_returnsFalse_onABlankCell() throws IOException {
try (Workbook workbook = _testDataProvider.createWorkbook()) {
Cell cell = workbook.createSheet().createRow(0).createCell(0);
assertEquals(CellType.BLANK, cell.getCellType());
@ -1140,7 +1140,7 @@ public abstract class BaseTestCell {
}
@Test
public void setStringCellValue_ifThrows_shallNotChangeCell() throws IOException {
void setStringCellValue_ifThrows_shallNotChangeCell() throws IOException {
try (Workbook workbook = _testDataProvider.createWorkbook()) {
Cell cell = workbook.createSheet().createRow(0).createCell(0);
@ -1163,7 +1163,7 @@ public abstract class BaseTestCell {
}
@Test
public void setStringCellValueWithRichTextString_ifThrows_shallNotChangeCell() throws IOException {
void setStringCellValueWithRichTextString_ifThrows_shallNotChangeCell() throws IOException {
try (Workbook workbook = _testDataProvider.createWorkbook()) {
Cell cell = workbook.createSheet().createRow(0).createCell(0);
@ -1187,7 +1187,7 @@ public abstract class BaseTestCell {
}
@Test
public void setCellType_null_throwsIAE() throws IOException {
void setCellType_null_throwsIAE() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
Cell cell = getInstance(wb);
assertThrows(IllegalArgumentException.class, () -> cell.setCellType(null));
@ -1195,7 +1195,7 @@ public abstract class BaseTestCell {
}
@Test
public void setCellType_NONE_throwsIAE() throws IOException {
void setCellType_NONE_throwsIAE() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
Cell cell = getInstance(wb);
assertThrows(IllegalArgumentException.class, () -> cell.setCellType(CellType._NONE));
@ -1204,7 +1204,7 @@ public abstract class BaseTestCell {
@Test
public void setBlank_removesArrayFormula_ifCellIsPartOfAnArrayFormulaGroupContainingOnlyThisCell() throws IOException {
protected void setBlank_removesArrayFormula_ifCellIsPartOfAnArrayFormulaGroupContainingOnlyThisCell() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
Cell cell = getInstance(wb);
@ -1221,7 +1221,7 @@ public abstract class BaseTestCell {
}
@Test
public void setBlank_throwsISE_ifCellIsPartOfAnArrayFormulaGroupContainingOtherCells() throws IOException {
protected void setBlank_throwsISE_ifCellIsPartOfAnArrayFormulaGroupContainingOtherCells() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
Cell cell = getInstance(wb);
cell.getSheet().setArrayFormula("1", CellRangeAddress.valueOf("A1:B1"));
@ -1231,7 +1231,7 @@ public abstract class BaseTestCell {
}
@Test
public void setCellFormula_throwsISE_ifCellIsPartOfAnArrayFormulaGroupContainingOtherCells() throws IOException {
protected void setCellFormula_throwsISE_ifCellIsPartOfAnArrayFormulaGroupContainingOtherCells() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
Cell cell = getInstance(wb);
@ -1244,7 +1244,7 @@ public abstract class BaseTestCell {
}
@Test
public void removeFormula_preservesValue() throws IOException {
void removeFormula_preservesValue() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
Cell cell = getInstance(wb);
@ -1275,7 +1275,7 @@ public abstract class BaseTestCell {
}
@Test
public void removeFormula_turnsCellToBlank_whenFormulaWasASingleCellArrayFormula() throws IOException {
protected void removeFormula_turnsCellToBlank_whenFormulaWasASingleCellArrayFormula() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
Cell cell = getInstance(wb);
@ -1302,7 +1302,7 @@ public abstract class BaseTestCell {
}
@Test
public void setCellFormula_onABlankCell_setsValueToZero() throws IOException {
void setCellFormula_onABlankCell_setsValueToZero() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
Cell cell = getInstance(wb);
cell.setCellFormula("\"foo\"");
@ -1314,7 +1314,7 @@ public abstract class BaseTestCell {
@Test
public void setCellFormula_onANonBlankCell_preservesTheValue() throws IOException {
void setCellFormula_onANonBlankCell_preservesTheValue() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
Cell cell = getInstance(wb);
cell.setCellValue(true);
@ -1326,7 +1326,7 @@ public abstract class BaseTestCell {
}
@Test
public void setCellFormula_onAFormulaCell_changeFormula_preservesTheValue() throws IOException {
void setCellFormula_onAFormulaCell_changeFormula_preservesTheValue() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
Cell cell = getInstance(wb);
cell.setCellFormula("\"foo\"");
@ -1343,7 +1343,7 @@ public abstract class BaseTestCell {
}
@Test
public void setCellFormula_onASingleCellArrayFormulaCell_preservesTheValue() throws IOException {
protected void setCellFormula_onASingleCellArrayFormulaCell_preservesTheValue() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
Cell cell = getInstance(wb);
cell.getSheet().setArrayFormula("\"foo\"", CellRangeAddress.valueOf("A1"));
@ -1364,7 +1364,7 @@ public abstract class BaseTestCell {
}
@Test
public void setCellType_FORMULA_onANonFormulaCell_throwsIllegalArgumentException() throws IOException {
void setCellType_FORMULA_onANonFormulaCell_throwsIllegalArgumentException() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
Cell cell = getInstance(wb);
assertThrows(IllegalArgumentException.class, () -> cell.setCellType(CellType.FORMULA));
@ -1372,7 +1372,7 @@ public abstract class BaseTestCell {
}
@Test
public void setCellType_FORMULA_onAFormulaCell_doesNothing() throws IOException {
void setCellType_FORMULA_onAFormulaCell_doesNothing() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
Cell cell = getInstance(wb);
cell.setCellFormula("3");
@ -1387,7 +1387,7 @@ public abstract class BaseTestCell {
}
@Test
public void setCellType_FORMULA_onAnArrayFormulaCell_doesNothing() throws IOException {
void setCellType_FORMULA_onAnArrayFormulaCell_doesNothing() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
Cell cell = getInstance(wb);
cell.getSheet().setArrayFormula("3", CellRangeAddress.valueOf("A1:A2"));

View File

@ -251,7 +251,7 @@ public abstract class BaseTestCellComment {
* code from the quick guide
*/
@Test
public void quickGuide() throws IOException {
void quickGuide() throws IOException {
Workbook wb1 = _testDataProvider.createWorkbook();
CreationHelper factory = wb1.getCreationHelper();
@ -286,7 +286,7 @@ public abstract class BaseTestCellComment {
}
@Test
public void getClientAnchor() throws IOException {
void getClientAnchor() throws IOException {
Workbook wb = _testDataProvider.createWorkbook();
Sheet sheet = wb.createSheet();
@ -361,7 +361,7 @@ public abstract class BaseTestCellComment {
}
@Test
public void attemptToSave2CommentsWithSameCoordinates() throws IOException {
void attemptToSave2CommentsWithSameCoordinates() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
Sheet sh = wb.createSheet();
CreationHelper factory = wb.getCreationHelper();
@ -386,7 +386,7 @@ public abstract class BaseTestCellComment {
}
@Test
public void getAddress() {
void getAddress() {
Workbook wb = _testDataProvider.createWorkbook();
Sheet sh = wb.createSheet();
CreationHelper factory = wb.getCreationHelper();
@ -400,7 +400,7 @@ public abstract class BaseTestCellComment {
}
@Test
public void setAddress() {
void setAddress() {
Workbook wb = _testDataProvider.createWorkbook();
Sheet sh = wb.createSheet();
CreationHelper factory = wb.getCreationHelper();

View File

@ -32,7 +32,7 @@ public abstract class BaseTestColumnShifting {
protected ColumnShifter columnShifter;
@BeforeEach
public void init() {
void init() {
int rowIndex = 0;
sheet1 = wb.createSheet("sheet1");
Row row = sheet1.createRow(rowIndex++);

View File

@ -40,7 +40,7 @@ public abstract class BaseTestDataFormat {
_testDataProvider = testDataProvider;
}
public void assertNotBuiltInFormat(String customFmt) {
void assertNotBuiltInFormat(String customFmt) {
//check it is not in built-in formats
assertEquals(-1, BuiltinFormats.getBuiltinFormat(customFmt));
}

View File

@ -66,7 +66,7 @@ public abstract class BaseTestDataValidation {
_validationType = validationType;
_currentRowIndex = fSheet.getPhysicalNumberOfRows();
}
public void addValidation(int operatorType, String firstFormula, String secondFormula,
void addValidation(int operatorType, String firstFormula, String secondFormula,
int errorStyle, String ruleDescr, String promptDescr,
boolean allowEmpty, boolean inputBox, boolean errorBox) {
String[] explicitListValues = null;
@ -168,7 +168,7 @@ public abstract class BaseTestDataValidation {
cell.setCellStyle(style);
setCellValue(cell, strStettings);
}
public void addListValidation(String[] explicitListValues, String listFormula, String listValsDescr,
void addListValidation(String[] explicitListValues, String listFormula, String listValsDescr,
boolean allowEmpty, boolean suppressDropDown) {
String promptDescr = (allowEmpty ? "empty ok" : "not empty")
+ ", " + (suppressDropDown ? "no drop-down" : "drop-down");
@ -256,7 +256,7 @@ public abstract class BaseTestDataValidation {
_currentSheet = _wb.createSheet(sheetName);
return _currentSheet;
}
public void createDVTypeRow(String strTypeDescription) {
void createDVTypeRow(String strTypeDescription) {
Sheet sheet = _currentSheet;
Row row = sheet.createRow(sheet.getPhysicalNumberOfRows());
sheet.addMergedRegion(new CellRangeAddress(sheet.getPhysicalNumberOfRows()-1, sheet.getPhysicalNumberOfRows()-1, 0, 5));
@ -266,7 +266,7 @@ public abstract class BaseTestDataValidation {
row = sheet.createRow(sheet.getPhysicalNumberOfRows());
}
public void createHeaderRow() {
void createHeaderRow() {
Sheet sheet = _currentSheet;
Row row = sheet.createRow(sheet.getPhysicalNumberOfRows());
row.setHeight((short) 400);
@ -298,7 +298,7 @@ public abstract class BaseTestDataValidation {
return new ValidationAdder(_currentSheet, _style_1, _style_2, cellStyle, dataValidationType);
}
public void createDVDescriptionRow(String strTypeDescription) {
void createDVDescriptionRow(String strTypeDescription) {
Sheet sheet = _currentSheet;
Row row = sheet.getRow(sheet.getPhysicalNumberOfRows()-1);
sheet.addMergedRegion(new CellRangeAddress(sheet.getPhysicalNumberOfRows()-1, sheet.getPhysicalNumberOfRows()-1, 0, 5));

View File

@ -334,7 +334,7 @@ public abstract class BaseTestFormulaEvaluator {
}
@Test
public void evaluateInCellReturnsSameCell() throws IOException {
void evaluateInCellReturnsSameCell() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
wb.createSheet().createRow(0).createCell(0);
FormulaEvaluator evaluator = wb.getCreationHelper().createFormulaEvaluator();

View File

@ -693,7 +693,7 @@ public abstract class BaseTestNamedRange {
// bug 60260: renaming a sheet with a named range referring to a unicode (non-ASCII) sheet name
@Test
public void renameSheetWithNamedRangeReferringToUnicodeSheetName() {
void renameSheetWithNamedRangeReferringToUnicodeSheetName() {
Workbook wb = _testDataProvider.createWorkbook();
wb.createSheet("Sheet\u30FB1");

View File

@ -57,7 +57,7 @@ public abstract class BaseTestPicture {
protected abstract Picture getPictureShape(Drawing<?> pat, int picIdx);
@Test
public void resize() throws IOException {
void resize() throws IOException {
String fileName = "resize_compare.xls" + (getClass().getName().contains("xssf") ? "x" : "");
double scaleX = 2;
double scaleY = 2;
@ -159,7 +159,7 @@ public abstract class BaseTestPicture {
}
@Test
public void bug64213() throws IOException {
void bug64213() throws IOException {
int[] input = {
200, 50 * 256, -1,
400, 50 * 256, -1,

View File

@ -44,7 +44,7 @@ public abstract class BaseTestRangeCopier {
}
@Test
public void copySheetRangeWithoutFormulas() {
void copySheetRangeWithoutFormulas() {
CellRangeAddress rangeToCopy = CellRangeAddress.valueOf("B1:C2"); //2x2
CellRangeAddress destRange = CellRangeAddress.valueOf("C2:D3"); //2x2
rangeCopier.copyRange(rangeToCopy, destRange);
@ -53,7 +53,7 @@ public abstract class BaseTestRangeCopier {
}
@Test
public void tileTheRangeAway() {
void tileTheRangeAway() {
CellRangeAddress tileRange = CellRangeAddress.valueOf("C4:D5");
CellRangeAddress destRange = CellRangeAddress.valueOf("F4:K5");
rangeCopier.copyRange(tileRange, destRange);
@ -67,7 +67,7 @@ public abstract class BaseTestRangeCopier {
}
@Test
public void tileTheRangeOver() {
void tileTheRangeOver() {
CellRangeAddress tileRange = CellRangeAddress.valueOf("C4:D5");
CellRangeAddress destRange = CellRangeAddress.valueOf("A4:C5");
rangeCopier.copyRange(tileRange, destRange);
@ -77,7 +77,7 @@ public abstract class BaseTestRangeCopier {
}
@Test
public void copyRangeToOtherSheet() {
void copyRangeToOtherSheet() {
Sheet destSheet = sheet2;
CellRangeAddress tileRange = CellRangeAddress.valueOf("C4:D5"); // on sheet1
CellRangeAddress destRange = CellRangeAddress.valueOf("F4:J6"); // on sheet2

View File

@ -65,7 +65,7 @@ public abstract class BaseTestSheet {
}
@Test
public void createRow() throws IOException {
protected void createRow() throws IOException {
try (Workbook workbook = _testDataProvider.createWorkbook()) {
Sheet sheet = workbook.createSheet();
assertEquals(0, sheet.getPhysicalNumberOfRows());
@ -106,7 +106,7 @@ public abstract class BaseTestSheet {
}
@Test
public void createRowBeforeFirstRow() throws IOException {
void createRowBeforeFirstRow() throws IOException {
try (Workbook workbook = _testDataProvider.createWorkbook()) {
final Sheet sh = workbook.createSheet();
sh.createRow(0);
@ -116,7 +116,7 @@ public abstract class BaseTestSheet {
}
@Test
public void createRowAfterLastRow() throws IOException {
void createRowAfterLastRow() throws IOException {
final SpreadsheetVersion version = _testDataProvider.getSpreadsheetVersion();
try (Workbook workbook = _testDataProvider.createWorkbook()) {
final Sheet sh = workbook.createSheet();
@ -127,7 +127,7 @@ public abstract class BaseTestSheet {
}
@Test
public void removeRow() throws IOException {
void removeRow() throws IOException {
try (Workbook workbook = _testDataProvider.createWorkbook()) {
Sheet sheet1 = workbook.createSheet();
assertEquals(0, sheet1.getPhysicalNumberOfRows());
@ -170,7 +170,7 @@ public abstract class BaseTestSheet {
}
@Test
public void cloneSheet() throws IOException {
protected void cloneSheet() throws IOException {
try (Workbook workbook = _testDataProvider.createWorkbook()) {
CreationHelper factory = workbook.getCreationHelper();
Sheet sheet = workbook.createSheet("Test Clone");
@ -204,7 +204,7 @@ public abstract class BaseTestSheet {
* BUG 37416
*/
@Test
public void cloneSheetMultipleTimes() throws IOException {
protected void cloneSheetMultipleTimes() throws IOException {
try (Workbook workbook = _testDataProvider.createWorkbook()) {
CreationHelper factory = workbook.getCreationHelper();
Sheet sheet = workbook.createSheet("Test Clone");
@ -233,7 +233,7 @@ public abstract class BaseTestSheet {
* Setting landscape and portrait stuff on new sheets
*/
@Test
public void printSetupLandscapeNew() throws IOException {
void printSetupLandscapeNew() throws IOException {
try (Workbook wb1 = _testDataProvider.createWorkbook()) {
Sheet sheetL = wb1.createSheet("LandscapeS");
Sheet sheetP = wb1.createSheet("LandscapeP");
@ -272,7 +272,7 @@ public abstract class BaseTestSheet {
* as this results in a corrupted workbook
*/
@Test
public void addOverlappingMergedRegions() throws IOException {
void addOverlappingMergedRegions() throws IOException {
try (final Workbook wb = _testDataProvider.createWorkbook()) {
final Sheet sheet = wb.createSheet();
@ -320,7 +320,7 @@ public abstract class BaseTestSheet {
* Bug 56345: Reject single-cell merged regions
*/
@Test
public void addMergedRegionWithSingleCellShouldFail() throws IOException {
void addMergedRegionWithSingleCellShouldFail() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
final Sheet sheet = wb.createSheet();
@ -339,7 +339,7 @@ public abstract class BaseTestSheet {
*
*/
@Test
public void addMerged() throws IOException {
void addMerged() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
Sheet sheet = wb.createSheet();
assertEquals(0, sheet.getNumMergedRegions());
@ -376,7 +376,7 @@ public abstract class BaseTestSheet {
*
*/
@Test
public void removeMerged() throws IOException {
void removeMerged() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
Sheet sheet = wb.createSheet();
CellRangeAddress region = new CellRangeAddress(0, 1, 0, 1);
@ -415,7 +415,7 @@ public abstract class BaseTestSheet {
* Remove multiple merged regions
*/
@Test
public void removeMergedRegions() throws IOException {
void removeMergedRegions() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
Sheet sheet = wb.createSheet();
@ -441,7 +441,7 @@ public abstract class BaseTestSheet {
}
@Test
public void shiftMerged() throws IOException {
protected void shiftMerged() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
CreationHelper factory = wb.getCreationHelper();
Sheet sheet = wb.createSheet();
@ -472,7 +472,7 @@ public abstract class BaseTestSheet {
* can be skipped (unsafe) and run in O(1).
*/
@Test
public void addMergedRegionUnsafe() throws IOException {
void addMergedRegionUnsafe() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
Sheet sh = wb.createSheet();
CellRangeAddress region1 = CellRangeAddress.valueOf("A1:B2");
@ -515,7 +515,7 @@ public abstract class BaseTestSheet {
* Tests the display of gridlines, formulas, and rowcolheadings.
*/
@Test
public void displayOptions() throws IOException {
void displayOptions() throws IOException {
try (Workbook wb1 = _testDataProvider.createWorkbook()) {
Sheet sheet = wb1.createSheet();
@ -541,7 +541,7 @@ public abstract class BaseTestSheet {
}
@Test
public void columnWidth() throws IOException {
void columnWidth() throws IOException {
try (Workbook wb1 = _testDataProvider.createWorkbook()) {
Sheet sheet1 = wb1.createSheet();
@ -602,7 +602,7 @@ public abstract class BaseTestSheet {
@Test
public void defaultRowHeight() throws IOException {
void defaultRowHeight() throws IOException {
try (Workbook workbook = _testDataProvider.createWorkbook()) {
Sheet sheet = workbook.createSheet();
sheet.setDefaultRowHeightInPoints(15);
@ -632,7 +632,7 @@ public abstract class BaseTestSheet {
/** cell with formula becomes null on cloning a sheet*/
@Test
public void bug35084() throws IOException {
protected void bug35084() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
Sheet s = wb.createSheet("Sheet1");
Row r = s.createRow(0);
@ -649,7 +649,7 @@ public abstract class BaseTestSheet {
/** test that new default column styles get applied */
@Test
public void defaultColumnStyle() throws IOException {
protected void defaultColumnStyle() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
CellStyle style = wb.createCellStyle();
Sheet sheet = wb.createSheet();
@ -666,7 +666,7 @@ public abstract class BaseTestSheet {
}
@Test
public void outlineProperties() throws IOException {
void outlineProperties() throws IOException {
try (Workbook wb1 = _testDataProvider.createWorkbook()) {
Sheet sheet = wb1.createSheet();
@ -698,7 +698,7 @@ public abstract class BaseTestSheet {
* Test basic display and print properties
*/
@Test
public void sheetProperties() throws IOException {
void sheetProperties() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
Sheet sheet = wb.createSheet();
@ -799,7 +799,7 @@ public abstract class BaseTestSheet {
}
@Test
public void rowBreaks() throws IOException {
void rowBreaks() throws IOException {
try (Workbook workbook = _testDataProvider.createWorkbook()) {
Sheet sheet = workbook.createSheet();
//Sheet#getRowBreaks() returns an empty array if no row breaks are defined
@ -829,7 +829,7 @@ public abstract class BaseTestSheet {
}
@Test
public void columnBreaks() throws IOException {
void columnBreaks() throws IOException {
try (Workbook workbook = _testDataProvider.createWorkbook()) {
Sheet sheet = workbook.createSheet();
assertNotNull(sheet.getColumnBreaks());
@ -858,7 +858,7 @@ public abstract class BaseTestSheet {
}
@Test
public void getFirstLastRowNum() throws IOException {
void getFirstLastRowNum() throws IOException {
try (Workbook workbook = _testDataProvider.createWorkbook()) {
Sheet sheet = workbook.createSheet("Sheet 1");
sheet.createRow(9);
@ -870,7 +870,7 @@ public abstract class BaseTestSheet {
}
@Test
public void getFooter() throws IOException {
void getFooter() throws IOException {
try (Workbook workbook = _testDataProvider.createWorkbook()) {
Sheet sheet = workbook.createSheet("Sheet 1");
assertNotNull(sheet.getFooter());
@ -880,7 +880,7 @@ public abstract class BaseTestSheet {
}
@Test
public void getSetColumnHidden() throws IOException {
void getSetColumnHidden() throws IOException {
try (Workbook workbook = _testDataProvider.createWorkbook()) {
Sheet sheet = workbook.createSheet("Sheet 1");
sheet.setColumnHidden(2, true);
@ -889,7 +889,7 @@ public abstract class BaseTestSheet {
}
@Test
public void protectSheet() throws IOException {
void protectSheet() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
Sheet sheet = wb.createSheet();
assertFalse(sheet.getProtect());
@ -901,7 +901,7 @@ public abstract class BaseTestSheet {
}
@Test
public void createFreezePane() throws IOException {
void createFreezePane() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
// create a workbook
Sheet sheet = wb.createSheet();
@ -953,7 +953,7 @@ public abstract class BaseTestSheet {
@Test
public void getRepeatingRowsAndColumns() throws IOException {
void getRepeatingRowsAndColumns() throws IOException {
try (Workbook wb = _testDataProvider.openSampleWorkbook(
"RepeatingRowsCols."
+ _testDataProvider.getStandardFileNameExtension())) {
@ -967,7 +967,7 @@ public abstract class BaseTestSheet {
@Test
public void setRepeatingRowsAndColumnsBug47294() throws IOException {
void setRepeatingRowsAndColumnsBug47294() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
Sheet sheet1 = wb.createSheet();
sheet1.setRepeatingRows(CellRangeAddress.valueOf("1:4"));
@ -981,7 +981,7 @@ public abstract class BaseTestSheet {
}
@Test
public void setRepeatingRowsAndColumns() throws IOException {
void setRepeatingRowsAndColumns() throws IOException {
try (Workbook wb1 = _testDataProvider.createWorkbook()) {
Sheet sheet1 = wb1.createSheet("Sheet1");
Sheet sheet2 = wb1.createSheet("Sheet2");
@ -1033,7 +1033,7 @@ public abstract class BaseTestSheet {
}
@Test
public void baseZoom() throws IOException {
void baseZoom() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
Sheet sheet = wb.createSheet();
@ -1044,7 +1044,7 @@ public abstract class BaseTestSheet {
}
@Test
public void baseShowInPane() throws IOException {
void baseShowInPane() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
Sheet sheet = wb.createSheet();
sheet.showInPane(2, 3);
@ -1052,7 +1052,7 @@ public abstract class BaseTestSheet {
}
@Test
public void bug55723() throws IOException {
void bug55723() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
Sheet sheet = wb.createSheet();
@ -1069,7 +1069,7 @@ public abstract class BaseTestSheet {
}
@Test
public void bug55723_Rows() throws IOException {
void bug55723_Rows() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
Sheet sheet = wb.createSheet();
@ -1080,7 +1080,7 @@ public abstract class BaseTestSheet {
}
@Test
public void bug55723d_RowsOver65k() throws IOException {
void bug55723d_RowsOver65k() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
Sheet sheet = wb.createSheet();
@ -1094,7 +1094,7 @@ public abstract class BaseTestSheet {
* XSSFSheet autoSizeColumn() on empty RichTextString fails
*/
@Test
public void bug48325() throws IOException {
void bug48325() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
Sheet sheet = wb.createSheet("Test");
trackColumnsForAutoSizingIfSXSSF(sheet);
@ -1115,7 +1115,7 @@ public abstract class BaseTestSheet {
}
@Test
public void getCellComment() throws IOException {
protected void getCellComment() throws IOException {
try (Workbook workbook = _testDataProvider.createWorkbook()) {
Sheet sheet = workbook.createSheet();
Drawing<?> dg = sheet.createDrawingPatriarch();
@ -1133,7 +1133,7 @@ public abstract class BaseTestSheet {
}
@Test
public void getCellComments() throws IOException {
void getCellComments() throws IOException {
try (Workbook wb1 = _testDataProvider.createWorkbook()) {
Sheet sheet = wb1.createSheet("TEST");
@ -1185,7 +1185,7 @@ public abstract class BaseTestSheet {
}
@Test
public void getHyperlink() throws IOException {
void getHyperlink() throws IOException {
try (Workbook workbook = _testDataProvider.createWorkbook()) {
Hyperlink hyperlink = workbook.getCreationHelper().createHyperlink(HyperlinkType.URL);
hyperlink.setAddress("https://poi.apache.org/");
@ -1206,7 +1206,7 @@ public abstract class BaseTestSheet {
}
@Test
public void removeAllHyperlinks() throws IOException {
void removeAllHyperlinks() throws IOException {
try (Workbook workbook = _testDataProvider.createWorkbook()) {
Hyperlink hyperlink = workbook.getCreationHelper().createHyperlink(HyperlinkType.URL);
hyperlink.setAddress("https://poi.apache.org/");
@ -1234,7 +1234,7 @@ public abstract class BaseTestSheet {
@Test
public void newMergedRegionAt() throws IOException {
void newMergedRegionAt() throws IOException {
try (Workbook workbook = _testDataProvider.createWorkbook()) {
Sheet sheet = workbook.createSheet();
CellRangeAddress region = CellRangeAddress.valueOf("B2:D4");
@ -1247,7 +1247,7 @@ public abstract class BaseTestSheet {
}
@Test
public void showInPaneManyRowsBug55248() throws IOException {
void showInPaneManyRowsBug55248() throws IOException {
try (Workbook wb1 = _testDataProvider.createWorkbook()) {
Sheet sheet = wb1.createSheet("Sheet 1");
@ -1301,7 +1301,7 @@ public abstract class BaseTestSheet {
* Tests that the setAsActiveCell and getActiveCell function pairs work together
*/
@Test
public void setActiveCell() throws IOException {
void setActiveCell() throws IOException {
try (Workbook wb1 = _testDataProvider.createWorkbook()) {
Sheet sheet = wb1.createSheet();
CellAddress B42 = new CellAddress("B42");
@ -1322,7 +1322,7 @@ public abstract class BaseTestSheet {
@Test
public void autoSizeDate() throws IOException {
void autoSizeDate() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
Sheet s = wb.createSheet("Sheet1");
Row r = s.createRow(0);

View File

@ -63,7 +63,7 @@ public abstract class BaseTestSheetAutosizeColumn {
}
@Test
public void numericCells() throws Exception {
void numericCells() throws Exception {
Workbook workbook = _testDataProvider.createWorkbook();
DataFormat df = workbook.getCreationHelper().createDataFormat();
Sheet sheet = workbook.createSheet();
@ -105,7 +105,7 @@ public abstract class BaseTestSheetAutosizeColumn {
}
@Test
public void booleanCells() throws Exception {
void booleanCells() throws Exception {
Workbook workbook = _testDataProvider.createWorkbook();
Sheet sheet = workbook.createSheet();
trackColumnsForAutoSizingIfSXSSF(sheet);
@ -136,7 +136,7 @@ public abstract class BaseTestSheetAutosizeColumn {
}
@Test
public void dateCells() throws Exception {
void dateCells() throws Exception {
Workbook workbook = _testDataProvider.createWorkbook();
Sheet sheet = workbook.createSheet();
trackColumnsForAutoSizingIfSXSSF(sheet);
@ -203,7 +203,7 @@ public abstract class BaseTestSheetAutosizeColumn {
}
@Test
public void stringCells() throws Exception {
void stringCells() throws Exception {
Workbook workbook = _testDataProvider.createWorkbook();
Sheet sheet = workbook.createSheet();
trackColumnsForAutoSizingIfSXSSF(sheet);
@ -237,7 +237,7 @@ public abstract class BaseTestSheetAutosizeColumn {
}
@Test
public void rotatedText() throws Exception {
void rotatedText() throws Exception {
Workbook workbook = _testDataProvider.createWorkbook();
Sheet sheet = workbook.createSheet();
trackColumnsForAutoSizingIfSXSSF(sheet);
@ -264,7 +264,7 @@ public abstract class BaseTestSheetAutosizeColumn {
}
@Test
public void mergedCells() throws Exception {
void mergedCells() throws Exception {
Workbook workbook = _testDataProvider.createWorkbook();
Sheet sheet = workbook.createSheet();
trackColumnsForAutoSizingIfSXSSF(sheet);
@ -291,7 +291,7 @@ public abstract class BaseTestSheetAutosizeColumn {
* passed the 32767 boundary. See bug #48079
*/
@Test
public void largeRowNumbers() throws Exception {
void largeRowNumbers() throws Exception {
Workbook workbook = _testDataProvider.createWorkbook();
Sheet sheet = workbook.createSheet();
trackColumnsForAutoSizingIfSXSSF(sheet);
@ -346,7 +346,7 @@ public abstract class BaseTestSheetAutosizeColumn {
@Test
public void testExcelExporter() throws IOException {
void testExcelExporter() throws IOException {
try (final Workbook wb = _testDataProvider.createWorkbook()) {
final Sheet sheet = wb.createSheet("test");
trackColumnsForAutoSizingIfSXSSF(sheet);

View File

@ -48,13 +48,13 @@ public abstract class BaseTestSheetHiding {
}
@BeforeEach
public void setUp() {
void setUp() {
wbH = _testDataProvider.openSampleWorkbook(_file1);
wbU = _testDataProvider.openSampleWorkbook(_file2);
}
@AfterEach
public void teadDown() throws IOException {
void teadDown() throws IOException {
wbH.close();
wbU.close();
}

View File

@ -43,7 +43,7 @@ public abstract class BaseTestSheetShiftColumns {
protected ITestDataProvider _testDataProvider;
@BeforeEach
public void init() {
void init() {
int rowIndex = 0;
sheet1 = workbook.createSheet("sheet1");
Row row = sheet1.createRow(rowIndex++);
@ -257,7 +257,7 @@ public abstract class BaseTestSheetShiftColumns {
}
@Test
public void shiftMergedColumnsToMergedColumnsRight() throws IOException {
protected void shiftMergedColumnsToMergedColumnsRight() throws IOException {
Workbook wb = _testDataProvider.createWorkbook();
Sheet sheet = wb.createSheet("test");
@ -279,7 +279,7 @@ public abstract class BaseTestSheetShiftColumns {
}
@Test
public void shiftMergedColumnsToMergedColumnsLeft() throws IOException {
protected void shiftMergedColumnsToMergedColumnsLeft() throws IOException {
Workbook wb = _testDataProvider.createWorkbook();
Sheet sheet = wb.createSheet("test");
populateSheetCells(sheet);

View File

@ -599,7 +599,7 @@ public abstract class BaseTestSheetShiftRows {
//@Disabled("bug 56454: Incorrectly handles merged regions that do not contain column 0")
@Test
public void shiftRowsWithMergedRegionsThatDoNotContainColumnZero() throws IOException {
void shiftRowsWithMergedRegionsThatDoNotContainColumnZero() throws IOException {
Workbook wb = _testDataProvider.createWorkbook();
Sheet sheet = wb.createSheet("test");
@ -638,7 +638,7 @@ public abstract class BaseTestSheetShiftRows {
}
@Test
public void shiftMergedRowsToMergedRowsUp() throws IOException {
void shiftMergedRowsToMergedRowsUp() throws IOException {
Workbook wb = _testDataProvider.createWorkbook();
Sheet sheet = wb.createSheet("test");
populateSheetCells(sheet, 2);
@ -661,7 +661,7 @@ public abstract class BaseTestSheetShiftRows {
}
@Test
public void shiftMergedRowsToMergedRowsOverlappingMergedRegion() throws IOException {
void shiftMergedRowsToMergedRowsOverlappingMergedRegion() throws IOException {
Workbook wb = _testDataProvider.createWorkbook();
Sheet sheet = wb.createSheet("test");
populateSheetCells(sheet, 10);
@ -683,7 +683,7 @@ public abstract class BaseTestSheetShiftRows {
}
@Test
public void bug60384ShiftMergedRegion() throws IOException {
void bug60384ShiftMergedRegion() throws IOException {
Workbook wb = _testDataProvider.createWorkbook();
Sheet sheet = wb.createSheet("test");
populateSheetCells(sheet, 9);
@ -718,7 +718,7 @@ public abstract class BaseTestSheetShiftRows {
}
@Test
public void shiftMergedRowsToMergedRowsDown() throws IOException {
void shiftMergedRowsToMergedRowsDown() throws IOException {
Workbook wb = _testDataProvider.createWorkbook();
Sheet sheet = wb.createSheet("test");
@ -765,7 +765,7 @@ public abstract class BaseTestSheetShiftRows {
@Test
public void checkMergedRegions56454() {
void checkMergedRegions56454() {
Workbook wb = _testDataProvider.createWorkbook();
Sheet sheet = wb.createSheet();

View File

@ -517,7 +517,7 @@ public abstract class BaseTestSheetUpdateArrayFormulas {
@Disabled("See bug 59728")
@Test
public void shouldNotBeAbleToCreateArrayFormulaOnPreexistingMergedRegion() throws IOException {
void shouldNotBeAbleToCreateArrayFormulaOnPreexistingMergedRegion() throws IOException {
/*
* m = merged region
* f = array formula

View File

@ -48,7 +48,7 @@ public abstract class BaseTestWorkbook {
}
@Test
public void sheetIterator_forEach() throws IOException {
void sheetIterator_forEach() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
wb.createSheet("Sheet0");
wb.createSheet("Sheet1");
@ -67,7 +67,7 @@ public abstract class BaseTestWorkbook {
* underlying data has been reordered
*/
@Test
public void sheetIterator_sheetsReordered() throws IOException {
void sheetIterator_sheetsReordered() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
wb.createSheet("Sheet0");
wb.createSheet("Sheet1");
@ -88,7 +88,7 @@ public abstract class BaseTestWorkbook {
* underlying data has been reordered
*/
@Test
public void sheetIterator_sheetRemoved() throws IOException {
void sheetIterator_sheetRemoved() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
wb.createSheet("Sheet0");
wb.createSheet("Sheet1");
@ -107,7 +107,7 @@ public abstract class BaseTestWorkbook {
* should not be able to remove sheets from the sheet iterator
*/
@Test
public void sheetIterator_remove() throws IOException {
void sheetIterator_remove() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
wb.createSheet("Sheet0");
@ -119,7 +119,7 @@ public abstract class BaseTestWorkbook {
@Test
public void createSheet() throws IOException {
void createSheet() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
assertEquals(0, wb.getNumberOfSheets());
@ -211,7 +211,7 @@ public abstract class BaseTestWorkbook {
* but for the purpose of uniqueness long sheet names are silently truncated to 31 chars.
*/
@Test
public void createSheetWithLongNames() throws IOException {
void createSheetWithLongNames() throws IOException {
try (Workbook wb1 = _testDataProvider.createWorkbook()) {
String sheetName1 = "My very long sheet name which is longer than 31 chars";
@ -246,7 +246,7 @@ public abstract class BaseTestWorkbook {
}
@Test
public void removeSheetAt() throws IOException {
void removeSheetAt() throws IOException {
try (Workbook workbook = _testDataProvider.createWorkbook()) {
workbook.createSheet("sheet1");
workbook.createSheet("sheet2");
@ -310,7 +310,7 @@ public abstract class BaseTestWorkbook {
}
@Test
public void defaultValues() throws IOException {
void defaultValues() throws IOException {
try (Workbook b = _testDataProvider.createWorkbook()) {
assertEquals(0, b.getActiveSheetIndex());
assertEquals(0, b.getFirstVisibleTab());
@ -320,7 +320,7 @@ public abstract class BaseTestWorkbook {
}
@Test
public void sheetSelection() throws IOException {
void sheetSelection() throws IOException {
try (Workbook b = _testDataProvider.createWorkbook()) {
b.createSheet("Sheet One");
b.createSheet("Sheet Two");
@ -333,7 +333,7 @@ public abstract class BaseTestWorkbook {
}
@Test
public void printArea() throws IOException {
void printArea() throws IOException {
try (Workbook workbook = _testDataProvider.createWorkbook()) {
Sheet sheet1 = workbook.createSheet("Test Print Area");
String sheetName1 = sheet1.getSheetName();
@ -354,7 +354,7 @@ public abstract class BaseTestWorkbook {
}
@Test
public void getSetActiveSheet() throws IOException {
void getSetActiveSheet() throws IOException {
try (Workbook workbook = _testDataProvider.createWorkbook()) {
assertEquals(0, workbook.getActiveSheetIndex());
@ -373,7 +373,7 @@ public abstract class BaseTestWorkbook {
}
@Test
public void setSheetOrder() throws IOException {
void setSheetOrder() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
for (int i = 0; i < 10; i++) {
@ -441,7 +441,7 @@ public abstract class BaseTestWorkbook {
}
@Test
public void cloneSheet() throws IOException {
protected void cloneSheet() throws IOException {
try (Workbook book = _testDataProvider.createWorkbook()) {
Sheet sheet = book.createSheet("TEST");
sheet.createRow(0).createCell(0).setCellValue("Test");
@ -470,7 +470,7 @@ public abstract class BaseTestWorkbook {
}
@Test
public void parentReferences() throws IOException {
protected void parentReferences() throws IOException {
try (Workbook wb1 = _testDataProvider.createWorkbook()) {
Sheet sheet = wb1.createSheet();
assertSame(wb1, sheet.getWorkbook());
@ -503,7 +503,7 @@ public abstract class BaseTestWorkbook {
* is still working correctly
*/
@Test
public void setRepeatingRowsAnsColumns() throws IOException {
void setRepeatingRowsAnsColumns() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
CellRangeAddress cra = new CellRangeAddress(0, 3, 0, 0);
String expRows = "1:4", expCols = "A:A";
@ -528,7 +528,7 @@ public abstract class BaseTestWorkbook {
* Tests that all of the unicode capable string fields can be set, written and then read back
*/
@Test
public void unicodeInAll() throws IOException {
protected void unicodeInAll() throws IOException {
try (Workbook wb1 = _testDataProvider.createWorkbook()) {
CreationHelper factory = wb1.getCreationHelper();
//Create a unicode dataformat (contains euro symbol)
@ -645,7 +645,7 @@ public abstract class BaseTestWorkbook {
* @see <a href="https://issues.apache.org/bugzilla/show_bug.cgi?id=47100">Bugzilla 47100</a>
*/
@Test
public void setSheetName() throws IOException {
protected void setSheetName() throws IOException {
try (Workbook wb1 = newSetSheetNameTestingWorkbook()) {
Sheet sh1 = wb1.getSheetAt(0);
@ -724,7 +724,7 @@ public abstract class BaseTestWorkbook {
}
@Test
public void changeSheetNameWithSharedFormulas() throws IOException {
void changeSheetNameWithSharedFormulas() throws IOException {
String sampleFile = "shared_formulas.xls" + (getClass().getName().contains("xssf") ? "x" : "");
try (Workbook wb = _testDataProvider.openSampleWorkbook(sampleFile)) {
@ -781,7 +781,7 @@ public abstract class BaseTestWorkbook {
@Test
public void windowOneDefaults() throws IOException {
void windowOneDefaults() throws IOException {
try (Workbook b = _testDataProvider.createWorkbook()) {
assertEquals(b.getActiveSheetIndex(), 0);
assertEquals(b.getFirstVisibleTab(), 0);
@ -790,7 +790,7 @@ public abstract class BaseTestWorkbook {
}
@Test
public void getSpreadsheetVersion() throws IOException {
void getSpreadsheetVersion() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
assertEquals(_testDataProvider.getSpreadsheetVersion(), wb.getSpreadsheetVersion());
}
@ -805,7 +805,7 @@ public abstract class BaseTestWorkbook {
}
@Test
public void sheetClone() throws IOException {
protected void sheetClone() throws IOException {
// First up, try a simple file
try (Workbook b = _testDataProvider.createWorkbook();
Workbook bBack = HSSFTestDataSamples.openSampleWorkbook("SheetWithDrawing.xls")) {
@ -825,7 +825,7 @@ public abstract class BaseTestWorkbook {
}
@Test
public void getSheetIndex() throws IOException {
void getSheetIndex() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
Sheet sheet1 = wb.createSheet("Sheet1");
Sheet sheet2 = wb.createSheet("Sheet2");
@ -850,7 +850,7 @@ public abstract class BaseTestWorkbook {
}
@Test
public void addSheetTwice() throws IOException {
void addSheetTwice() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
Sheet sheet1 = wb.createSheet("Sheet1");
assertNotNull(sheet1);
@ -865,7 +865,7 @@ public abstract class BaseTestWorkbook {
// bug 51233 and 55075: correctly size image if added to a row with a custom height
@Test
public void createDrawing() throws Exception {
void createDrawing() throws Exception {
try (Workbook wb = _testDataProvider.createWorkbook()) {
Sheet sheet = wb.createSheet("Main Sheet");
Row row0 = sheet.createRow(0);

View File

@ -31,7 +31,7 @@ public abstract class BaseTestXEvaluationSheet {
protected abstract Map.Entry<Sheet, EvaluationSheet> getInstance();
@Test
public void lastRowNumIsUpdatedFromUnderlyingSheet_bug62993() {
void lastRowNumIsUpdatedFromUnderlyingSheet_bug62993() {
Map.Entry<Sheet, EvaluationSheet> sheetPair = getInstance();
Sheet underlyingSheet = sheetPair.getKey();
EvaluationSheet instance = sheetPair.getValue();

View File

@ -65,7 +65,7 @@ public class TestDateUtil {
}
@Test
public void getJavaDate_InvalidValue() {
void getJavaDate_InvalidValue() {
final double dateValue = -1;
final TimeZone tz = LocaleUtil.getUserTimeZone();
final boolean use1904windowing = false;
@ -79,7 +79,7 @@ public class TestDateUtil {
}
@Test
public void getJavaDate_ValidValue() {
void getJavaDate_ValidValue() {
final double dateValue = 0;
final TimeZone tz = LocaleUtil.getUserTimeZone();
final boolean use1904windowing = false;
@ -96,7 +96,7 @@ public class TestDateUtil {
}
@Test
public void getJavaCalendar_InvalidValue() {
void getJavaCalendar_InvalidValue() {
final double dateValue = -1;
final TimeZone tz = LocaleUtil.getUserTimeZone();
final boolean use1904windowing = false;
@ -109,7 +109,7 @@ public class TestDateUtil {
}
@Test
public void getJavaCalendar_ValidValue() {
void getJavaCalendar_ValidValue() {
final double dateValue = 0;
final TimeZone tz = LocaleUtil.getUserTimeZone();
final boolean use1904windowing = false;
@ -130,7 +130,7 @@ public class TestDateUtil {
}
@Test
public void getLocalDateTime_InvalidValue() {
void getLocalDateTime_InvalidValue() {
final double dateValue = -1;
final boolean use1904windowing = false;
final boolean roundSeconds = false;
@ -141,7 +141,7 @@ public class TestDateUtil {
}
@Test
public void getLocalDateTime_ValidValue() {
void getLocalDateTime_ValidValue() {
final double dateValue = 0;
final boolean use1904windowing = false;
final boolean roundSeconds = false;
@ -155,7 +155,7 @@ public class TestDateUtil {
}
@Test
public void isADateFormat() {
void isADateFormat() {
// Cell content 2016-12-8 as an example
// Cell show "12/8/2016"
assertTrue(DateUtil.isADateFormat(14, "m/d/yy"));
@ -187,7 +187,7 @@ public class TestDateUtil {
* Checks the date conversion functions in the DateUtil class.
*/
@Test
public void dateConversion() {
void dateConversion() {
// Iterating over the hours exposes any rounding issues.
Calendar cal = LocaleUtil.getLocaleCalendar(2002,JANUARY,1,0,1,1);
@ -232,7 +232,7 @@ public class TestDateUtil {
* Daylight Saving Time starts.
*/
@Test
public void excelConversionOnDSTStart() {
void excelConversionOnDSTStart() {
Calendar cal = LocaleUtil.getLocaleCalendar(2004,MARCH,28,0,0,0);
for (int hour = 0; hour < 24; hour++) {
@ -270,7 +270,7 @@ public class TestDateUtil {
* Daylight Saving Time starts.
*/
@Test
public void javaConversionOnDSTStart() {
void javaConversionOnDSTStart() {
Calendar cal = LocaleUtil.getLocaleCalendar(2004,MARCH,28,0,0,0);
double excelDate = DateUtil.getExcelDate(cal.getTime(), false);
double oneHour = 1.0 / 24;
@ -303,7 +303,7 @@ public class TestDateUtil {
* Daylight Saving Time ends.
*/
@Test
public void excelConversionOnDSTEnd() {
void excelConversionOnDSTEnd() {
Calendar cal = LocaleUtil.getLocaleCalendar(2004,OCTOBER,31,0,0,0);
for (int hour = 0; hour < 24; hour++) {
cal.set(Calendar.HOUR_OF_DAY, hour);
@ -332,7 +332,7 @@ public class TestDateUtil {
* Daylight Saving Time ends.
*/
@Test
public void javaConversionOnDSTEnd() {
void javaConversionOnDSTEnd() {
Calendar cal = LocaleUtil.getLocaleCalendar(2004,OCTOBER,31,0,0,0);
double excelDate = DateUtil.getExcelDate(cal.getTime(), false);
double oneHour = 1.0 / 24;
@ -354,7 +354,7 @@ public class TestDateUtil {
* Tests that we deal with time-zones properly
*/
@Test
public void calendarConversion() {
void calendarConversion() {
TimeZone userTZ = LocaleUtil.getUserTimeZone();
LocaleUtil.setUserTimeZone(TimeZone.getTimeZone("CET"));
try {
@ -400,7 +400,7 @@ public class TestDateUtil {
* Tests that we correctly detect date formats as such
*/
@Test
public void identifyDateFormats() {
void identifyDateFormats() {
// First up, try with a few built in date formats
short[] builtins = new short[] { 0x0e, 0x0f, 0x10, 0x16, 0x2d, 0x2e };
for (short builtin : builtins) {
@ -492,7 +492,7 @@ public class TestDateUtil {
}
@Test
public void excelDateBorderCases() throws ParseException {
void excelDateBorderCases() throws ParseException {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd", Locale.ROOT);
df.setTimeZone(LocaleUtil.getUserTimeZone());
@ -511,7 +511,7 @@ public class TestDateUtil {
}
@Test
public void dateBug_2Excel() {
void dateBug_2Excel() {
assertEquals(59.0, DateUtil.getExcelDate(createDate(1900, FEBRUARY, 28), false), 0.00001);
assertEquals(61.0, DateUtil.getExcelDate(createDate(1900, MARCH, 1), false), 0.00001);
@ -531,7 +531,7 @@ public class TestDateUtil {
}
@Test
public void dateBug_2Java() {
void dateBug_2Java() {
assertEquals(createDate(1900, FEBRUARY, 28), DateUtil.getJavaDate(59.0, false));
assertEquals(createDate(1900, MARCH, 1), DateUtil.getJavaDate(61.0, false));
@ -551,7 +551,7 @@ public class TestDateUtil {
}
@Test
public void date1904() {
void date1904() {
assertEquals(createDate(1904, JANUARY, 2), DateUtil.getJavaDate(1.0, true));
assertEquals(createDate(1904, JANUARY, 1), DateUtil.getJavaDate(0.0, true));
assertEquals(0.0, DateUtil.getExcelDate(createDate(1904, JANUARY, 1), true), 0.00001);
@ -597,7 +597,7 @@ public class TestDateUtil {
* Check if DateUtil.getAbsoluteDay works as advertised.
*/
@Test
public void absoluteDay() {
void absoluteDay() {
// 1 Jan 1900 is 1 day after 31 Dec 1899
Calendar cal = LocaleUtil.getLocaleCalendar(1900,JANUARY,1,0,0,0);
assertEquals(1, DateUtil.absoluteDay(cal, false), "Checking absolute day (1 Jan 1900)");
@ -610,7 +610,7 @@ public class TestDateUtil {
}
@Test
public void absoluteDayYearTooLow() {
void absoluteDayYearTooLow() {
Calendar cal = LocaleUtil.getLocaleCalendar(1899,JANUARY,1,0,0,0);
assertThrows(IllegalArgumentException.class, () -> DateUtil.absoluteDay(cal, false));
@ -623,7 +623,7 @@ public class TestDateUtil {
}
@Test
public void convertTime() {
void convertTime() {
final double delta = 1E-7; // a couple of digits more accuracy than strictly required
assertEquals(0.5, DateUtil.convertTime("12:00"), delta);
@ -633,7 +633,7 @@ public class TestDateUtil {
}
@Test
public void parseDate() {
void parseDate() {
assertEquals(createDate(2008, AUGUST, 3), DateUtil.parseYYYYMMDDDate("2008/08/03"));
assertEquals(createDate(1994, MAY, 1), DateUtil.parseYYYYMMDDDate("1994/05/01"));
}
@ -642,7 +642,7 @@ public class TestDateUtil {
* Ensure that date values *with* a fractional portion get the right time of day
*/
@Test
public void convertDateTime() {
void convertDateTime() {
// Excel day 30000 is date 18-Feb-1982
// 0.7 corresponds to time 16:48:00
Date actual = DateUtil.getJavaDate(30000.7);
@ -660,7 +660,7 @@ public class TestDateUtil {
* Setting Cell's value to Jan 1, 1900 without a time doesn't return the same value set to
*/
@Test
public void bug19172() throws IOException {
void bug19172() throws IOException {
try (HSSFWorkbook workbook = new HSSFWorkbook()) {
HSSFSheet sheet = workbook.createSheet();
HSSFCell cell = sheet.createRow(0).createCell(0);
@ -683,7 +683,7 @@ public class TestDateUtil {
* that's formatted as ".0000"
*/
@Test
public void bug54557() {
void bug54557() {
final String format = ".0000";
boolean isDateFormat = DateUtil.isADateFormat(165, format);
@ -691,7 +691,7 @@ public class TestDateUtil {
}
@Test
public void bug56269() {
void bug56269() {
double excelFraction = 41642.45833321759d;
Calendar calNoRound = DateUtil.getJavaCalendar(excelFraction, false);
assertEquals(10, calNoRound.get(Calendar.HOUR));

View File

@ -51,7 +51,7 @@ public final class TestFractionFormat {
@Disabled("Runs for some longer time")
@Test
public void microBenchmark() {
void microBenchmark() {
FractionFormat f = new FractionFormat("", "##");
double val = 321.321;
for(int i = 0;i < 1000000;i++) {

View File

@ -28,7 +28,7 @@ import org.junit.jupiter.api.Test;
public final class TestIndexedColors {
@Test
public void fromInt() {
void fromInt() {
int[] illegalIndices = { -1, 65 };
for (int index : illegalIndices) {
assertThrows(IllegalArgumentException.class, () -> IndexedColors.fromInt(index));
@ -39,12 +39,12 @@ public final class TestIndexedColors {
}
@Test
public void getIndex() {
void getIndex() {
assertEquals(51, IndexedColors.GOLD.getIndex());
}
@Test
public void index() {
void index() {
assertEquals(51, IndexedColors.GOLD.index);
}
}

View File

@ -55,7 +55,7 @@ public abstract class BaseTestCellUtil {
}
@Test
public void setCellStyleProperty() throws IOException {
void setCellStyleProperty() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
Sheet s = wb.createSheet();
Row r = s.createRow(0);
@ -76,7 +76,7 @@ public abstract class BaseTestCellUtil {
}
@Test
public void setCellStylePropertyWithInvalidValue() throws IOException {
void setCellStylePropertyWithInvalidValue() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
Sheet s = wb.createSheet();
Row r = s.createRow(0);
@ -88,7 +88,7 @@ public abstract class BaseTestCellUtil {
}
@Test()
public void setCellStylePropertyBorderWithShortAndEnum() throws IOException {
void setCellStylePropertyBorderWithShortAndEnum() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
Sheet s = wb.createSheet();
Row r = s.createRow(0);
@ -105,7 +105,7 @@ public abstract class BaseTestCellUtil {
}
@Test
public void setCellStyleProperties() throws IOException {
void setCellStyleProperties() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
Sheet s = wb.createSheet();
Row r = s.createRow(0);
@ -133,7 +133,7 @@ public abstract class BaseTestCellUtil {
}
@Test
public void getRow() throws IOException {
void getRow() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
Sheet sh = wb.createSheet();
Row row1 = sh.createRow(0);
@ -149,7 +149,7 @@ public abstract class BaseTestCellUtil {
}
@Test
public void getCell() throws IOException {
void getCell() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
Sheet sh = wb.createSheet();
Row row = sh.createRow(0);
@ -166,7 +166,7 @@ public abstract class BaseTestCellUtil {
}
@Test
public void createCell() throws IOException {
void createCell() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
Sheet sh = wb.createSheet();
Row row = sh.createRow(0);
@ -205,7 +205,7 @@ public abstract class BaseTestCellUtil {
@Deprecated
@SuppressWarnings("deprecated")
@Test
public void setAlignment() throws IOException {
void setAlignment() throws IOException {
Workbook wb = _testDataProvider.createWorkbook();
Sheet sh = wb.createSheet();
Row row = sh.createRow(0);
@ -233,7 +233,7 @@ public abstract class BaseTestCellUtil {
}
@Test
public void setAlignmentEnum() throws IOException {
void setAlignmentEnum() throws IOException {
Workbook wb = _testDataProvider.createWorkbook();
Sheet sh = wb.createSheet();
Row row = sh.createRow(0);
@ -261,7 +261,7 @@ public abstract class BaseTestCellUtil {
}
@Test
public void setVerticalAlignmentEnum() throws IOException {
void setVerticalAlignmentEnum() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
Sheet sh = wb.createSheet();
Row row = sh.createRow(0);
@ -288,7 +288,7 @@ public abstract class BaseTestCellUtil {
}
@Test
public void setFont() throws IOException {
void setFont() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
Sheet sh = wb.createSheet();
Row row = sh.createRow(0);
@ -320,7 +320,7 @@ public abstract class BaseTestCellUtil {
}
@Test
public void setFontFromDifferentWorkbook() throws IOException {
void setFontFromDifferentWorkbook() throws IOException {
try (Workbook wb1 = _testDataProvider.createWorkbook();
Workbook wb2 = _testDataProvider.createWorkbook()) {
Font font1 = wb1.createFont();
@ -344,7 +344,7 @@ public abstract class BaseTestCellUtil {
* @since POI 3.15 beta 3
*/
@Test
public void setFillForegroundColorBeforeFillBackgroundColorEnum() throws IOException {
void setFillForegroundColorBeforeFillBackgroundColorEnum() throws IOException {
try (Workbook wb1 = _testDataProvider.createWorkbook()) {
Cell A1 = wb1.createSheet().createRow(0).createCell(0);
Map<String, Object> properties = new HashMap<>();
@ -365,7 +365,7 @@ public abstract class BaseTestCellUtil {
* @since POI 4.1.0
*/
@Test
public void setFontShouldNotCreateDuplicateStyle() throws IOException {
void setFontShouldNotCreateDuplicateStyle() throws IOException {
Workbook wb1 = _testDataProvider.createWorkbook();
Cell c = wb1.createSheet().createRow(1).createCell(1);
Font f = wb1.createFont();

View File

@ -55,7 +55,7 @@ public class NumberComparingSpreadsheetGenerator {
_rowIndex = 1;
}
public void addTestRow(double a, double b, int expResult) {
void addTestRow(double a, double b, int expResult) {
writeDataRow(_sheet, _rowIndex++, a, b, expResult);
}
}

Some files were not shown because too many files have changed in this diff Show More