Improving code coverage by testing exceptions and empty constructor

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@795895 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Henri Yandell 2009-07-20 16:14:34 +00:00
parent 84beb062c1
commit 75b967beaa
1 changed files with 47 additions and 0 deletions

View File

@ -50,4 +50,51 @@ public void testLang381() {
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();
}
}