Sonar fixes

JUnit5 test classes and methods should have default package visibility

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1885340 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andreas Beeker 2021-01-10 21:16:04 +00:00
parent cc7cd1caf3
commit 1041a876cb
371 changed files with 463 additions and 472 deletions

View File

@ -23,7 +23,7 @@ import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
public class TestExcelAntPrecision { class TestExcelAntPrecision {
private ExcelAntPrecision fixture ; private ExcelAntPrecision fixture ;

View File

@ -25,7 +25,7 @@ import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
public class TestExcelAntSet { class TestExcelAntSet {
// This is abstract in nature, so we'll use a // This is abstract in nature, so we'll use a

View File

@ -25,7 +25,7 @@ import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
public class TestExcelAntSetDoubleCell { class TestExcelAntSetDoubleCell {
private ExcelAntSetDoubleCell fixture ; private ExcelAntSetDoubleCell fixture ;

View File

@ -22,7 +22,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
public class TestExcelAntUserDefinedFunction { class TestExcelAntUserDefinedFunction {
private ExcelAntUserDefinedFunctionTestHelper fixture ; private ExcelAntUserDefinedFunctionTestHelper fixture ;

View File

@ -23,7 +23,7 @@ import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
public class TestExcelAntEvaluationResult { class TestExcelAntEvaluationResult {
private ExcelAntEvaluationResult fixture; private ExcelAntEvaluationResult fixture;
private boolean completedWithError; private boolean completedWithError;

View File

@ -40,7 +40,7 @@ import org.apache.tools.ant.BuildException;
import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
public class TestExcelAntWorkbookUtil { class TestExcelAntWorkbookUtil {
private static final String mortgageCalculatorFileName = private static final String mortgageCalculatorFileName =
TestBuildFile.getDataDir() + "/spreadsheet/excelant.xls" ; TestBuildFile.getDataDir() + "/spreadsheet/excelant.xls" ;

View File

@ -26,7 +26,7 @@ import org.junit.jupiter.api.Test;
/** /**
* Tests for the ExcelAntWorbookUtilFactory. * Tests for the ExcelAntWorbookUtilFactory.
*/ */
public class TestExcelAntWorkbookUtilFactory { class TestExcelAntWorkbookUtilFactory {
private static final String mortgageCalculatorWorkbookFile = private static final String mortgageCalculatorWorkbookFile =
TestBuildFile.getDataDir() + "/spreadsheet/mortgage-calculation.xls" ; TestBuildFile.getDataDir() + "/spreadsheet/mortgage-calculation.xls" ;

View File

@ -29,6 +29,7 @@ import java.util.zip.ZipException;
import org.apache.poi.EncryptedDocumentException; import org.apache.poi.EncryptedDocumentException;
import org.apache.poi.OldFileFormatException; import org.apache.poi.OldFileFormatException;
import org.apache.poi.poifs.filesystem.OfficeXmlFileException; import org.apache.poi.poifs.filesystem.OfficeXmlFileException;
import org.junit.jupiter.api.Test;
/** /**
* This class is used for mass-regression testing via a * This class is used for mass-regression testing via a
@ -37,7 +38,7 @@ import org.apache.poi.poifs.filesystem.OfficeXmlFileException;
* types of files/exceptions, e.g. old file formats. * types of files/exceptions, e.g. old file formats.
* *
*/ */
public class BaseIntegrationTest { class BaseIntegrationTest {
private final File rootDir; private final File rootDir;
private final String file; private final String file;
private FileHandler handler; private FileHandler handler;
@ -48,7 +49,8 @@ public class BaseIntegrationTest {
this.handler = handler; this.handler = handler;
} }
public void test() throws Exception { @Test
void test() throws Exception {
assertNotNull( handler, "Unknown file extension for file: " + file + ": " + TestAllFiles.getExtension(file) ); assertNotNull( handler, "Unknown file extension for file: " + file + ": " + TestAllFiles.getExtension(file) );
testOneFile(new File(rootDir, file)); testOneFile(new File(rootDir, file));
} }

View File

@ -31,7 +31,7 @@ import org.apache.poi.hdgf.streams.TrailerStream;
import org.apache.poi.poifs.filesystem.POIFSFileSystem; import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
public class HDGFFileHandler extends POIFSFileHandler { class HDGFFileHandler extends POIFSFileHandler {
@Override @Override
public void handleFile(InputStream stream, String path) throws IOException { public void handleFile(InputStream stream, String path) throws IOException {
POIFSFileSystem poifs = new POIFSFileSystem(stream); POIFSFileSystem poifs = new POIFSFileSystem(stream);
@ -54,7 +54,7 @@ public class HDGFFileHandler extends POIFSFileHandler {
// a test-case to test this locally without executing the full TestAllFiles // a test-case to test this locally without executing the full TestAllFiles
@Override @Override
@Test @Test
public void test() throws Exception { void test() throws Exception {
File file = new File("test-data/diagram/44501.vsd"); File file = new File("test-data/diagram/44501.vsd");
InputStream stream = new FileInputStream(file); InputStream stream = new FileInputStream(file);

View File

@ -32,7 +32,7 @@ import org.apache.poi.poifs.filesystem.FileMagic;
import org.apache.poi.util.LittleEndian; import org.apache.poi.util.LittleEndian;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
public class HMEFFileHandler extends AbstractFileHandler { class HMEFFileHandler extends AbstractFileHandler {
@Override @Override
public void handleExtracting(File file) throws Exception { public void handleExtracting(File file) throws Exception {
@ -64,7 +64,7 @@ public class HMEFFileHandler extends AbstractFileHandler {
// a test-case to test this locally without executing the full TestAllFiles // a test-case to test this locally without executing the full TestAllFiles
@Test @Test
public void test() throws Exception { void test() throws Exception {
String path = "test-data/hmef/quick-winmail.dat"; String path = "test-data/hmef/quick-winmail.dat";
try (InputStream stream = new FileInputStream(path)) { try (InputStream stream = new FileInputStream(path)) {
handleFile(stream, path); handleFile(stream, path);

View File

@ -27,7 +27,7 @@ import org.apache.poi.hpbf.extractor.PublisherTextExtractor;
import org.apache.poi.poifs.filesystem.POIFSFileSystem; import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
public class HPBFFileHandler extends POIFSFileHandler { class HPBFFileHandler extends POIFSFileHandler {
@Override @Override
public void handleFile(InputStream stream, String path) throws Exception { public void handleFile(InputStream stream, String path) throws Exception {
HPBFDocument pub = new HPBFDocument(new POIFSFileSystem(stream)); HPBFDocument pub = new HPBFDocument(new POIFSFileSystem(stream));
@ -42,7 +42,7 @@ public class HPBFFileHandler extends POIFSFileHandler {
// a test-case to test this locally without executing the full TestAllFiles // a test-case to test this locally without executing the full TestAllFiles
@Override @Override
@Test @Test
public void test() throws Exception { void test() throws Exception {
File file = new File("test-data/publisher/SampleBrochure.pub"); File file = new File("test-data/publisher/SampleBrochure.pub");
InputStream stream = new FileInputStream(file); InputStream stream = new FileInputStream(file);

View File

@ -43,7 +43,7 @@ import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.util.TempFile; import org.apache.poi.util.TempFile;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
public class HPSFFileHandler extends POIFSFileHandler { class HPSFFileHandler extends POIFSFileHandler {
private static final String NL = System.getProperty("line.separator"); private static final String NL = System.getProperty("line.separator");
private static File copyOutput; private static File copyOutput;
@ -120,7 +120,7 @@ public class HPSFFileHandler extends POIFSFileHandler {
@Override @Override
@Test @Test
@SuppressWarnings("java:S2699") @SuppressWarnings("java:S2699")
public void test() throws Exception { void test() throws Exception {
String path = "test-data/diagram/44501.vsd"; String path = "test-data/diagram/44501.vsd";
try (InputStream stream = new FileInputStream(path)) { try (InputStream stream = new FileInputStream(path)) {
handleFile(stream, path); handleFile(stream, path);
@ -129,7 +129,7 @@ public class HPSFFileHandler extends POIFSFileHandler {
// a test-case to test this locally without executing the full TestAllFiles // a test-case to test this locally without executing the full TestAllFiles
@Test @Test
public void testExtractor() { void testExtractor() {
File file = new File("test-data/hpsf/TestBug44375.xls"); File file = new File("test-data/hpsf/TestBug44375.xls");
assertDoesNotThrow(() -> handleExtracting(file)); assertDoesNotThrow(() -> handleExtracting(file));
} }

View File

@ -29,7 +29,7 @@ import org.apache.poi.util.POILogger;
import org.apache.poi.util.SystemOutLogger; import org.apache.poi.util.SystemOutLogger;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
public class HSLFFileHandler extends SlideShowHandler { class HSLFFileHandler extends SlideShowHandler {
@Override @Override
public void handleFile(InputStream stream, String path) throws Exception { public void handleFile(InputStream stream, String path) throws Exception {
HSLFSlideShowImpl slide = new HSLFSlideShowImpl(stream); HSLFSlideShowImpl slide = new HSLFSlideShowImpl(stream);
@ -51,14 +51,14 @@ public class HSLFFileHandler extends SlideShowHandler {
} }
@Test @Test
public void testOne() throws Exception { void testOne() throws Exception {
testOneFile(new File("test-data/slideshow/54880_chinese.ppt")); testOneFile(new File("test-data/slideshow/54880_chinese.ppt"));
} }
// a test-case to test all .ppt files without executing the full TestAllFiles // a test-case to test all .ppt files without executing the full TestAllFiles
@Override @Override
@Test @Test
public void test() throws Exception { void test() throws Exception {
File[] files = new File("test-data/slideshow/").listFiles((dir, name) -> name.endsWith(".ppt")); File[] files = new File("test-data/slideshow/").listFiles((dir, name) -> name.endsWith(".ppt"));
assertNotNull(files); assertNotNull(files);

View File

@ -27,7 +27,7 @@ import org.apache.poi.hsmf.datatypes.AttachmentChunks;
import org.apache.poi.hsmf.datatypes.DirectoryChunk; import org.apache.poi.hsmf.datatypes.DirectoryChunk;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
public class HSMFFileHandler extends POIFSFileHandler { class HSMFFileHandler extends POIFSFileHandler {
@Override @Override
public void handleFile(InputStream stream, String path) throws Exception { public void handleFile(InputStream stream, String path) throws Exception {
MAPIMessage mapi = new MAPIMessage(stream); MAPIMessage mapi = new MAPIMessage(stream);
@ -77,7 +77,7 @@ public class HSMFFileHandler extends POIFSFileHandler {
// a test-case to test this locally without executing the full TestAllFiles // a test-case to test this locally without executing the full TestAllFiles
@Override @Override
@Test @Test
public void test() throws Exception { void test() throws Exception {
File file = new File("test-data/hsmf/logsat.com_signatures_valid.msg"); File file = new File("test-data/hsmf/logsat.com_signatures_valid.msg");
try (InputStream stream = new FileInputStream(file)) { try (InputStream stream = new FileInputStream(file)) {
handleFile(stream, file.getPath()); handleFile(stream, file.getPath());

View File

@ -36,7 +36,7 @@ import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.util.NullPrintStream; import org.apache.poi.util.NullPrintStream;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
public class HSSFFileHandler extends SpreadsheetHandler { class HSSFFileHandler extends SpreadsheetHandler {
private final POIFSFileHandler delegate = new POIFSFileHandler(); private final POIFSFileHandler delegate = new POIFSFileHandler();
@Override @Override
public void handleFile(InputStream stream, String path) throws Exception { public void handleFile(InputStream stream, String path) throws Exception {
@ -106,7 +106,7 @@ public class HSSFFileHandler extends SpreadsheetHandler {
// a test-case to test this locally without executing the full TestAllFiles // a test-case to test this locally without executing the full TestAllFiles
@Test @Test
public void test() throws Exception { void test() throws Exception {
File file = new File("test-data/spreadsheet/49219.xls"); File file = new File("test-data/spreadsheet/49219.xls");
try (InputStream stream = new FileInputStream(file)) { try (InputStream stream = new FileInputStream(file)) {
@ -121,7 +121,7 @@ public class HSSFFileHandler extends SpreadsheetHandler {
// a test-case to test this locally without executing the full TestAllFiles // a test-case to test this locally without executing the full TestAllFiles
@Test @Test
@SuppressWarnings("java:S2699") @SuppressWarnings("java:S2699")
public void testExtractor() throws Exception { void testExtractor() throws Exception {
handleExtracting(new File("test-data/spreadsheet/BOOK_in_capitals.xls")); handleExtracting(new File("test-data/spreadsheet/BOOK_in_capitals.xls"));
} }
} }

View File

@ -33,7 +33,7 @@ import org.junit.jupiter.api.Test;
* Needs to be implemented in this package to have access to * Needs to be implemented in this package to have access to
* HSSFWorkbook.getWorkbook() * HSSFWorkbook.getWorkbook()
*/ */
public class HSSFRecordsStresser { class HSSFRecordsStresser {
public static void handleWorkbook(HSSFWorkbook wb) { public static void handleWorkbook(HSSFWorkbook wb) {
List<org.apache.poi.hssf.record.Record> records = wb.getWorkbook().getRecords(); List<org.apache.poi.hssf.record.Record> records = wb.getWorkbook().getRecords();
for(org.apache.poi.hssf.record.Record record : records) { for(org.apache.poi.hssf.record.Record record : records) {
@ -65,7 +65,7 @@ public class HSSFRecordsStresser {
// a test-case to test this locally without executing the full TestAllFiles // a test-case to test this locally without executing the full TestAllFiles
@Test @Test
public void test() throws Exception { void test() throws Exception {
try (InputStream stream = new FileInputStream(HSSFTestDataSamples.getSampleFile("15556.xls"))) { try (InputStream stream = new FileInputStream(HSSFTestDataSamples.getSampleFile("15556.xls"))) {
HSSFWorkbook wb = new HSSFWorkbook(stream); HSSFWorkbook wb = new HSSFWorkbook(stream);
handleWorkbook(wb); handleWorkbook(wb);

View File

@ -30,7 +30,7 @@ import org.apache.poi.hwpf.model.PicturesTable;
import org.apache.poi.hwpf.usermodel.Picture; import org.apache.poi.hwpf.usermodel.Picture;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
public class HWPFFileHandler extends POIFSFileHandler { class HWPFFileHandler extends POIFSFileHandler {
@Override @Override
public void handleFile(InputStream stream, String path) throws Exception { public void handleFile(InputStream stream, String path) throws Exception {
HWPFDocument doc = new HWPFDocument(stream); HWPFDocument doc = new HWPFDocument(stream);
@ -49,7 +49,7 @@ public class HWPFFileHandler extends POIFSFileHandler {
@Override @Override
@Test @Test
@SuppressWarnings("java:S2699") @SuppressWarnings("java:S2699")
public void test() throws Exception { void test() throws Exception {
File file = new File("test-data/document/52117.doc"); File file = new File("test-data/document/52117.doc");
try (InputStream stream = new FileInputStream(file)) { try (InputStream stream = new FileInputStream(file)) {
@ -65,7 +65,7 @@ public class HWPFFileHandler extends POIFSFileHandler {
} }
@Test @Test
public void testExtractingOld() { void testExtractingOld() {
File file = new File("test-data/document/52117.doc"); File file = new File("test-data/document/52117.doc");
assertDoesNotThrow(() -> handleExtracting(file)); assertDoesNotThrow(() -> handleExtracting(file));
} }

View File

@ -30,7 +30,7 @@ import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.xwpf.usermodel.XWPFRelation; import org.apache.poi.xwpf.usermodel.XWPFRelation;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
public class OPCFileHandler extends AbstractFileHandler { class OPCFileHandler extends AbstractFileHandler {
@Override @Override
public void handleFile(InputStream stream, String path) throws Exception { public void handleFile(InputStream stream, String path) throws Exception {
// ignore password protected files // ignore password protected files
@ -61,7 +61,7 @@ public class OPCFileHandler extends AbstractFileHandler {
// a test-case to test this locally without executing the full TestAllFiles // a test-case to test this locally without executing the full TestAllFiles
@Test @Test
public void test() throws Exception { void test() throws Exception {
File file = new File("test-data/diagram/test.vsdx"); File file = new File("test-data/diagram/test.vsdx");
try (InputStream stream = new PushbackInputStream(new FileInputStream(file), 100000)) { try (InputStream stream = new PushbackInputStream(new FileInputStream(file), 100000)) {

View File

@ -30,7 +30,7 @@ import org.apache.poi.hpsf.extractor.HPSFPropertiesExtractor;
import org.apache.poi.poifs.filesystem.POIFSFileSystem; import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
public class POIFSFileHandler extends AbstractFileHandler { class POIFSFileHandler extends AbstractFileHandler {
@Override @Override
public void handleFile(InputStream stream, String path) throws Exception { public void handleFile(InputStream stream, String path) throws Exception {
@ -69,7 +69,7 @@ public class POIFSFileHandler extends AbstractFileHandler {
// a test-case to test this locally without executing the full TestAllFiles // a test-case to test this locally without executing the full TestAllFiles
@Test @Test
public void test() throws Exception { void test() throws Exception {
File file = new File("test-data/poifs/Notes.ole2"); File file = new File("test-data/poifs/Notes.ole2");
try (InputStream stream = new FileInputStream(file)) { try (InputStream stream = new FileInputStream(file)) {

View File

@ -49,7 +49,7 @@ import org.junit.jupiter.api.Test;
* *
* Can also be used to get the appropriate FileHandler for a single file. * Can also be used to get the appropriate FileHandler for a single file.
*/ */
public class POIFileScanner { class POIFileScanner {
private final static File ROOT_DIR; private final static File ROOT_DIR;
static { static {
// when running in Gradle, current directory might be "build/integrationtest" // when running in Gradle, current directory might be "build/integrationtest"
@ -195,7 +195,7 @@ public class POIFileScanner {
@Disabled @Disabled
@Test @Test
@SuppressForbidden("Just an ignored test") @SuppressForbidden("Just an ignored test")
public void testInvalidFile() throws IOException, InterruptedException { void testInvalidFile() throws IOException, InterruptedException {
FileHandler fileHandler = POIFileScanner.getFileHandler(new File("/usbc/CommonCrawl"), FileHandler fileHandler = POIFileScanner.getFileHandler(new File("/usbc/CommonCrawl"),
"www.bgs.ac.uk_downloads_directdownload.cfm_id=2362&noexcl=true&t=west_20sussex_20-_20building_20stone_20quarries"); "www.bgs.ac.uk_downloads_directdownload.cfm_id=2362&noexcl=true&t=west_20sussex_20-_20building_20stone_20quarries");
@ -210,13 +210,13 @@ public class POIFileScanner {
} }
@Test @Test
public void testDetectUnnamedFile() throws IOException { void testDetectUnnamedFile() throws IOException {
File root = new File(ROOT_DIR, "spreadsheet"); File root = new File(ROOT_DIR, "spreadsheet");
assertDoesNotThrow(() -> POIFileScanner.detectUnnamedFile(root, "49156.xlsx")); assertDoesNotThrow(() -> POIFileScanner.detectUnnamedFile(root, "49156.xlsx"));
} }
@Test @Test
public void test() throws IOException { void test() throws IOException {
assertDoesNotThrow(() -> POIFileScanner.scan(ROOT_DIR)); assertDoesNotThrow(() -> POIFileScanner.scan(ROOT_DIR));
} }
} }

View File

@ -68,7 +68,7 @@ import org.opentest4j.TestAbortedException;
* here as well! This is to ensure that files that should not work really do not work, e.g. * here as well! This is to ensure that files that should not work really do not work, e.g.
* that we do not remove expected sanity checks. * that we do not remove expected sanity checks.
*/ */
public class TestAllFiles { class TestAllFiles {
private static final File ROOT_DIR = new File("test-data"); private static final File ROOT_DIR = new File("test-data");
private static final boolean IGNORE_SCRATCHPAD = Boolean.getBoolean("scratchpad.ignore"); private static final boolean IGNORE_SCRATCHPAD = Boolean.getBoolean("scratchpad.ignore");
@ -384,7 +384,7 @@ public class TestAllFiles {
// ... even when using a custom display name generator // ... even when using a custom display name generator
@ParameterizedTest(name = "#{index} {0}" ) @ParameterizedTest(name = "#{index} {0}" )
@MethodSource("files") @MethodSource("files")
public void testAllFiles(String file, FileHandler handler) throws Exception { void testAllFiles(String file, FileHandler handler) throws Exception {
assertNotNull(handler, "Did not find a handler for file " + file); assertNotNull(handler, "Did not find a handler for file " + file);
// this also removes the password for non encrypted files // this also removes the password for non encrypted files

View File

@ -23,7 +23,7 @@ import org.apache.poi.openxml4j.opc.PackageAccess;
import org.apache.poi.xdgf.usermodel.XmlVisioDocument; import org.apache.poi.xdgf.usermodel.XmlVisioDocument;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
public class XDGFFileHandler extends AbstractFileHandler { class XDGFFileHandler extends AbstractFileHandler {
@Override @Override
public void handleFile(InputStream stream, String path) throws Exception { public void handleFile(InputStream stream, String path) throws Exception {
// ignore password protected files // ignore password protected files
@ -36,7 +36,7 @@ public class XDGFFileHandler extends AbstractFileHandler {
// a test-case to test this locally without executing the full TestAllFiles // a test-case to test this locally without executing the full TestAllFiles
@Test @Test
@SuppressWarnings("java:S2699") @SuppressWarnings("java:S2699")
public void test() throws Exception { void test() throws Exception {
try (OPCPackage pkg = OPCPackage.open("test-data/diagram/test.vsdx", PackageAccess.READ)) { try (OPCPackage pkg = OPCPackage.open("test-data/diagram/test.vsdx", PackageAccess.READ)) {
XmlVisioDocument doc = new XmlVisioDocument(pkg); XmlVisioDocument doc = new XmlVisioDocument(pkg);
new POIXMLDocumentHandler().handlePOIXMLDocument(doc); new POIXMLDocumentHandler().handlePOIXMLDocument(doc);

View File

@ -29,7 +29,7 @@ import org.apache.poi.xslf.usermodel.XMLSlideShow;
import org.apache.poi.xslf.usermodel.XSLFSlideShow; import org.apache.poi.xslf.usermodel.XSLFSlideShow;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
public class XSLFFileHandler extends SlideShowHandler { class XSLFFileHandler extends SlideShowHandler {
@Override @Override
public void handleFile(InputStream stream, String path) throws Exception { public void handleFile(InputStream stream, String path) throws Exception {
XMLSlideShow slide = new XMLSlideShow(stream); XMLSlideShow slide = new XMLSlideShow(stream);
@ -71,7 +71,7 @@ public class XSLFFileHandler extends SlideShowHandler {
// a test-case to test this locally without executing the full TestAllFiles // a test-case to test this locally without executing the full TestAllFiles
@Override @Override
@Test @Test
public void test() throws Exception { void test() throws Exception {
File file = new File("test-data/slideshow/ca.ubc.cs.people_~emhill_presentations_HowWeRefactor.pptx"); File file = new File("test-data/slideshow/ca.ubc.cs.people_~emhill_presentations_HowWeRefactor.pptx");
try (InputStream stream = new FileInputStream(file)) { try (InputStream stream = new FileInputStream(file)) {
handleFile(stream, file.getPath()); handleFile(stream, file.getPath());

View File

@ -16,7 +16,12 @@
==================================================================== */ ==================================================================== */
package org.apache.poi.stress; package org.apache.poi.stress;
import java.io.*; import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import org.apache.poi.openxml4j.opc.OPCPackage; import org.apache.poi.openxml4j.opc.OPCPackage;
import org.apache.poi.openxml4j.opc.PackageAccess; import org.apache.poi.openxml4j.opc.PackageAccess;
@ -26,7 +31,7 @@ import org.apache.poi.xssf.extractor.XSSFBEventBasedExcelExtractor;
import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
public class XSSFBFileHandler extends AbstractFileHandler { class XSSFBFileHandler extends AbstractFileHandler {
static { static {
//add expected failures here: //add expected failures here:
@ -81,7 +86,7 @@ public class XSSFBFileHandler extends AbstractFileHandler {
} }
@Test @Test
public void testLocal() throws Exception { void testLocal() throws Exception {
File file = new File("test-data/spreadsheet/Simple.xlsb"); File file = new File("test-data/spreadsheet/Simple.xlsb");
try (FileInputStream stream = new FileInputStream(file)) { try (FileInputStream stream = new FileInputStream(file)) {
handleFile(stream, file.getPath()); handleFile(stream, file.getPath());

View File

@ -57,7 +57,7 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
public class XSSFFileHandler extends SpreadsheetHandler { class XSSFFileHandler extends SpreadsheetHandler {
@Override @Override
public void handleFile(InputStream stream, String path) throws Exception { public void handleFile(InputStream stream, String path) throws Exception {
// ignore password protected files if password is unknown // ignore password protected files if password is unknown
@ -205,7 +205,7 @@ public class XSSFFileHandler extends SpreadsheetHandler {
// a test-case to test this locally without executing the full TestAllFiles // a test-case to test this locally without executing the full TestAllFiles
@Test @Test
public void test() throws Exception { void test() throws Exception {
File file = new File("test-data/spreadsheet/ref-56737.xlsx"); File file = new File("test-data/spreadsheet/ref-56737.xlsx");
try (InputStream stream = new BufferedInputStream(new FileInputStream(file))) { try (InputStream stream = new BufferedInputStream(new FileInputStream(file))) {
@ -216,7 +216,7 @@ public class XSSFFileHandler extends SpreadsheetHandler {
} }
@Test @Test
public void testAdditional() throws Exception { void testAdditional() throws Exception {
handleAdditional(new File("test-data/spreadsheet/poc-xmlbomb.xlsx")); handleAdditional(new File("test-data/spreadsheet/poc-xmlbomb.xlsx"));
} }
} }

View File

@ -24,7 +24,7 @@ import java.io.InputStream;
import org.apache.poi.xwpf.usermodel.XWPFDocument; import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
public class XWPFFileHandler extends AbstractFileHandler { class XWPFFileHandler extends AbstractFileHandler {
@Override @Override
public void handleFile(InputStream stream, String path) throws Exception { public void handleFile(InputStream stream, String path) throws Exception {
// ignore password protected files // ignore password protected files
@ -38,7 +38,7 @@ public class XWPFFileHandler extends AbstractFileHandler {
// a test-case to test this locally without executing the full TestAllFiles // a test-case to test this locally without executing the full TestAllFiles
@Test @Test
@SuppressWarnings("java:S2699") @SuppressWarnings("java:S2699")
public void test() throws Exception { void test() throws Exception {
File file = new File("test-data/document/51921-Word-Crash067.docx"); File file = new File("test-data/document/51921-Word-Crash067.docx");
try (InputStream stream = new BufferedInputStream(new FileInputStream(file))) { try (InputStream stream = new BufferedInputStream(new FileInputStream(file))) {

View File

@ -24,4 +24,6 @@ module org.apache.poi.stress {
requires org.apache.poi.examples; requires org.apache.poi.examples;
exports org.apache.poi.stress; exports org.apache.poi.stress;
opens org.apache.poi.stress to org.junit.platform.commons;
} }

View File

@ -39,7 +39,7 @@ import org.junit.jupiter.api.Test;
/** /**
* Test the COUNTIFS() function * Test the COUNTIFS() function
*/ */
public class CountifsTests { class TestCountifs {
private Workbook workbook; private Workbook workbook;

View File

@ -40,7 +40,7 @@ import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
public class ConditionalFormattingEvalTest { class TestConditionalFormattingEval {
private XSSFWorkbook wb; private XSSFWorkbook wb;
private Sheet sheet; private Sheet sheet;

View File

@ -27,7 +27,7 @@ import java.util.TreeMap;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
public class CombinedIteratorTest { class TestCombinedIterator {
void testIteration(CombinedIterable<String> iterable, String... expected) { void testIteration(CombinedIterable<String> iterable, String... expected) {

View File

@ -46,7 +46,7 @@ import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCell;
* *
* E.g. verifies that objects are freed when stuff is removed from sheets or rows * E.g. verifies that objects are freed when stuff is removed from sheets or rows
*/ */
public class XSSFMemoryLeakTests { public class TestXSSFMemoryLeak {
private final MemoryLeakVerifier verifier = new MemoryLeakVerifier(); private final MemoryLeakVerifier verifier = new MemoryLeakVerifier();
// keep some items in memory, so checks in tearDown() actually // keep some items in memory, so checks in tearDown() actually

View File

@ -20,7 +20,7 @@ import static org.junit.jupiter.api.Assertions.assertNull;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
public class XWPFAbstractNumTest { public class TestXWPFAbstractNum {
@Test @Test
void getXmlObject() { void getXmlObject() {

View File

@ -42,7 +42,7 @@ import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource; import org.junit.jupiter.params.provider.MethodSource;
public abstract class BasePPTIteratingTest { public abstract class BaseTestPPTIterating {
protected static final Set<String> OLD_FILES = new HashSet<>(); protected static final Set<String> OLD_FILES = new HashSet<>();
static { static {
OLD_FILES.add("PPT95.ppt"); OLD_FILES.add("PPT95.ppt");

View File

@ -16,16 +16,15 @@
==================================================================== */ ==================================================================== */
package org.apache.poi.hslf.dev; package org.apache.poi.hslf.dev;
import org.apache.poi.EmptyFileException; import static org.junit.jupiter.api.Assertions.assertThrows;
import org.junit.jupiter.api.Test;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import static org.junit.jupiter.api.Assertions.assertThrows; import org.apache.poi.EmptyFileException;
import static org.junit.jupiter.api.Assertions.fail; import org.junit.jupiter.api.Test;
public class TestPPDrawingTextListing extends BasePPTIteratingTest { public class TestPPDrawingTextListing extends BaseTestPPTIterating {
@Test @Test
void testMain() throws IOException { void testMain() throws IOException {
// calls System.exit(): PPDrawingTextListing.main(new String[0]); // calls System.exit(): PPDrawingTextListing.main(new String[0]);

View File

@ -26,7 +26,7 @@ import org.apache.poi.EmptyFileException;
import org.apache.poi.hslf.HSLFTestDataSamples; import org.apache.poi.hslf.HSLFTestDataSamples;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
public class TestPPTXMLDump extends BasePPTIteratingTest { public class TestPPTXMLDump extends BaseTestPPTIterating {
@Test @Test
void testMain() throws Exception { void testMain() throws Exception {
PPTXMLDump.main(new String[0]); PPTXMLDump.main(new String[0]);

View File

@ -17,7 +17,6 @@
package org.apache.poi.hslf.dev; package org.apache.poi.hslf.dev;
import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.fail;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@ -29,7 +28,7 @@ import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
public class TestSLWTListing extends BasePPTIteratingTest { public class TestSLWTListing extends BaseTestPPTIterating {
private static PrintStream oldStdErr; private static PrintStream oldStdErr;
@BeforeAll @BeforeAll

View File

@ -16,16 +16,15 @@
==================================================================== */ ==================================================================== */
package org.apache.poi.hslf.dev; package org.apache.poi.hslf.dev;
import org.apache.poi.EmptyFileException; import static org.junit.jupiter.api.Assertions.assertThrows;
import org.junit.jupiter.api.Test;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import static org.junit.jupiter.api.Assertions.assertThrows; import org.apache.poi.EmptyFileException;
import static org.junit.jupiter.api.Assertions.fail; import org.junit.jupiter.api.Test;
public class TestSLWTTextListing extends BasePPTIteratingTest { public class TestSLWTTextListing extends BaseTestPPTIterating {
@Test @Test
void testMain() throws IOException { void testMain() throws IOException {
// calls System.exit(): SLWTTextListing.main(new String[0]); // calls System.exit(): SLWTTextListing.main(new String[0]);

View File

@ -16,17 +16,16 @@
==================================================================== */ ==================================================================== */
package org.apache.poi.hslf.dev; package org.apache.poi.hslf.dev;
import org.apache.poi.EmptyFileException; import static org.junit.jupiter.api.Assertions.assertThrows;
import org.apache.poi.hslf.HSLFTestDataSamples;
import org.junit.jupiter.api.Test;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import static org.junit.jupiter.api.Assertions.assertThrows; import org.apache.poi.EmptyFileException;
import static org.junit.jupiter.api.Assertions.fail; import org.apache.poi.hslf.HSLFTestDataSamples;
import org.junit.jupiter.api.Test;
public class TestSlideAndNotesAtomListing extends BasePPTIteratingTest { public class TestSlideAndNotesAtomListing extends BaseTestPPTIterating {
@Test @Test
void testMain() throws IOException { void testMain() throws IOException {
// calls System.exit(): SlideAndNotesAtomListing.main(new String[0]); // calls System.exit(): SlideAndNotesAtomListing.main(new String[0]);

View File

@ -16,17 +16,16 @@
==================================================================== */ ==================================================================== */
package org.apache.poi.hslf.dev; package org.apache.poi.hslf.dev;
import org.apache.poi.EmptyFileException; import static org.junit.jupiter.api.Assertions.assertThrows;
import org.apache.poi.hslf.HSLFTestDataSamples;
import org.junit.jupiter.api.Test;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import static org.junit.jupiter.api.Assertions.assertThrows; import org.apache.poi.EmptyFileException;
import static org.junit.jupiter.api.Assertions.fail; import org.apache.poi.hslf.HSLFTestDataSamples;
import org.junit.jupiter.api.Test;
public class TestSlideIdListing extends BasePPTIteratingTest { public class TestSlideIdListing extends BaseTestPPTIterating {
@Test @Test
void testMain() throws IOException { void testMain() throws IOException {
// calls System.exit(): SlideIdListing.main(new String[0]); // calls System.exit(): SlideIdListing.main(new String[0]);

View File

@ -17,7 +17,6 @@
package org.apache.poi.hslf.dev; package org.apache.poi.hslf.dev;
import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.fail;
import java.io.File; import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
@ -31,7 +30,7 @@ import org.apache.poi.hslf.HSLFTestDataSamples;
import org.apache.poi.util.IOUtils; import org.apache.poi.util.IOUtils;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
public class TestSlideShowDumper extends BasePPTIteratingTest { public class TestSlideShowDumper extends BaseTestPPTIterating {
private static final Set<String> FAILING = new HashSet<>(); private static final Set<String> FAILING = new HashSet<>();
static { static {
FAILING.add("cryptoapi-proc2356.ppt"); FAILING.add("cryptoapi-proc2356.ppt");

View File

@ -17,7 +17,6 @@
package org.apache.poi.hslf.dev; package org.apache.poi.hslf.dev;
import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.fail;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@ -26,7 +25,7 @@ import org.apache.poi.EmptyFileException;
import org.apache.poi.hslf.HSLFTestDataSamples; import org.apache.poi.hslf.HSLFTestDataSamples;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
public class TestSlideShowRecordDumper extends BasePPTIteratingTest { public class TestSlideShowRecordDumper extends BaseTestPPTIterating {
@Test @Test
void testMain() throws IOException { void testMain() throws IOException {
SlideShowRecordDumper.main(new String[] { SlideShowRecordDumper.main(new String[] {

View File

@ -16,18 +16,17 @@
==================================================================== */ ==================================================================== */
package org.apache.poi.hslf.dev; package org.apache.poi.hslf.dev;
import org.apache.poi.EmptyFileException; import static org.junit.jupiter.api.Assertions.assertThrows;
import org.junit.jupiter.api.Test;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
import static org.junit.jupiter.api.Assertions.assertThrows; import org.apache.poi.EmptyFileException;
import static org.junit.jupiter.api.Assertions.fail; import org.junit.jupiter.api.Test;
public class TestTextStyleListing extends BasePPTIteratingTest { public class TestTextStyleListing extends BaseTestPPTIterating {
private static Set<String> FAILING = new HashSet<>(); private static Set<String> FAILING = new HashSet<>();
static { static {
FAILING.add("empty_textbox.ppt"); FAILING.add("empty_textbox.ppt");

View File

@ -16,16 +16,15 @@
==================================================================== */ ==================================================================== */
package org.apache.poi.hslf.dev; package org.apache.poi.hslf.dev;
import org.apache.poi.EmptyFileException; import static org.junit.jupiter.api.Assertions.assertThrows;
import org.junit.jupiter.api.Test;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import static org.junit.jupiter.api.Assertions.assertThrows; import org.apache.poi.EmptyFileException;
import static org.junit.jupiter.api.Assertions.fail; import org.junit.jupiter.api.Test;
public class TestUserEditAndPersistListing extends BasePPTIteratingTest { public class TestUserEditAndPersistListing extends BaseTestPPTIterating {
@Test @Test
void testMain() throws IOException { void testMain() throws IOException {
// calls System.exit(): UserEditAndPersistListing.main(new String[0]); // calls System.exit(): UserEditAndPersistListing.main(new String[0]);

View File

@ -27,7 +27,7 @@ import org.junit.jupiter.api.Test;
/** /**
* Test cases for {@link AbstractWordUtils} * Test cases for {@link AbstractWordUtils}
*/ */
public class AbstractWordUtilsTest { public class TestAbstractWordUtils {
/** /**
* Test case for {@link AbstractWordUtils#buildTableCellEdgesArray(Table)} * Test case for {@link AbstractWordUtils#buildTableCellEdgesArray(Table)}
*/ */

View File

@ -24,7 +24,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
public class PlfLfoTest { public class TestPlfLfo {
@Test @Test
void testAdd() { void testAdd() {
PlfLfo p = new PlfLfo(new byte[] {0, 0, 0, 0}, 0, 0); PlfLfo p = new PlfLfo(new byte[] {0, 0, 0, 0}, 0, 0);

View File

@ -23,7 +23,7 @@ import org.junit.jupiter.api.Test;
/** /**
* Test cases for {@link LFOLVLBaseAbstractType} * Test cases for {@link LFOLVLBaseAbstractType}
*/ */
public class LFOLVLBaseAbstractTypeTest { class TestLFOLVLBaseAbstractType {
@Test @Test
void testGetSize() { void testGetSize() {
assertEquals( 8, LFOLVLBaseAbstractType.getSize() ); assertEquals( 8, LFOLVLBaseAbstractType.getSize() );

View File

@ -23,7 +23,7 @@ import org.junit.jupiter.api.Test;
/** /**
* Test cases for {@link LVLFAbstractType} * Test cases for {@link LVLFAbstractType}
*/ */
public class LVLFAbstractTypeTest { class TestLVLFAbstractType {
@Test @Test
void testGetSize() { void testGetSize() {
assertEquals( 28, LVLFAbstractType.getSize() ); assertEquals( 28, LVLFAbstractType.getSize() );

View File

@ -41,7 +41,7 @@ import org.junit.jupiter.api.Test;
* This is part 1 of 2 of the tests - it only does the POIDocuments * This is part 1 of 2 of the tests - it only does the POIDocuments
* which are part of the Main (not scratchpad) * which are part of the Main (not scratchpad)
*/ */
public final class TestPOIDocumentMain { final class TestPOIDocumentMain {
// The POI Documents to work on // The POI Documents to work on
private POIDocument doc; private POIDocument doc;
private POIDocument doc2; private POIDocument doc2;

View File

@ -31,7 +31,7 @@ import org.junit.jupiter.api.Test;
/** /**
* A class for testing the POI Junit TestCase utility class * A class for testing the POI Junit TestCase utility class
*/ */
public final class TestPOITestCase { final class TestPOITestCase {
@Test @Test
void assertStartsWith() { void assertStartsWith() {
POITestCase.assertStartsWith("Apache POI", ""); POITestCase.assertStartsWith("Apache POI", "");

View File

@ -28,7 +28,7 @@ import org.apache.poi.util.HexDump;
import org.apache.poi.util.HexRead; import org.apache.poi.util.HexRead;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
public final class TestEscherBSERecord { final class TestEscherBSERecord {
@Test @Test
void testFillFields() { void testFillFields() {
String data = "01 00 00 00 24 00 00 00 05 05 01 02 03 04 " + String data = "01 00 00 00 24 00 00 00 05 05 01 02 03 04 " +

View File

@ -29,7 +29,7 @@ import org.junit.jupiter.api.Test;
/** /**
* Test read/serialize of escher blip records * Test read/serialize of escher blip records
*/ */
public final class TestEscherBlipRecord { final class TestEscherBlipRecord {
private static final POIDataSamples _samples = POIDataSamples.getDDFInstance(); private static final POIDataSamples _samples = POIDataSamples.getDDFInstance();
//test reading/serializing of a PNG blip //test reading/serializing of a PNG blip

View File

@ -21,7 +21,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
public final class TestEscherBoolProperty { final class TestEscherBoolProperty {
@Test @Test
void testToString() { void testToString() {
EscherBoolProperty p = new EscherBoolProperty(EscherPropertyTypes.GEOMETRY__FILLOK, 1); EscherBoolProperty p = new EscherBoolProperty(EscherPropertyTypes.GEOMETRY__FILLOK, 1);

View File

@ -23,7 +23,7 @@ import org.apache.poi.util.HexDump;
import org.apache.poi.util.HexRead; import org.apache.poi.util.HexRead;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
public final class TestEscherChildAnchorRecord { final class TestEscherChildAnchorRecord {
@Test @Test
void testSerialize() { void testSerialize() {
EscherChildAnchorRecord r = createRecord(); EscherChildAnchorRecord r = createRecord();

View File

@ -33,7 +33,7 @@ import org.junit.jupiter.api.Test;
/** /**
* Tests for {@link EscherContainerRecord} * Tests for {@link EscherContainerRecord}
*/ */
public final class TestEscherContainerRecord { final class TestEscherContainerRecord {
private static final POIDataSamples _samples = POIDataSamples.getDDFInstance(); private static final POIDataSamples _samples = POIDataSamples.getDDFInstance();
@Test @Test

View File

@ -23,7 +23,7 @@ import org.apache.poi.util.HexDump;
import org.apache.poi.util.HexRead; import org.apache.poi.util.HexRead;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
public final class TestEscherDgRecord { final class TestEscherDgRecord {
@Test @Test
void testSerialize() { void testSerialize() {
EscherDgRecord r = createRecord(); EscherDgRecord r = createRecord();

View File

@ -23,7 +23,7 @@ import org.apache.poi.util.HexDump;
import org.apache.poi.util.HexRead; import org.apache.poi.util.HexRead;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
public final class TestEscherDggRecord { final class TestEscherDggRecord {
@Test @Test
void testSerialize() { void testSerialize() {
EscherDggRecord r = createRecord(); EscherDggRecord r = createRecord();

View File

@ -27,7 +27,7 @@ import org.apache.poi.util.HexDump;
import org.apache.poi.util.HexRead; import org.apache.poi.util.HexRead;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
public final class TestEscherOptRecord { final class TestEscherOptRecord {
@Test @Test
void testFillFields() { void testFillFields() {

View File

@ -23,7 +23,7 @@ import org.apache.poi.util.HexDump;
import org.apache.poi.util.HexRead; import org.apache.poi.util.HexRead;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
public final class TestEscherSpgrRecord { final class TestEscherSpgrRecord {
@Test @Test
void testSerialize() { void testSerialize() {
EscherSpgrRecord r = createRecord(); EscherSpgrRecord r = createRecord();

View File

@ -23,7 +23,7 @@ import org.apache.poi.util.HexDump;
import org.apache.poi.util.HexRead; import org.apache.poi.util.HexRead;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
public final class TestEscherSplitMenuColorsRecord { final class TestEscherSplitMenuColorsRecord {
@Test @Test
void testSerialize() { void testSerialize() {
EscherSplitMenuColorsRecord r = createRecord(); EscherSplitMenuColorsRecord r = createRecord();

View File

@ -25,7 +25,7 @@ import org.apache.poi.util.HexDump;
import org.apache.poi.util.HexRead; import org.apache.poi.util.HexRead;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
public final class TestUnknownEscherRecord { final class TestUnknownEscherRecord {
@Test @Test
void testFillFields() { void testFillFields() {
String testData = String testData =

View File

@ -48,7 +48,7 @@ import org.junit.jupiter.api.Test;
/** /**
* <p>Tests the basic HPSF functionality.</p> * <p>Tests the basic HPSF functionality.</p>
*/ */
public final class TestBasic { final class TestBasic {
private static final POIDataSamples samples = POIDataSamples.getHPSFInstance(); private static final POIDataSamples samples = POIDataSamples.getHPSFInstance();

View File

@ -31,7 +31,7 @@ import org.junit.jupiter.api.Test;
/** /**
* Tests ClassID structure. * Tests ClassID structure.
*/ */
public final class TestClassID { final class TestClassID {
private static final byte[] BUF16 = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}; private static final byte[] BUF16 = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16};

View File

@ -45,7 +45,7 @@ import org.junit.jupiter.api.Test;
* Test case for OLE2 files with empty properties. * Test case for OLE2 files with empty properties.
* An empty property's type is {@link Variant#VT_EMPTY}. * An empty property's type is {@link Variant#VT_EMPTY}.
*/ */
public final class TestEmptyProperties { final class TestEmptyProperties {
private static final POIDataSamples samples = POIDataSamples.getHPSFInstance(); private static final POIDataSamples samples = POIDataSamples.getHPSFInstance();

View File

@ -43,7 +43,7 @@ import org.junit.jupiter.api.Test;
/** /**
* Tests various bugs have been fixed * Tests various bugs have been fixed
*/ */
public final class TestHPSFBugs { final class TestHPSFBugs {
private static final POIDataSamples _samples = POIDataSamples.getHPSFInstance(); private static final POIDataSamples _samples = POIDataSamples.getHPSFInstance();
/** /**

View File

@ -46,7 +46,7 @@ import org.junit.jupiter.api.Test;
* This class tests reading and writing of meta data. No actual document is created. All information * This class tests reading and writing of meta data. No actual document is created. All information
* is stored in a virtual document in a ByteArrayOutputStream * is stored in a virtual document in a ByteArrayOutputStream
*/ */
public final class TestMetaDataIPI { final class TestMetaDataIPI {
private POIFSFileSystem poifs ; private POIFSFileSystem poifs ;
private DocumentSummaryInformation dsi; private DocumentSummaryInformation dsi;

View File

@ -32,7 +32,7 @@ import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.poifs.filesystem.POIFSFileSystem; import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
public final class TestHPSFPropertiesExtractor { final class TestHPSFPropertiesExtractor {
private static final POIDataSamples _samples = POIDataSamples.getHPSFInstance(); private static final POIDataSamples _samples = POIDataSamples.getHPSFInstance();
@Test @Test

View File

@ -36,7 +36,7 @@ import org.junit.jupiter.api.Test;
/** /**
* Tests for {@link AbortableHSSFListener} * Tests for {@link AbortableHSSFListener}
*/ */
public final class TestAbortableListener { final class TestAbortableListener {
private POIFSFileSystem openSample() throws IOException { private POIFSFileSystem openSample() throws IOException {
ByteArrayInputStream is = new ByteArrayInputStream(HSSFITestDataProvider.instance ByteArrayInputStream is = new ByteArrayInputStream(HSSFITestDataProvider.instance

View File

@ -39,14 +39,13 @@ import org.apache.poi.hssf.record.RecordFactory;
import org.apache.poi.hssf.record.StandardRecord; import org.apache.poi.hssf.record.StandardRecord;
import org.apache.poi.hssf.record.TestcaseRecordInputStream; import org.apache.poi.hssf.record.TestcaseRecordInputStream;
import org.apache.poi.hssf.record.UnknownRecord; import org.apache.poi.hssf.record.UnknownRecord;
import org.apache.poi.util.NotImplemented;
import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
/** /**
* enclosing_type describe the purpose here * enclosing_type describe the purpose here
*/ */
public final class TestEventRecordFactory { final class TestEventRecordFactory {
private static final byte[][] CONTINUE_DATA = { private static final byte[][] CONTINUE_DATA = {
// an unknown record with 0 length // an unknown record with 0 length
{0, -1, 0, 0,}, {0, -1, 0, 0,},

View File

@ -42,7 +42,7 @@ import org.junit.jupiter.api.Test;
/** /**
* Tests for {@link EventWorkbookBuilder} * Tests for {@link EventWorkbookBuilder}
*/ */
public final class TestEventWorkbookBuilder { final class TestEventWorkbookBuilder {
private final List<FormulaRecord> fRecs = new ArrayList<>(); private final List<FormulaRecord> fRecs = new ArrayList<>();
private SheetRecordCollectingListener listener; private SheetRecordCollectingListener listener;

View File

@ -34,7 +34,7 @@ import org.junit.jupiter.api.Test;
/** /**
* Tests for FormatTrackingHSSFListener * Tests for FormatTrackingHSSFListener
*/ */
public final class TestFormatTrackingHSSFListener { final class TestFormatTrackingHSSFListener {
private FormatTrackingHSSFListener listener; private FormatTrackingHSSFListener listener;
private MockHSSFListener mockListen; private MockHSSFListener mockListen;

View File

@ -46,7 +46,7 @@ import org.junit.jupiter.api.Test;
/** /**
* Testing for {@link HSSFEventFactory} * Testing for {@link HSSFEventFactory}
*/ */
public final class TestHSSFEventFactory { final class TestHSSFEventFactory {
private final List<org.apache.poi.hssf.record.Record> records = new ArrayList<>(); private final List<org.apache.poi.hssf.record.Record> records = new ArrayList<>();
private void openSample(String sampleFileName) throws IOException { private void openSample(String sampleFileName) throws IOException {

View File

@ -45,7 +45,7 @@ import org.junit.jupiter.api.Test;
/** /**
* Tests for MissingRecordAwareHSSFListener * Tests for MissingRecordAwareHSSFListener
*/ */
public final class TestMissingRecordAwareHSSFListener { final class TestMissingRecordAwareHSSFListener {
private final List<org.apache.poi.hssf.record.Record> _records = new ArrayList<>(); private final List<org.apache.poi.hssf.record.Record> _records = new ArrayList<>();

View File

@ -39,7 +39,7 @@ import org.junit.jupiter.api.Test;
/** /**
* *
*/ */
public final class TestExcelExtractor { final class TestExcelExtractor {
private static ExcelExtractor createExtractor(String sampleFileName) throws IOException { private static ExcelExtractor createExtractor(String sampleFileName) throws IOException {
File file = HSSFTestDataSamples.getSampleFile(sampleFileName); File file = HSSFTestDataSamples.getSampleFile(sampleFileName);
POIFSFileSystem fs = new POIFSFileSystem(file); POIFSFileSystem fs = new POIFSFileSystem(file);

View File

@ -46,7 +46,7 @@ import org.junit.jupiter.api.Test;
* Unit tests for the Excel 5/95 and Excel 4 (and older) text * Unit tests for the Excel 5/95 and Excel 4 (and older) text
* extractor * extractor
*/ */
public final class TestOldExcelExtractor { final class TestOldExcelExtractor {
private static OldExcelExtractor createExtractor(String sampleFileName) throws IOException { private static OldExcelExtractor createExtractor(String sampleFileName) throws IOException {
File file = HSSFTestDataSamples.getSampleFile(sampleFileName); File file = HSSFTestDataSamples.getSampleFile(sampleFileName);
return new OldExcelExtractor(file); return new OldExcelExtractor(file);

View File

@ -24,7 +24,7 @@ import org.apache.poi.ddf.EscherDggRecord;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
public final class TestDrawingManager2 { final class TestDrawingManager2 {
private DrawingManager2 drawingManager2; private DrawingManager2 drawingManager2;
private EscherDggRecord dgg; private EscherDggRecord dgg;

View File

@ -57,7 +57,7 @@ import org.junit.jupiter.api.Test;
* Test the low level formula parser functionality. High level tests are to * Test the low level formula parser functionality. High level tests are to
* be done via usermodel/HSSFCell.setFormulaValue(). * be done via usermodel/HSSFCell.setFormulaValue().
*/ */
public final class TestFormulaParser { final class TestFormulaParser {
/** /**
* @return parsed token array already confirmed not <code>null</code> * @return parsed token array already confirmed not <code>null</code>

View File

@ -37,7 +37,7 @@ import org.junit.jupiter.api.Test;
* but using parts which need to use * but using parts which need to use
* HSSFFormulaEvaluator. * HSSFFormulaEvaluator.
*/ */
public final class TestFormulaParserEval { final class TestFormulaParserEval {
@Test @Test
void testWithNamedRange() { void testWithNamedRange() {

View File

@ -38,7 +38,7 @@ import org.junit.jupiter.api.Test;
/** /**
* Tests <tt>FormulaParser</tt> specifically with respect to IF() functions * Tests <tt>FormulaParser</tt> specifically with respect to IF() functions
*/ */
public final class TestFormulaParserIf { final class TestFormulaParserIf {
private static Ptg[] parseFormula(String formula) { private static Ptg[] parseFormula(String formula) {
return TestFormulaParser.parseFormula(formula); return TestFormulaParser.parseFormula(formula);
} }

View File

@ -49,7 +49,7 @@ import org.junit.jupiter.api.Test;
/** /**
* Tests for {@link LinkTable} * Tests for {@link LinkTable}
*/ */
public final class TestLinkTable { final class TestLinkTable {
/** /**
* The example file attached to bugzilla 45046 is a clear example of Name records being present * The example file attached to bugzilla 45046 is a clear example of Name records being present

View File

@ -37,7 +37,7 @@ import org.junit.jupiter.api.Test;
/** /**
* Tests specific formula examples in <tt>OperandClassTransformer</tt>. * Tests specific formula examples in <tt>OperandClassTransformer</tt>.
*/ */
public final class TestOperandClassTransformer { final class TestOperandClassTransformer {
private static Ptg[] parseFormula(String formula) { private static Ptg[] parseFormula(String formula) {
Ptg[] result = HSSFFormulaParser.parse(formula, null); Ptg[] result = HSSFFormulaParser.parse(formula, null);

View File

@ -19,7 +19,6 @@ package org.apache.poi.hssf.model;
import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -45,7 +44,7 @@ import org.junit.jupiter.params.provider.MethodSource;
* <tt>OperandClassTransformer</tt> by comparing its results with those * <tt>OperandClassTransformer</tt> by comparing its results with those
* directly produced by Excel (in a sample spreadsheet). * directly produced by Excel (in a sample spreadsheet).
*/ */
public final class TestRVA { final class TestRVA {
private static final String NEW_LINE = System.getProperty("line.separator"); private static final String NEW_LINE = System.getProperty("line.separator");
private static POIFSFileSystem poifs; private static POIFSFileSystem poifs;

View File

@ -21,7 +21,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
import java.util.Arrays; import java.util.Arrays;
@ -39,7 +38,7 @@ import org.junit.jupiter.api.Test;
* *
* @author Josh Micich * @author Josh Micich
*/ */
public final class TestRowBlocksReader { final class TestRowBlocksReader {
@Test @Test
void testAbnormalPivotTableRecords_bug46280() { void testAbnormalPivotTableRecords_bug46280() {
int SXVIEW_SID = ViewDefinitionRecord.sid; int SXVIEW_SID = ViewDefinitionRecord.sid;

View File

@ -50,7 +50,7 @@ import org.junit.jupiter.api.Test;
/** /**
* Unit test for the {@link InternalSheet} class. * Unit test for the {@link InternalSheet} class.
*/ */
public final class TestSheet { final class TestSheet {
private static InternalSheet createSheet(List<org.apache.poi.hssf.record.Record> inRecs) { private static InternalSheet createSheet(List<org.apache.poi.hssf.record.Record> inRecs) {
return InternalSheet.createSheet(new RecordStream(inRecs, 0)); return InternalSheet.createSheet(new RecordStream(inRecs, 0));
} }

View File

@ -23,7 +23,7 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
import org.apache.poi.hssf.record.ColumnInfoRecord; import org.apache.poi.hssf.record.ColumnInfoRecord;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
public final class TestSheetAdditional { final class TestSheetAdditional {
@Test @Test
void testGetCellWidth() { void testGetCellWidth() {
InternalSheet sheet = InternalSheet.createSheet(); InternalSheet sheet = InternalSheet.createSheet();

View File

@ -41,7 +41,7 @@ import org.junit.jupiter.api.Test;
/** /**
* Unit test for the Workbook class. * Unit test for the Workbook class.
*/ */
public final class TestWorkbook { final class TestWorkbook {
@Test @Test
void testFontStuff() throws IOException { void testFontStuff() throws IOException {
HSSFWorkbook hwb = new HSSFWorkbook(); HSSFWorkbook hwb = new HSSFWorkbook();

View File

@ -33,7 +33,7 @@ import org.apache.poi.util.HexDump;
import org.apache.poi.util.HexRead; import org.apache.poi.util.HexRead;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
public final class TestArrayRecord { final class TestArrayRecord {
@Test @Test
void testRead() { void testRead() {

View File

@ -25,7 +25,7 @@ import org.junit.jupiter.api.Test;
/** /**
* Tests the AutoFilterInfoRecord class. * Tests the AutoFilterInfoRecord class.
*/ */
public final class TestAutoFilterInfoRecord { final class TestAutoFilterInfoRecord {
private final byte[] data = new byte[] { private final byte[] data = new byte[] {
0x05, 0x00 0x05, 0x00
}; };

View File

@ -26,7 +26,7 @@ import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Sheet;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
public final class TestBOFRecord { final class TestBOFRecord {
@Test @Test
void testBOFRecord() throws IOException { void testBOFRecord() throws IOException {
// This used to throw an error before - #42794 // This used to throw an error before - #42794

View File

@ -28,7 +28,7 @@ import org.junit.jupiter.api.Test;
/** /**
* Tests for {@link BoolErrRecord} * Tests for {@link BoolErrRecord}
*/ */
public final class TestBoolErrRecord { final class TestBoolErrRecord {
@Test @Test
void testError() { void testError() {

View File

@ -32,7 +32,7 @@ import org.junit.jupiter.api.Test;
/** /**
* Tests BoundSheetRecord. * Tests BoundSheetRecord.
*/ */
public final class TestBoundSheetRecord { final class TestBoundSheetRecord {
@Test @Test
void testRecordLength() { void testRecordLength() {

View File

@ -29,7 +29,7 @@ import org.junit.jupiter.api.Test;
* Tests the serialization and deserialization of the {@link CFHeaderRecord} * Tests the serialization and deserialization of the {@link CFHeaderRecord}
* and {@link CFHeader12Record} classes works correctly. * and {@link CFHeader12Record} classes works correctly.
*/ */
public final class TestCFHeaderRecord { final class TestCFHeaderRecord {
@Test @Test
void testCreateCFHeaderRecord () { void testCreateCFHeaderRecord () {
CFHeaderRecord record = new CFHeaderRecord(); CFHeaderRecord record = new CFHeaderRecord();

View File

@ -48,7 +48,7 @@ import org.junit.jupiter.api.Test;
* Tests the serialization and deserialization of the TestCFRuleRecord * Tests the serialization and deserialization of the TestCFRuleRecord
* class works correctly. * class works correctly.
*/ */
public final class TestCFRuleRecord { final class TestCFRuleRecord {
@Test @Test
void testConstructors () throws IOException { void testConstructors () throws IOException {
try (HSSFWorkbook workbook = new HSSFWorkbook()) { try (HSSFWorkbook workbook = new HSSFWorkbook()) {

View File

@ -27,7 +27,7 @@ import org.junit.jupiter.api.Test;
/** /**
* Tests for {@link ColumnInfoRecord} * Tests for {@link ColumnInfoRecord}
*/ */
public final class TestColumnInfoRecord { final class TestColumnInfoRecord {
@Test @Test
void testBasic() { void testBasic() {

View File

@ -30,7 +30,7 @@ import org.junit.jupiter.api.Test;
* class works correctly. Test data taken directly from a real * class works correctly. Test data taken directly from a real
* Excel file. * Excel file.
*/ */
public final class TestCommonObjectDataSubRecord { final class TestCommonObjectDataSubRecord {
byte[] data = new byte[] { byte[] data = new byte[] {
(byte)0x12,(byte)0x00,(byte)0x01,(byte)0x00, (byte)0x12,(byte)0x00,(byte)0x01,(byte)0x00,
(byte)0x01,(byte)0x00,(byte)0x11,(byte)0x60, (byte)0x01,(byte)0x00,(byte)0x11,(byte)0x60,

View File

@ -25,7 +25,7 @@ import java.io.ByteArrayInputStream;
import org.apache.poi.util.LittleEndian; import org.apache.poi.util.LittleEndian;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
public final class TestDVALRecord { final class TestDVALRecord {
@Test @Test
void testRead() { void testRead() {
byte[] data = new byte[22]; byte[] data = new byte[22];

View File

@ -25,7 +25,7 @@ import org.apache.poi.ddf.EscherSpRecord;
import org.apache.poi.util.HexDump; import org.apache.poi.util.HexDump;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
public final class TestDrawingGroupRecord { final class TestDrawingGroupRecord {
private static final int MAX_RECORD_SIZE = 8228; private static final int MAX_RECORD_SIZE = 8228;
private static final int MAX_DATA_SIZE = MAX_RECORD_SIZE - 4; private static final int MAX_DATA_SIZE = MAX_RECORD_SIZE - 4;

View File

@ -29,7 +29,7 @@ import java.util.List;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
public final class TestDrawingRecord { final class TestDrawingRecord {
/** /**
* Check that RecordFactoryInputStream properly handles continued DrawingRecords * Check that RecordFactoryInputStream properly handles continued DrawingRecords

View File

@ -28,7 +28,7 @@ import org.junit.jupiter.api.Test;
* Tests the serialization and deserialization of the TestEmbeddedObjectRefSubRecord * Tests the serialization and deserialization of the TestEmbeddedObjectRefSubRecord
* class works correctly. Test data taken directly from a real Excel file. * class works correctly. Test data taken directly from a real Excel file.
*/ */
public final class TestEmbeddedObjectRefSubRecord { final class TestEmbeddedObjectRefSubRecord {
private static final short EORSR_SID = EmbeddedObjectRefSubRecord.sid; private static final short EORSR_SID = EmbeddedObjectRefSubRecord.sid;

View File

@ -26,7 +26,7 @@ import org.junit.jupiter.api.Test;
* Tests the serialization and deserialization of the EndSubRecord * Tests the serialization and deserialization of the EndSubRecord
* class works correctly. Test data taken directly from a real Excel file. * class works correctly. Test data taken directly from a real Excel file.
*/ */
public final class TestEndSubRecord { final class TestEndSubRecord {
private static final byte[] data = { }; private static final byte[] data = { };
@Test @Test

View File

@ -32,7 +32,7 @@ import org.junit.jupiter.api.Test;
/** /**
* Tests the EscherAggregate class. * Tests the EscherAggregate class.
*/ */
public final class TestEscherAggregate { final class TestEscherAggregate {
/** /**
* Tests that the create aggregate method correctly rejoins escher records together. * Tests that the create aggregate method correctly rejoins escher records together.
*/ */

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