From ae6ceeadd125d79b2b680e2dce92083d0ef96497 Mon Sep 17 00:00:00 2001 From: Gilles Sadowski Date: Tue, 18 Jan 2022 04:37:54 +0100 Subject: [PATCH] Replace calls to deprecated classes and methods (unit tests). --- .../AbstractLeastSquaresOptimizerAbstractTest.java | 10 ++-------- .../leastsquares/LevenbergMarquardtOptimizerTest.java | 7 ++----- .../legacy/ml/clustering/FuzzyKMeansClustererTest.java | 5 ++--- 3 files changed, 6 insertions(+), 16 deletions(-) diff --git a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/fitting/leastsquares/AbstractLeastSquaresOptimizerAbstractTest.java b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/fitting/leastsquares/AbstractLeastSquaresOptimizerAbstractTest.java index d601c865f..00fc3bb88 100644 --- a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/fitting/leastsquares/AbstractLeastSquaresOptimizerAbstractTest.java +++ b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/fitting/leastsquares/AbstractLeastSquaresOptimizerAbstractTest.java @@ -39,10 +39,6 @@ import org.junit.Test; import java.io.IOException; import java.util.Arrays; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.not; -import static org.hamcrest.CoreMatchers.sameInstance; - /** * Some of the unit tests are re-implementations of the MINPACK file17 and () { @Override public boolean converged(int iteration, Evaluation previous, Evaluation current) { - Assert.assertThat( - previous.getPoint(), - not(sameInstance(current.getPoint()))); + Assert.assertFalse(previous.getPoint().equals(current.getPoint())); Assert.assertArrayEquals(new double[3], previous.getPoint().toArray(), 0); Assert.assertArrayEquals(new double[] {1, 2, 3}, current.getPoint().toArray(), TOL); checked[0] = true; @@ -560,7 +554,7 @@ public abstract class AbstractLeastSquaresOptimizerAbstractTest { }); optimizer.optimize(builder.build()); - Assert.assertThat(checked[0], is(true)); + Assert.assertTrue(checked[0]); } class LinearProblem { diff --git a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/fitting/leastsquares/LevenbergMarquardtOptimizerTest.java b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/fitting/leastsquares/LevenbergMarquardtOptimizerTest.java index aedeed856..64e8969b3 100644 --- a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/fitting/leastsquares/LevenbergMarquardtOptimizerTest.java +++ b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/fitting/leastsquares/LevenbergMarquardtOptimizerTest.java @@ -32,8 +32,6 @@ import org.apache.commons.numbers.core.Precision; import org.junit.Assert; import org.junit.Test; -import static org.hamcrest.CoreMatchers.is; - /** *

Some of the unit tests are re-implementations of the MINPACK file17 and