upgrade mockito and byte-buddy

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1906012 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
PJ Fanning 2022-12-15 12:06:39 +00:00
parent 0d382b4c67
commit 2a34e5a31e
5 changed files with 24 additions and 12 deletions

View File

@ -121,7 +121,7 @@ subprojects {
commonsMathVersion = '3.6.1'
junitVersion = '5.9.0'
log4jVersion = '2.19.0'
mockitoVersion = '4.9.0'
mockitoVersion = '4.10.0'
hamcrestVersion = '2.2'
xmlbeansVersion = '5.1.1'
batikVersion = '1.16'

View File

@ -284,9 +284,9 @@ under the License.
<dependency prefix="main.jmhAnnotation" artifact="org.openjdk.jmh:jmh-generator-annprocess:1.35" usage="main-tests"/>
<dependency prefix="main.hamcrest" artifact="org.hamcrest:hamcrest:2.2" usage="main-tests"/>
<dependency prefix="main.xmlunit" artifact="org.xmlunit:xmlunit-core:2.9.0" usage="main-tests"/>
<dependency prefix="main.mockito" artifact="org.mockito:mockito-core:4.9.0" usage="main-tests"/>
<dependency prefix="main.byte-buddy" artifact="net.bytebuddy:byte-buddy:1.12.19" usage="main-tests"/>
<dependency prefix="main.byte-buddy-agent" artifact="net.bytebuddy:byte-buddy-agent:1.12.19" usage="main-tests"/>
<dependency prefix="main.mockito" artifact="org.mockito:mockito-core:4.10.0" usage="main-tests"/>
<dependency prefix="main.byte-buddy" artifact="net.bytebuddy:byte-buddy:1.12.20" usage="main-tests"/>
<dependency prefix="main.byte-buddy-agent" artifact="net.bytebuddy:byte-buddy-agent:1.12.20" usage="main-tests"/>
<dependency prefix="main.objenesis" artifact="org.objenesis:objenesis:3.1" usage="main-tests"/>
<dependency prefix="main.log4j-core" artifact="org.apache.logging.log4j:log4j-core:2.19.0" usage="main-tests"/>
<dependency prefix="main.commons-logging" artifact="commons-logging:commons-logging:1.2" usage="main-tests"/>

View File

@ -24,8 +24,8 @@ sourceSets {
}
dependencies {
api 'net.bytebuddy:byte-buddy:1.12.19'
api 'net.bytebuddy:byte-buddy-agent:1.12.19'
api 'net.bytebuddy:byte-buddy:1.12.20'
api 'net.bytebuddy:byte-buddy-agent:1.12.20'
api "org.apache.xmlbeans:xmlbeans:${xmlbeansVersion}"
}

View File

@ -89,17 +89,19 @@ public abstract class TwoOperandNumericOperation extends Fixed2ArgFunction imple
if (d1 == 0.0) {
throw new EvaluationException(ErrorEval.DIV_ZERO);
}
BigDecimal bd0 = new BigDecimal(NumberToTextConverter.toText(d0));
BigDecimal bd1 = new BigDecimal(NumberToTextConverter.toText(d1));
return bd0.divide(bd1, MathContext.DECIMAL128).doubleValue();
BigDecimal bd0 = new BigDecimal(d0);
BigDecimal bd1 = new BigDecimal(d1);
BigDecimal result = bd0.divide(bd1, MathContext.DECIMAL128);
return Double.parseDouble(NumberToTextConverter.toText(result.doubleValue()));
}
};
public static final Function MultiplyEval = new TwoOperandNumericOperation() {
@Override
protected double evaluate(double d0, double d1) {
BigDecimal bd0 = new BigDecimal(NumberToTextConverter.toText(d0));
BigDecimal bd1 = new BigDecimal(NumberToTextConverter.toText(d1));
return bd0.multiply(bd1).doubleValue();
BigDecimal bd0 = new BigDecimal(d0);
BigDecimal bd1 = new BigDecimal(d1);
BigDecimal result = bd0.multiply(bd1);
return Double.parseDouble(NumberToTextConverter.toText(result.doubleValue()));
}
};
public static final Function PowerEval = new TwoOperandNumericOperation() {

View File

@ -23,6 +23,7 @@ import org.apache.poi.util.LocaleUtil;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.util.Locale;
import static org.apache.poi.ss.util.Utils.assertDouble;
@ -44,6 +45,15 @@ final class TestNumericFunction {
assertDouble(fe, cell, "INT(880000000*0.00849/3)", 2490400.0, 0);
}
@Test
void testMultiply() throws IOException {
try (HSSFWorkbook wb = new HSSFWorkbook()) {
HSSFCell cell = wb.createSheet().createRow(0).createCell(0);
HSSFFormulaEvaluator fe = new HSSFFormulaEvaluator(wb);
assertDouble(fe, cell, "1.2*SQRT(5.678)", 2.85942651592937, 0);
}
}
@Test
void testSIGN() {
HSSFWorkbook wb = new HSSFWorkbook();