diff --git a/src/test/org/apache/commons/lang/math/IEEE754rUtilsTest.java b/src/test/org/apache/commons/lang/math/IEEE754rUtilsTest.java index 0f2a66d37..89495f4c1 100644 --- a/src/test/org/apache/commons/lang/math/IEEE754rUtilsTest.java +++ b/src/test/org/apache/commons/lang/math/IEEE754rUtilsTest.java @@ -49,5 +49,52 @@ public void testLang381() { assertEquals(1.2f, IEEE754rUtils.min(bF), 0.01); assertEquals(42.0f, IEEE754rUtils.max(bF), 0.01); } + + public void testEnforceExceptions() { + try { + IEEE754rUtils.min( (float[]) null); + fail("IllegalArgumentException expected for null input"); + } catch(IllegalArgumentException iae) { /* expected */ } + + try { + IEEE754rUtils.min(new float[0]); + fail("IllegalArgumentException expected for empty input"); + } catch(IllegalArgumentException iae) { /* expected */ } + + try { + IEEE754rUtils.max( (float[]) null); + fail("IllegalArgumentException expected for null input"); + } catch(IllegalArgumentException iae) { /* expected */ } + + try { + IEEE754rUtils.max(new float[0]); + fail("IllegalArgumentException expected for empty input"); + } catch(IllegalArgumentException iae) { /* expected */ } + + try { + IEEE754rUtils.min( (double[]) null); + fail("IllegalArgumentException expected for null input"); + } catch(IllegalArgumentException iae) { /* expected */ } + + try { + IEEE754rUtils.min(new double[0]); + fail("IllegalArgumentException expected for empty input"); + } catch(IllegalArgumentException iae) { /* expected */ } + + try { + IEEE754rUtils.max( (double[]) null); + fail("IllegalArgumentException expected for null input"); + } catch(IllegalArgumentException iae) { /* expected */ } + + try { + IEEE754rUtils.max(new double[0]); + fail("IllegalArgumentException expected for empty input"); + } catch(IllegalArgumentException iae) { /* expected */ } + + } + + public void testConstructorExists() { + new IEEE754rUtils(); + } }