commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t.@apache.org
Subject [02/18] [math] [MATH-869] NullArgumentException now extends NullPointerException.
Date Wed, 25 Feb 2015 21:49:30 GMT
[MATH-869] NullArgumentException now extends NullPointerException.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/35b688b7
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/35b688b7
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/35b688b7

Branch: refs/heads/master
Commit: 35b688b7ec3b32dc671af4c7cb9556ff26e761eb
Parents: c22e7fb
Author: Thomas Neidhart <thomas.neidhart@gmail.com>
Authored: Wed Feb 25 22:25:47 2015 +0100
Committer: Thomas Neidhart <thomas.neidhart@gmail.com>
Committed: Wed Feb 25 22:25:47 2015 +0100

----------------------------------------------------------------------
 src/changes/changes.xml                         |  4 +++
 .../math4/exception/NullArgumentException.java  | 38 ++++++++++++++++++--
 .../solvers/UnivariateSolverUtilsTest.java      |  7 ++--
 .../commons/math4/fraction/FractionTest.java    | 18 +++++-----
 .../commons/math4/stat/StatUtilsTest.java       | 35 +++++++++---------
 .../AbstractUnivariateStatisticTest.java        |  9 ++---
 .../descriptive/moment/SemiVarianceTest.java    |  6 ++--
 .../descriptive/rank/PSquarePercentileTest.java |  3 +-
 .../stat/descriptive/rank/PercentileTest.java   |  8 ++---
 .../GLSMultipleLinearRegressionTest.java        |  5 +--
 .../MultipleLinearRegressionAbstractTest.java   |  7 ++--
 .../OLSMultipleLinearRegressionTest.java        |  5 +--
 .../commons/math4/util/MathArraysTest.java      |  8 ++---
 13 files changed, 98 insertions(+), 55 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-math/blob/35b688b7/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 9b4744e..ee73fca 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -54,6 +54,10 @@ If the output is not quite correct, check for invisible trailing spaces!
     </release>
 
     <release version="4.0" date="XXXX-XX-XX" description="">
+      <action dev="tn" type="update" issue="MATH-869">
+        "NullArgumentException" extends now "java.lang.NullPointerException"
+        instead of "MathIllegalArgumentException".
+      </action>
       <action dev="tn" type="update" issue="MATH-839" due-to="Gilles Sadowski">
         Renamed "cumulativeProbability(double, double)" to "probability(double, double)"
         in "IntegerDistribution" and "RealDistribution".

http://git-wip-us.apache.org/repos/asf/commons-math/blob/35b688b7/src/main/java/org/apache/commons/math4/exception/NullArgumentException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/exception/NullArgumentException.java b/src/main/java/org/apache/commons/math4/exception/NullArgumentException.java
index 7b73be7..5577042 100644
--- a/src/main/java/org/apache/commons/math4/exception/NullArgumentException.java
+++ b/src/main/java/org/apache/commons/math4/exception/NullArgumentException.java
@@ -16,6 +16,8 @@
  */
 package org.apache.commons.math4.exception;
 
+import org.apache.commons.math4.exception.util.ExceptionContext;
+import org.apache.commons.math4.exception.util.ExceptionContextProvider;
 import org.apache.commons.math4.exception.util.Localizable;
 import org.apache.commons.math4.exception.util.LocalizedFormats;
 
@@ -26,12 +28,20 @@ import org.apache.commons.math4.exception.util.LocalizedFormats;
  * argument") and so does not extend the standard {@code NullPointerException}.
  * Propagation of {@code NullPointerException} from within Commons-Math is
  * construed to be a bug.
+ * <p>
+ * Note: from 4.0 onwards, this class extends {@link NullPointerException} instead
+ * of {@link MathIllegalArgumentException}.
  *
  * @since 2.2
  */
