aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Beeker <kiwiwings@apache.org>2021-01-09 15:35:07 +0000
committerAndreas Beeker <kiwiwings@apache.org>2021-01-09 15:35:07 +0000
commit8631e6c9c9f5d6a5d0f307bab5b1c4d8bebd5405 (patch)
tree5fc48515a08c098f5e58aba1a626af701cec69f2
parenta7d741fd17acea82e8b0c91a5bc4b0c51a0c5ba7 (diff)
downloadpoi-8631e6c9c9f5d6a5d0f307bab5b1c4d8bebd5405.tar.gz
poi-8631e6c9c9f5d6a5d0f307bab5b1c4d8bebd5405.zip
Sonar fixes
JUnit5 test classes and methods should have default package visibility git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1885300 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/excelant/testcases/org/apache/poi/ss/excelant/TestBuildFile.java28
-rw-r--r--src/excelant/testcases/org/apache/poi/ss/excelant/TestExcelAntPrecision.java2
-rw-r--r--src/excelant/testcases/org/apache/poi/ss/excelant/TestExcelAntSet.java4
-rw-r--r--src/excelant/testcases/org/apache/poi/ss/excelant/TestExcelAntSetDoubleCell.java2
-rw-r--r--src/excelant/testcases/org/apache/poi/ss/excelant/TestExcelAntUserDefinedFunction.java4
-rw-r--r--src/excelant/testcases/org/apache/poi/ss/excelant/util/TestExcelAntEvaluationResult.java8
-rw-r--r--src/excelant/testcases/org/apache/poi/ss/excelant/util/TestExcelAntWorkbookUtil.java46
-rw-r--r--src/excelant/testcases/org/apache/poi/ss/excelant/util/TestExcelAntWorkbookUtilFactory.java4
-rw-r--r--src/multimodule/excelant/test9/module-info.classbin370 -> 410 bytes
-rw-r--r--src/multimodule/excelant/test9/module-info.java2
10 files changed, 51 insertions, 49 deletions
diff --git a/src/excelant/testcases/org/apache/poi/ss/excelant/TestBuildFile.java b/src/excelant/testcases/org/apache/poi/ss/excelant/TestBuildFile.java
index 9b3dbdfce9..4c84ead1df 100644
--- a/src/excelant/testcases/org/apache/poi/ss/excelant/TestBuildFile.java
+++ b/src/excelant/testcases/org/apache/poi/ss/excelant/TestBuildFile.java
@@ -272,33 +272,33 @@ public class TestBuildFile {
}
@Test
- public void testMissingFilename() {
+ void testMissingFilename() {
expectSpecificBuildException("test-nofile", "required argument not specified",
"fileName attribute must be set!");
}
@Test
- public void testFileNotFound() {
+ void testFileNotFound() {
expectSpecificBuildException("test-filenotfound", "required argument not specified",
"Cannot load file invalid.xls. Make sure the path and file permissions are correct.");
}
@Test
- public void testEvaluate() {
+ void testEvaluate() {
executeTarget("test-evaluate");
assertLogContaining("Using input file: " + TestBuildFile.getDataDir() + "/spreadsheet/excelant.xls");
assertLogContaining("Succeeded when evaluating 'MortgageCalculator'!$B$4.");
}
@Test
- public void testEvaluateNoDetails() {
+ void testEvaluateNoDetails() {
executeTarget("test-evaluate-nodetails");
assertLogContaining("Using input file: " + TestBuildFile.getDataDir() + "/spreadsheet/excelant.xls");
assertLogNotContaining("Succeeded when evaluating 'MortgageCalculator'!$B$4.");
}
@Test
- public void testPrecision() {
+ void testPrecision() {
executeTarget("test-precision");
assertLogContaining("Using input file: " + TestBuildFile.getDataDir() + "/spreadsheet/excelant.xls");
@@ -312,46 +312,46 @@ public class TestBuildFile {
}
@Test
- public void testPrecisionFail() {
+ void testPrecisionFail() {
expectSpecificBuildException("test-precision-fails", "precision not matched",
"\tFailed to evaluate cell 'MortgageCalculator'!$B$4. It evaluated to 2285.5761494145563 when the value of 2285.576149 with precision of 1.0E-10 was expected.");
}
@Test
- public void testPassOnError() {
+ void testPassOnError() {
executeTarget("test-passonerror");
assertLogContaining("Using input file: " + TestBuildFile.getDataDir() + "/spreadsheet/excelant.xls");
assertLogContaining("Test named failonerror failed because 1 of 0 evaluations failed to evaluate correctly.");
}
@Test
- public void testFailOnError() {
+ void testFailOnError() {
expectBuildException("test-failonerror", "fail on error");
assertLogContaining("Using input file: " + TestBuildFile.getDataDir() + "/spreadsheet/excelant.xls");
assertLogNotContaining("failed because 1 of 0 evaluations failed to evaluate correctly. Failed to evaluate cell 'MortageCalculatorFunction'!$D$3");
}
@Test
- public void testFailOnErrorNoDetails() {
+ void testFailOnErrorNoDetails() {
expectBuildException("test-failonerror-nodetails", "fail on error");
assertLogNotContaining("Using input file: " + TestBuildFile.getDataDir() + "/spreadsheet/excelant.xls");
assertLogNotContaining("failed because 1 of 0 evaluations failed to evaluate correctly. Failed to evaluate cell 'MortageCalculatorFunction'!$D$3");
}
@Test
- public void testUdf() {
+ void testUdf() {
executeTarget("test-udf");
assertLogContaining("1/1 tests passed");
}
@Test
- public void testSetText() {
+ void testSetText() {
executeTarget("test-settext");
assertLogContaining("1/1 tests passed");
}
@Test
- public void testAddHandler() {
+ void testAddHandler() {
executeTarget("test-addhandler");
assertLogContaining("Using input file: " + TestBuildFile.getDataDir() + "/spreadsheet/excelant.xls");
assertLogContaining("Succeeded when evaluating 'MortgageCalculator'!$B$4.");
@@ -361,14 +361,14 @@ public class TestBuildFile {
}
@Test
- public void testAddHandlerWrongClass() {
+ void testAddHandlerWrongClass() {
executeTarget("test-addhandler-wrongclass");
assertLogContaining("Using input file: " + TestBuildFile.getDataDir() + "/spreadsheet/excelant.xls");
assertLogContaining("Succeeded when evaluating 'MortgageCalculator'!$B$4.");
}
@Test
- public void testAddHandlerFails() {
+ void testAddHandlerFails() {
expectSpecificBuildException("test-addhandler-fails", "NullPointException", null);
}
diff --git a/src/excelant/testcases/org/apache/poi/ss/excelant/TestExcelAntPrecision.java b/src/excelant/testcases/org/apache/poi/ss/excelant/TestExcelAntPrecision.java
index 9c73d0f5f2..aaa9953fd6 100644
--- a/src/excelant/testcases/org/apache/poi/ss/excelant/TestExcelAntPrecision.java
+++ b/src/excelant/testcases/org/apache/poi/ss/excelant/TestExcelAntPrecision.java
@@ -38,7 +38,7 @@ public class TestExcelAntPrecision {
}
@Test
- public void testVerifyPrecision() {
+ void testVerifyPrecision() {
double value = 1.0E-1 ;
diff --git a/src/excelant/testcases/org/apache/poi/ss/excelant/TestExcelAntSet.java b/src/excelant/testcases/org/apache/poi/ss/excelant/TestExcelAntSet.java
index a192543859..fc9aef1932 100644
--- a/src/excelant/testcases/org/apache/poi/ss/excelant/TestExcelAntSet.java
+++ b/src/excelant/testcases/org/apache/poi/ss/excelant/TestExcelAntSet.java
@@ -46,7 +46,7 @@ public class TestExcelAntSet {
}
@Test
- public void testSetter() {
+ void testSetter() {
String cell = "simpleCellRef!$F$1" ;
fixture.setCell( cell ) ;
@@ -58,7 +58,7 @@ public class TestExcelAntSet {
}
@Test
- public void testSetWorkbookUtil() {
+ void testSetWorkbookUtil() {
ExcelAntWorkbookUtil util = ExcelAntWorkbookUtilFactory.getInstance(
mortgageCalculatorFileName ) ;
diff --git a/src/excelant/testcases/org/apache/poi/ss/excelant/TestExcelAntSetDoubleCell.java b/src/excelant/testcases/org/apache/poi/ss/excelant/TestExcelAntSetDoubleCell.java
index a2744620bf..437994c5a7 100644
--- a/src/excelant/testcases/org/apache/poi/ss/excelant/TestExcelAntSetDoubleCell.java
+++ b/src/excelant/testcases/org/apache/poi/ss/excelant/TestExcelAntSetDoubleCell.java
@@ -47,7 +47,7 @@ public class TestExcelAntSetDoubleCell {
}
@Test
- public void testSetDouble() {
+ void testSetDouble() {
String cellId = "'Sheet3'!$A$1" ;
double testValue = 1.1 ;
diff --git a/src/excelant/testcases/org/apache/poi/ss/excelant/TestExcelAntUserDefinedFunction.java b/src/excelant/testcases/org/apache/poi/ss/excelant/TestExcelAntUserDefinedFunction.java
index 30dbb159c0..67521ed562 100644
--- a/src/excelant/testcases/org/apache/poi/ss/excelant/TestExcelAntUserDefinedFunction.java
+++ b/src/excelant/testcases/org/apache/poi/ss/excelant/TestExcelAntUserDefinedFunction.java
@@ -32,7 +32,7 @@ public class TestExcelAntUserDefinedFunction {
}
@Test
- public void testSetClassName() {
+ void testSetClassName() {
String className = "simple.class.name" ;
fixture.setClassName( className ) ;
@@ -43,7 +43,7 @@ public class TestExcelAntUserDefinedFunction {
}
@Test
- public void testSetFunction() {
+ void testSetFunction() {
String functionAlias = "alias" ;
fixture.setFunctionAlias( functionAlias ) ;
diff --git a/src/excelant/testcases/org/apache/poi/ss/excelant/util/TestExcelAntEvaluationResult.java b/src/excelant/testcases/org/apache/poi/ss/excelant/util/TestExcelAntEvaluationResult.java
index 096792ff73..767a37f7d6 100644
--- a/src/excelant/testcases/org/apache/poi/ss/excelant/util/TestExcelAntEvaluationResult.java
+++ b/src/excelant/testcases/org/apache/poi/ss/excelant/util/TestExcelAntEvaluationResult.java
@@ -49,26 +49,26 @@ public class TestExcelAntEvaluationResult {
}
@Test
- public void testCompletedWithErrorMessage() {
+ void testCompletedWithErrorMessage() {
String errMsg = fixture.getErrorMessage();
assertNotNull(errMsg);
assertEquals(errMsg, errMessage);
}
@Test
- public void testPassed() {
+ void testPassed() {
boolean passedValue = fixture.didTestPass();
assertEquals(passedValue, passed);
}
@Test
- public void testDelta() {
+ void testDelta() {
double deltaValue = fixture.getDelta();
assertEquals(deltaValue, delta, 0.0);
}
@Test
- public void testCellId() {
+ void testCellId() {
String cellIdValue = fixture.getCellName();
assertNotNull(cellIdValue);
assertEquals(cellIdValue, cellId);
diff --git a/src/excelant/testcases/org/apache/poi/ss/excelant/util/TestExcelAntWorkbookUtil.java b/src/excelant/testcases/org/apache/poi/ss/excelant/util/TestExcelAntWorkbookUtil.java
index 10f5c8e9c1..178d3e7751 100644
--- a/src/excelant/testcases/org/apache/poi/ss/excelant/util/TestExcelAntWorkbookUtil.java
+++ b/src/excelant/testcases/org/apache/poi/ss/excelant/util/TestExcelAntWorkbookUtil.java
@@ -54,20 +54,20 @@ public class TestExcelAntWorkbookUtil {
}
@Test
- public void testStringConstructor() {
+ void testStringConstructor() {
fixture = new ExcelAntWorkbookUtilTestHelper(mortgageCalculatorFileName);
assertNotNull(fixture);
}
@Test
- public void testLoadNotExistingFile() {
+ void testLoadNotExistingFile() {
BuildException e = assertThrows(BuildException.class, () -> new ExcelAntWorkbookUtilTestHelper("notexistingFile"));
assertTrue(e.getMessage().contains("notexistingFile"));
}
@Test
- public void testWorkbookConstructor() throws IOException {
+ void testWorkbookConstructor() throws IOException {
File workbookFile = new File(mortgageCalculatorFileName);
FileInputStream fis = new FileInputStream(workbookFile);
Workbook workbook = WorkbookFactory.create(fis);
@@ -78,7 +78,7 @@ public class TestExcelAntWorkbookUtil {
}
@Test
- public void testAddFunction() {
+ void testAddFunction() {
fixture = new ExcelAntWorkbookUtilTestHelper(
mortgageCalculatorFileName);
@@ -93,7 +93,7 @@ public class TestExcelAntWorkbookUtil {
}
@Test
- public void testAddFunctionClassName() throws Exception {
+ void testAddFunctionClassName() throws Exception {
fixture = new ExcelAntWorkbookUtilTestHelper(
mortgageCalculatorFileName);
@@ -108,7 +108,7 @@ public class TestExcelAntWorkbookUtil {
}
@Test
- public void testAddFunctionInvalidClassName() throws Exception {
+ void testAddFunctionInvalidClassName() throws Exception {
fixture = new ExcelAntWorkbookUtilTestHelper(
mortgageCalculatorFileName);
@@ -123,7 +123,7 @@ public class TestExcelAntWorkbookUtil {
}
@Test
- public void testGetWorkbook() {
+ void testGetWorkbook() {
fixture = new ExcelAntWorkbookUtilTestHelper(
mortgageCalculatorFileName);
@@ -135,7 +135,7 @@ public class TestExcelAntWorkbookUtil {
}
@Test
- public void testFileName() {
+ void testFileName() {
fixture = new ExcelAntWorkbookUtilTestHelper(
mortgageCalculatorFileName);
@@ -150,7 +150,7 @@ public class TestExcelAntWorkbookUtil {
}
@Test
- public void testGetEvaluator() {
+ void testGetEvaluator() {
fixture = new ExcelAntWorkbookUtilTestHelper(
mortgageCalculatorFileName);
@@ -161,7 +161,7 @@ public class TestExcelAntWorkbookUtil {
}
@Test
- public void testGetEvaluatorWithUDF() {
+ void testGetEvaluatorWithUDF() {
fixture = new ExcelAntWorkbookUtilTestHelper(
mortgageCalculatorFileName);
@@ -174,7 +174,7 @@ public class TestExcelAntWorkbookUtil {
}
@Test
- public void testGetEvaluatorXLSX() {
+ void testGetEvaluatorXLSX() {
fixture = new ExcelAntWorkbookUtilTestHelper(
TestBuildFile.getDataDir() + "/spreadsheet/sample.xlsx");
@@ -185,7 +185,7 @@ public class TestExcelAntWorkbookUtil {
}
@Test
- public void testGetEvaluatorXLSXWithFunction() {
+ void testGetEvaluatorXLSXWithFunction() {
fixture = new ExcelAntWorkbookUtilTestHelper(
TestBuildFile.getDataDir() + "/spreadsheet/sample.xlsx");
@@ -198,7 +198,7 @@ public class TestExcelAntWorkbookUtil {
}
@Test
- public void testEvaluateCell() {
+ void testEvaluateCell() {
String cell = "'MortgageCalculator'!B4" ;
double expectedValue = 790.79 ;
double precision = 0.1 ;
@@ -221,7 +221,7 @@ public class TestExcelAntWorkbookUtil {
}
@Test
- public void testEvaluateCellFailedPrecision() {
+ void testEvaluateCellFailedPrecision() {
String cell = "'MortgageCalculator'!B4" ;
double expectedValue = 790.79 ;
double precision = 0.0000000000001 ;
@@ -244,7 +244,7 @@ public class TestExcelAntWorkbookUtil {
}
@Test
- public void testEvaluateCellWithError() {
+ void testEvaluateCellWithError() {
String cell = "'ErrorCell'!A1" ;
double expectedValue = 790.79 ;
double precision = 0.1 ;
@@ -267,7 +267,7 @@ public class TestExcelAntWorkbookUtil {
}
@Test
- public void testGetSheets() {
+ void testGetSheets() {
fixture = new ExcelAntWorkbookUtilTestHelper(
mortgageCalculatorFileName);
@@ -278,7 +278,7 @@ public class TestExcelAntWorkbookUtil {
}
@Test
- public void testSetString() {
+ void testSetString() {
String cell = "'MortgageCalculator'!C14" ;
String cellValue = "testString" ;
@@ -294,7 +294,7 @@ public class TestExcelAntWorkbookUtil {
}
@Test
- public void testSetNotExistingSheet() {
+ void testSetNotExistingSheet() {
String cell = "'NotexistingSheet'!C14" ;
fixture = new ExcelAntWorkbookUtilTestHelper(mortgageCalculatorFileName);
@@ -303,7 +303,7 @@ public class TestExcelAntWorkbookUtil {
}
@Test
- public void testSetFormula() {
+ void testSetFormula() {
String cell = "'MortgageCalculator'!C14" ;
String cellValue = "SUM(B14:B18)" ;
@@ -318,7 +318,7 @@ public class TestExcelAntWorkbookUtil {
}
@Test
- public void testSetDoubleValue() {
+ void testSetDoubleValue() {
String cell = "'MortgageCalculator'!C14" ;
double cellValue = 1.2;
@@ -333,7 +333,7 @@ public class TestExcelAntWorkbookUtil {
}
@Test
- public void testSetDate() {
+ void testSetDate() {
String cell = "'MortgageCalculator'!C14" ;
Date cellValue = new Date();
@@ -348,7 +348,7 @@ public class TestExcelAntWorkbookUtil {
}
@Test
- public void testGetNonexistingString() {
+ void testGetNonexistingString() {
String cell = "'MortgageCalculator'!C33" ;
fixture = new ExcelAntWorkbookUtilTestHelper(
@@ -360,7 +360,7 @@ public class TestExcelAntWorkbookUtil {
}
@Test
- public void testGetNonexistingDouble() {
+ void testGetNonexistingDouble() {
String cell = "'MortgageCalculator'!C33" ;
fixture = new ExcelAntWorkbookUtilTestHelper(
diff --git a/src/excelant/testcases/org/apache/poi/ss/excelant/util/TestExcelAntWorkbookUtilFactory.java b/src/excelant/testcases/org/apache/poi/ss/excelant/util/TestExcelAntWorkbookUtilFactory.java
index d6129e7609..5c160e2ecb 100644
--- a/src/excelant/testcases/org/apache/poi/ss/excelant/util/TestExcelAntWorkbookUtilFactory.java
+++ b/src/excelant/testcases/org/apache/poi/ss/excelant/util/TestExcelAntWorkbookUtilFactory.java
@@ -37,7 +37,7 @@ public class TestExcelAntWorkbookUtilFactory {
* instance of the ExcelAntWorkbookUtil class.
*/
@Test
- public void testGetNewWorkbookUtilInstance() {
+ void testGetNewWorkbookUtilInstance() {
ExcelAntWorkbookUtil util = ExcelAntWorkbookUtilFactory.getInstance(
mortgageCalculatorWorkbookFile) ;
@@ -51,7 +51,7 @@ public class TestExcelAntWorkbookUtilFactory {
* the same resource, are passed in.
*/
@Test
- public void testVerifyEquivalence() {
+ void testVerifyEquivalence() {
String sameFileName = TestBuildFile.getDataDir() + "/spreadsheet/mortgage-calculation.xls" ;
ExcelAntWorkbookUtil util = ExcelAntWorkbookUtilFactory.getInstance(
diff --git a/src/multimodule/excelant/test9/module-info.class b/src/multimodule/excelant/test9/module-info.class
index 904b2ebeab..815e1396a6 100644
--- a/src/multimodule/excelant/test9/module-info.class
+++ b/src/multimodule/excelant/test9/module-info.class
Binary files differ
diff --git a/src/multimodule/excelant/test9/module-info.java b/src/multimodule/excelant/test9/module-info.java
index 3d62f5f449..a26d9bd04d 100644
--- a/src/multimodule/excelant/test9/module-info.java
+++ b/src/multimodule/excelant/test9/module-info.java
@@ -29,4 +29,6 @@ module org.apache.poi.excelant {
// test specific exports
requires org.junit.jupiter.api;
requires org.junit.jupiter.params;
+
+ opens org.apache.poi.ss.excelant.util to org.junit.platform.commons;
} \ No newline at end of file