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
This commit is contained in:
Andreas Beeker 2021-01-09 15:35:07 +00:00
parent a7d741fd17
commit 8631e6c9c9
10 changed files with 51 additions and 49 deletions

View File

@ -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);
}

View File

@ -38,7 +38,7 @@ public class TestExcelAntPrecision {
}
@Test
public void testVerifyPrecision() {
void testVerifyPrecision() {
double value = 1.0E-1 ;

View File

@ -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 ) ;

View File

@ -47,7 +47,7 @@ public class TestExcelAntSetDoubleCell {
}
@Test
public void testSetDouble() {
void testSetDouble() {
String cellId = "'Sheet3'!$A$1" ;
double testValue = 1.1 ;

View File

@ -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 ) ;

View File

@ -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);

View File

@ -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(

View File

@ -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(

View File

@ -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;
}