Added test to confirm null contract. JIRA: MATH-1007.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1504656 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Phil Steitz 2013-07-18 20:55:46 +00:00
parent c6cba39616
commit bedea0067e
1 changed files with 8 additions and 0 deletions

View File

@ -543,6 +543,14 @@ public final class StatUtilsTest {
final double[] nansOnly = {Double.NaN, Double.NaN}; final double[] nansOnly = {Double.NaN, Double.NaN};
final double[] modeNansOnly = StatUtils.mode(nansOnly); final double[] modeNansOnly = StatUtils.mode(nansOnly);
Assert.assertEquals(0, modeNansOnly.length); Assert.assertEquals(0, modeNansOnly.length);
final double[] nullArray = null;
try {
StatUtils.mode(nullArray);
Assert.fail("Expecting MathIllegalArgumentException");
} catch (MathIllegalArgumentException ex) {
// Expected
}
} }
} }