-public class NullArgumentException extends MathIllegalArgumentException {
+public class NullArgumentException extends NullPointerException
+    implements ExceptionContextProvider {
+
     /** Serializable version Id. */
-    private static final long serialVersionUID = -6024911025449780478L;
+    private static final long serialVersionUID = 20150225L;
+
+    /** Context. */
+    private final ExceptionContext context;
 
     /**
      * Default constructor.
@@ -46,6 +56,28 @@ public class NullArgumentException extends MathIllegalArgumentException
{
      */
     public NullArgumentException(Localizable pattern,
                                  Object ... arguments) {
-        super(pattern, arguments);
+        context = new ExceptionContext(this);
+        context.addMessage(pattern, arguments);
+    }
+    
+    /**
+     * {@inheritDoc}
+     * @since 4.0
+     */
+    public ExceptionContext getContext() {
+        return context;
     }
+
+    /** {@inheritDoc} */
+    @Override
+    public String getMessage() {
+        return context.getMessage();
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public String getLocalizedMessage() {
+        return context.getLocalizedMessage();
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/commons-math/blob/35b688b7/src/test/java/org/apache/commons/math4/analysis/solvers/UnivariateSolverUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/solvers/UnivariateSolverUtilsTest.java
b/src/test/java/org/apache/commons/math4/analysis/solvers/UnivariateSolverUtilsTest.java
index fba50e3..f2471b7 100644
--- a/src/test/java/org/apache/commons/math4/analysis/solvers/UnivariateSolverUtilsTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/solvers/UnivariateSolverUtilsTest.java
@@ -23,6 +23,7 @@ import org.apache.commons.math4.analysis.function.Sin;
 import org.apache.commons.math4.analysis.solvers.UnivariateSolverUtils;
 import org.apache.commons.math4.exception.MathIllegalArgumentException;
 import org.apache.commons.math4.exception.NoBracketingException;
+import org.apache.commons.math4.exception.NullArgumentException;
 import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
@@ -33,7 +34,7 @@ public class UnivariateSolverUtilsTest {
 
     protected UnivariateFunction sin = new Sin();
 
-    @Test(expected=MathIllegalArgumentException.class)
+    @Test(expected=NullArgumentException.class)
     public void testSolveNull() {
         UnivariateSolverUtils.solve(null, 0.0, 4.0);
     }
@@ -60,7 +61,7 @@ public class UnivariateSolverUtilsTest {
         Assert.assertEquals(FastMath.PI, x, 1.0e-4);
     }
 
-    @Test(expected=MathIllegalArgumentException.class)
+    @Test(expected=NullArgumentException.class)
     public void testSolveAccuracyNull()  {
         double accuracy = 1.0e-6;
         UnivariateSolverUtils.solve(null, 0.0, 4.0, accuracy);
@@ -144,7 +145,7 @@ public class UnivariateSolverUtilsTest {
         Assert.assertTrue(sin.value(result[1]) > 0);
     }
 
-    @Test(expected=MathIllegalArgumentException.class)
+    @Test(expected=NullArgumentException.class)
     public void testNullFunction() {
         UnivariateSolverUtils.bracket(null, 1.5, 0, 2.0);
     }

http://git-wip-us.apache.org/repos/asf/commons-math/blob/35b688b7/src/test/java/org/apache/commons/math4/fraction/FractionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/fraction/FractionTest.java b/src/test/java/org/apache/commons/math4/fraction/FractionTest.java
index 174fa09..aca7d05 100644
--- a/src/test/java/org/apache/commons/math4/fraction/FractionTest.java
+++ b/src/test/java/org/apache/commons/math4/fraction/FractionTest.java
@@ -19,7 +19,7 @@ package org.apache.commons.math4.fraction;
 import org.apache.commons.math4.TestUtils;
 import org.apache.commons.math4.exception.ConvergenceException;
 import org.apache.commons.math4.exception.MathArithmeticException;
-import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NullArgumentException;
 import org.apache.commons.math4.fraction.Fraction;
 import org.apache.commons.math4.fraction.FractionConversionException;
 import org.apache.commons.math4.util.FastMath;
@@ -348,8 +348,8 @@ public class FractionTest {
 
         try {
             f.add(null);
-            Assert.fail("expecting MathIllegalArgumentException");
-        } catch (MathIllegalArgumentException ex) {}
+            Assert.fail("expecting NullArgumentException");
+        } catch (NullArgumentException ex) {}
 
         // if this fraction is added naively, it will overflow.
         // check that it doesn't.
@@ -445,8 +445,8 @@ public class FractionTest {
 
         try {
             f.divide(null);
-            Assert.fail("MathIllegalArgumentException");
-        } catch (MathIllegalArgumentException ex) {}
+            Assert.fail("NullArgumentException");
+        } catch (NullArgumentException ex) {}
 
         try {
             f1 = new Fraction(1, Integer.MAX_VALUE);
@@ -484,8 +484,8 @@ public class FractionTest {
 
         try {
             f.multiply(null);
-            Assert.fail("expecting MathIllegalArgumentException");
-        } catch (MathIllegalArgumentException ex) {}
+            Assert.fail("expecting NullArgumentException");
+        } catch (NullArgumentException ex) {}
 
         f1 = new Fraction(6, 35);
         f  = f1.multiply(15);
@@ -506,8 +506,8 @@ public class FractionTest {
         Fraction f = new Fraction(1,1);
         try {
             f.subtract(null);
-            Assert.fail("expecting MathIllegalArgumentException");
-        } catch (MathIllegalArgumentException ex) {}
+            Assert.fail("expecting NullArgumentException");
+        } catch (NullArgumentException ex) {}
 
         // if this fraction is subtracted naively, it will overflow.
         // check that it doesn't.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/35b688b7/src/test/java/org/apache/commons/math4/stat/StatUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/StatUtilsTest.java b/src/test/java/org/apache/commons/math4/stat/StatUtilsTest.java
index 9837b85..2528f3c 100644
--- a/src/test/java/org/apache/commons/math4/stat/StatUtilsTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/StatUtilsTest.java
@@ -19,6 +19,7 @@ package org.apache.commons.math4.stat;
 
 import org.apache.commons.math4.TestUtils;
 import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NullArgumentException;
 import org.apache.commons.math4.stat.StatUtils;
 import org.apache.commons.math4.stat.descriptive.DescriptiveStatistics;
 import org.apache.commons.math4.util.FastMath;
@@ -122,14 +123,14 @@ public final class StatUtilsTest {
         try {
             StatUtils.sumSq(x);
             Assert.fail("null is not a valid data array.");
-        } catch (MathIllegalArgumentException ex) {
+        } catch (NullArgumentException ex) {
             // success
         }
 
         try {
             StatUtils.sumSq(x, 0, 4);
             Assert.fail("null is not a valid data array.");
-        } catch (MathIllegalArgumentException ex) {
+        } catch (NullArgumentException ex) {
             // success
         }
 
@@ -157,14 +158,14 @@ public final class StatUtilsTest {
         try {
             StatUtils.product(x);
             Assert.fail("null is not a valid data array.");
-        } catch (MathIllegalArgumentException ex) {
+        } catch (NullArgumentException ex) {
             // success
         }
 
         try {
             StatUtils.product(x, 0, 4);
             Assert.fail("null is not a valid data array.");
-        } catch (MathIllegalArgumentException ex) {
+        } catch (NullArgumentException ex) {
             // success
         }
 
@@ -192,14 +193,14 @@ public final class StatUtilsTest {
         try {
             StatUtils.sumLog(x);
             Assert.fail("null is not a valid data array.");
-        } catch (MathIllegalArgumentException ex) {
+        } catch (NullArgumentException ex) {
             // success
         }
 
         try {
             StatUtils.sumLog(x, 0, 4);
             Assert.fail("null is not a valid data array.");
-        } catch (MathIllegalArgumentException ex) {
+        } catch (NullArgumentException ex) {
             // success
         }
 
@@ -226,7 +227,7 @@ public final class StatUtilsTest {
         try {
             StatUtils.mean(x, 0, 4);
             Assert.fail("null is not a valid data array.");
-        } catch (MathIllegalArgumentException ex) {
+        } catch (NullArgumentException ex) {
             // success
         }
 
@@ -250,7 +251,7 @@ public final class StatUtilsTest {
         try {
             StatUtils.variance(x, 0, 4);
             Assert.fail("null is not a valid data array.");
-        } catch (MathIllegalArgumentException ex) {
+        } catch (NullArgumentException ex) {
             // success
         }
 
@@ -278,7 +279,7 @@ public final class StatUtilsTest {
         try {
             StatUtils.variance(x, 0, 4);
             Assert.fail("null is not a valid data array.");
-        } catch (MathIllegalArgumentException ex) {
+        } catch (NullArgumentException ex) {
             // success
         }
 
@@ -307,7 +308,7 @@ public final class StatUtilsTest {
         try {
             StatUtils.max(x, 0, 4);
             Assert.fail("null is not a valid data array.");
-        } catch (MathIllegalArgumentException ex) {
+        } catch (NullArgumentException ex) {
             // success
         }
 
@@ -347,7 +348,7 @@ public final class StatUtilsTest {
         try {
             StatUtils.min(x, 0, 4);
             Assert.fail("null is not a valid data array.");
-        } catch (MathIllegalArgumentException ex) {
+        } catch (NullArgumentException ex) {
             // success
         }
 
@@ -388,14 +389,14 @@ public final class StatUtilsTest {
         try {
             StatUtils.percentile(x, .25);
             Assert.fail("null is not a valid data array.");
-        } catch (MathIllegalArgumentException ex) {
+        } catch (NullArgumentException ex) {
             // success
         }
 
         try {
             StatUtils.percentile(x, 0, 4, 0.25);
             Assert.fail("null is not a valid data array.");
-        } catch (MathIllegalArgumentException ex) {
+        } catch (NullArgumentException ex) {
             // success
         }
 
@@ -452,8 +453,8 @@ public final class StatUtilsTest {
         double[] test = null;
         try {
             StatUtils.geometricMean(test);
-            Assert.fail("Expecting MathIllegalArgumentException");
-        } catch (MathIllegalArgumentException ex) {
+            Assert.fail("Expecting NullArgumentException");
+        } catch (NullArgumentException ex) {
             // expected
         }
         test = new double[] {2, 4, 6, 8};
@@ -547,8 +548,8 @@ public final class StatUtilsTest {
         final double[] nullArray = null;
         try {
             StatUtils.mode(nullArray);
-            Assert.fail("Expecting MathIllegalArgumentException");
-        } catch (MathIllegalArgumentException ex) {
+            Assert.fail("Expecting NullArgumentException");
+        } catch (NullArgumentException ex) {
             // Expected
         }
     }

http://git-wip-us.apache.org/repos/asf/commons-math/blob/35b688b7/src/test/java/org/apache/commons/math4/stat/descriptive/AbstractUnivariateStatisticTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/descriptive/AbstractUnivariateStatisticTest.java
b/src/test/java/org/apache/commons/math4/stat/descriptive/AbstractUnivariateStatisticTest.java
index dca0ece..b455f5b 100644
--- a/src/test/java/org/apache/commons/math4/stat/descriptive/AbstractUnivariateStatisticTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/descriptive/AbstractUnivariateStatisticTest.java
@@ -18,6 +18,7 @@ package org.apache.commons.math4.stat.descriptive;
 
 
 import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NullArgumentException;
 import org.apache.commons.math4.stat.descriptive.moment.Mean;
 import org.junit.Assert;
 import org.junit.Test;
@@ -76,14 +77,14 @@ public class AbstractUnivariateStatisticTest {
         }
         try {
             testStatistic.test(nullArray, 0, 1);  // null array
-            Assert.fail("Expecting MathIllegalArgumentException");
-        } catch (MathIllegalArgumentException ex) {
+            Assert.fail("Expecting NullArgumentException");
+        } catch (NullArgumentException ex) {
             // expected
         }
         try {
             testStatistic.test(testArray, nullArray, 0, 1);  // null weights array
-            Assert.fail("Expecting MathIllegalArgumentException");
-        } catch (MathIllegalArgumentException ex) {
+            Assert.fail("Expecting NullArgumentException");
+        } catch (NullArgumentException ex) {
             // expected
         }
         try {

http://git-wip-us.apache.org/repos/asf/commons-math/blob/35b688b7/src/test/java/org/apache/commons/math4/stat/descriptive/moment/SemiVarianceTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/descriptive/moment/SemiVarianceTest.java
b/src/test/java/org/apache/commons/math4/stat/descriptive/moment/SemiVarianceTest.java
index e9dc85a..c964a78 100644
--- a/src/test/java/org/apache/commons/math4/stat/descriptive/moment/SemiVarianceTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/descriptive/moment/SemiVarianceTest.java
@@ -18,7 +18,7 @@
 package org.apache.commons.math4.stat.descriptive.moment;
 
 import org.apache.commons.math4.TestUtils;
-import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NullArgumentException;
 import org.apache.commons.math4.stat.StatUtils;
 import org.apache.commons.math4.stat.descriptive.moment.SemiVariance;
 import org.junit.Assert;
@@ -34,14 +34,14 @@ public class SemiVarianceTest {
         try {
             sv.evaluate(nothing);
             Assert.fail("null is not a valid data array.");
-        } catch (MathIllegalArgumentException iae) {
+        } catch (NullArgumentException nae) {
         }
 
         try {
             sv.setVarianceDirection(SemiVariance.UPSIDE_VARIANCE);
             sv.evaluate(nothing);
             Assert.fail("null is not a valid data array.");
-        } catch (MathIllegalArgumentException iae) {
+        } catch (NullArgumentException nae) {
         }
         nothing = new double[] {};
         Assert.assertTrue(Double.isNaN(sv.evaluate(nothing)));

http://git-wip-us.apache.org/repos/asf/commons-math/blob/35b688b7/src/test/java/org/apache/commons/math4/stat/descriptive/rank/PSquarePercentileTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/descriptive/rank/PSquarePercentileTest.java
b/src/test/java/org/apache/commons/math4/stat/descriptive/rank/PSquarePercentileTest.java
index 78969fb..8751b00 100644
--- a/src/test/java/org/apache/commons/math4/stat/descriptive/rank/PSquarePercentileTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/descriptive/rank/PSquarePercentileTest.java
@@ -28,6 +28,7 @@ import org.apache.commons.math4.distribution.LogNormalDistribution;
 import org.apache.commons.math4.distribution.NormalDistribution;
 import org.apache.commons.math4.distribution.RealDistribution;
 import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NullArgumentException;
 import org.apache.commons.math4.exception.OutOfRangeException;
 import org.apache.commons.math4.random.RandomGenerator;
 import org.apache.commons.math4.random.Well19937c;
@@ -439,7 +440,7 @@ public class PSquarePercentileTest extends
                 1.0);// changed the accuracy to 1 instead of tolerance
     }
 
-    @Test(expected = MathIllegalArgumentException.class)
+    @Test(expected = NullArgumentException.class)
     public void testNull() {
         PSquarePercentile percentile = new PSquarePercentile(50d);
         double[] nullArray = null;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/35b688b7/src/test/java/org/apache/commons/math4/stat/descriptive/rank/PercentileTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/descriptive/rank/PercentileTest.java
b/src/test/java/org/apache/commons/math4/stat/descriptive/rank/PercentileTest.java
index bd67c5a..8b2107b 100644
--- a/src/test/java/org/apache/commons/math4/stat/descriptive/rank/PercentileTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/descriptive/rank/PercentileTest.java
@@ -171,8 +171,8 @@ public class PercentileTest extends UnivariateStatisticAbstractTest{
         final double[] emptyArray = new double[] {};
         try {
             percentile.evaluate(nullArray);
-            Assert.fail("Expecting MathIllegalArgumentException for null array");
-        } catch (final MathIllegalArgumentException ex) {
+            Assert.fail("Expecting NullArgumentException for null array");
+        } catch (final NullArgumentException ex) {
             // expected
         }
         Assert.assertTrue(Double.isNaN(percentile.evaluate(emptyArray)));
@@ -364,9 +364,9 @@ public class PercentileTest extends UnivariateStatisticAbstractTest{
             final UnivariateStatistic percentile = getUnivariateStatistic();
             try {
                 percentile.evaluate(nullArray);
-                Assert.fail("Expecting MathIllegalArgumentException "
+                Assert.fail("Expecting NullArgumentException "
                         + "for null array");
-            } catch (final MathIllegalArgumentException ex) {
+            } catch (final NullArgumentException ex) {
                 // expected
             }
             Assert.assertTrue(Double.isNaN(percentile.evaluate(emptyArray)));

http://git-wip-us.apache.org/repos/asf/commons-math/blob/35b688b7/src/test/java/org/apache/commons/math4/stat/regression/GLSMultipleLinearRegressionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/regression/GLSMultipleLinearRegressionTest.java
b/src/test/java/org/apache/commons/math4/stat/regression/GLSMultipleLinearRegressionTest.java
index 29dbe07..a2f5f62 100644
--- a/src/test/java/org/apache/commons/math4/stat/regression/GLSMultipleLinearRegressionTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/regression/GLSMultipleLinearRegressionTest.java
@@ -20,6 +20,7 @@ import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.exception.NullArgumentException;
 import org.apache.commons.math4.linear.MatrixUtils;
 import org.apache.commons.math4.linear.RealMatrix;
 import org.apache.commons.math4.linear.RealVector;
@@ -77,12 +78,12 @@ public class GLSMultipleLinearRegressionTest extends MultipleLinearRegressionAbs
         super.setUp();
     }
 
-    @Test(expected=IllegalArgumentException.class)
+    @Test(expected=NullArgumentException.class)
     public void cannotAddXSampleData() {
         createRegression().newSampleData(new double[]{}, null, null);
     }
 
-    @Test(expected=IllegalArgumentException.class)
+    @Test(expected=NullArgumentException.class)
     public void cannotAddNullYSampleData() {
         createRegression().newSampleData(null, new double[][]{}, null);
     }

http://git-wip-us.apache.org/repos/asf/commons-math/blob/35b688b7/src/test/java/org/apache/commons/math4/stat/regression/MultipleLinearRegressionAbstractTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/regression/MultipleLinearRegressionAbstractTest.java
b/src/test/java/org/apache/commons/math4/stat/regression/MultipleLinearRegressionAbstractTest.java
index 8e05600..1fc839b 100644
--- a/src/test/java/org/apache/commons/math4/stat/regression/MultipleLinearRegressionAbstractTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/regression/MultipleLinearRegressionAbstractTest.java
@@ -16,6 +16,7 @@
  */
 package org.apache.commons.math4.stat.regression;
 
+import org.apache.commons.math4.exception.NullArgumentException;
 import org.apache.commons.math4.linear.RealMatrix;
 import org.apache.commons.math4.linear.RealVector;
 import org.apache.commons.math4.stat.regression.AbstractMultipleLinearRegression;
@@ -104,7 +105,7 @@ public abstract class MultipleLinearRegressionAbstractTest {
         Assert.assertEquals(flatY, regression.getY());
     }
     
-    @Test(expected=IllegalArgumentException.class)
+    @Test(expected=NullArgumentException.class)
     public void testNewSampleNullData() {
         double[] data = null;
         createRegression().newSampleData(data, 2, 3); 
@@ -122,12 +123,12 @@ public abstract class MultipleLinearRegressionAbstractTest {
         createRegression().newSampleData(data, 1, 3);
     }
     
-    @Test(expected=IllegalArgumentException.class)
+    @Test(expected=NullArgumentException.class)
     public void testXSampleDataNull() {
         createRegression().newXSampleData(null);
     }
     
-    @Test(expected=IllegalArgumentException.class)
+    @Test(expected=NullArgumentException.class)
     public void testYSampleDataNull() {
         createRegression().newYSampleData(null);
     }

http://git-wip-us.apache.org/repos/asf/commons-math/blob/35b688b7/src/test/java/org/apache/commons/math4/stat/regression/OLSMultipleLinearRegressionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/regression/OLSMultipleLinearRegressionTest.java
b/src/test/java/org/apache/commons/math4/stat/regression/OLSMultipleLinearRegressionTest.java
index f5025b0..d383d0f 100644
--- a/src/test/java/org/apache/commons/math4/stat/regression/OLSMultipleLinearRegressionTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/regression/OLSMultipleLinearRegressionTest.java
@@ -18,6 +18,7 @@ package org.apache.commons.math4.stat.regression;
 
 
 import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.exception.NullArgumentException;
 import org.apache.commons.math4.linear.Array2DRowRealMatrix;
 import org.apache.commons.math4.linear.DefaultRealMatrixChangingVisitor;
 import org.apache.commons.math4.linear.MatrixUtils;
@@ -500,12 +501,12 @@ public class OLSMultipleLinearRegressionTest extends MultipleLinearRegressionAbs
         Assert.assertEquals(combinedY, regression.getY());
     }
     
-    @Test(expected=IllegalArgumentException.class)
+    @Test(expected=NullArgumentException.class)
     public void testNewSampleDataYNull() {
         createRegression().newSampleData(null, new double[][] {});
     }
     
-    @Test(expected=IllegalArgumentException.class)
+    @Test(expected=NullArgumentException.class)
     public void testNewSampleDataXNull() {
         createRegression().newSampleData(new double[] {}, null);
     }

http://git-wip-us.apache.org/repos/asf/commons-math/blob/35b688b7/src/test/java/org/apache/commons/math4/util/MathArraysTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/util/MathArraysTest.java b/src/test/java/org/apache/commons/math4/util/MathArraysTest.java
index 71d75b9..16e6a52 100644
--- a/src/test/java/org/apache/commons/math4/util/MathArraysTest.java
+++ b/src/test/java/org/apache/commons/math4/util/MathArraysTest.java
@@ -1128,14 +1128,14 @@ public class MathArraysTest {
         }
         try {
             MathArrays.verifyValues(nullArray, 0, 1);  // null array
-            Assert.fail("Expecting MathIllegalArgumentException");
-        } catch (MathIllegalArgumentException ex) {
+            Assert.fail("Expecting NullArgumentException");
+        } catch (NullArgumentException ex) {
             // expected
         }
         try {
             MathArrays.verifyValues(testArray, nullArray, 0, 1);  // null weights array
-            Assert.fail("Expecting MathIllegalArgumentException");
-        } catch (MathIllegalArgumentException ex) {
+            Assert.fail("Expecting NullArgumentException");
+        } catch (NullArgumentException ex) {
             // expected
         }
         try {


Mime
View raw message