Slightly better unit test code coverage.

git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/lang/trunk@226704 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary D. Gregory 2005-07-31 23:55:24 +00:00
parent 1b8becc1c1
commit 1e3ecfff20
1 changed files with 16 additions and 19 deletions

View File

@ -174,7 +174,8 @@ public class NumberUtilsTest extends TestCase {
assertEquals("createNumber(String) 3 failed", new Double("1234.5"), NumberUtils.createNumber("1234.5d"));
assertEquals("createNumber(String) 4 failed", new Float("1234.5"), NumberUtils.createNumber("1234.5F"));
assertEquals("createNumber(String) 4 failed", new Float("1234.5"), NumberUtils.createNumber("1234.5f"));
assertEquals("createNumber(String) 5 failed", new Long(Integer.MAX_VALUE + 1L), NumberUtils.createNumber("" + (Integer.MAX_VALUE + 1L)));
assertEquals("createNumber(String) 5 failed", new Long(Integer.MAX_VALUE + 1L), NumberUtils.createNumber(""
+ (Integer.MAX_VALUE + 1L)));
assertEquals("createNumber(String) 6 failed", new Long(12345), NumberUtils.createNumber("12345L"));
assertEquals("createNumber(String) 6 failed", new Long(12345), NumberUtils.createNumber("12345l"));
assertEquals("createNumber(String) 7 failed", new Float("-1234.5"), NumberUtils.createNumber("-1234.5"));
@ -186,24 +187,20 @@ public class NumberUtilsTest extends TestCase {
assertEquals("createNumber(String) 13 failed", new Double("-1.1E200"), NumberUtils.createNumber("-1.1E200"));
assertEquals("createNumber(String) 14 failed", new Double("1.1E-200"), NumberUtils.createNumber("1.1E-200"));
assertEquals("createNumber(null) failed", null, NumberUtils.createNumber(null));
assertEquals("createNumber(String) failed", new BigInteger("12345678901234567890"), NumberUtils
.createNumber("12345678901234567890L"));
// jdk 1.2 doesn't support this. unsure about jdk 1.2.2
if (SystemUtils.isJavaVersionAtLeast(1.3f)) {
assertEquals("createNumber(String) 15 failed", new BigDecimal("1.1E-700"), NumberUtils.createNumber("1.1E-700F"));
assertEquals("createNumber(String) 15 failed", new BigDecimal("1.1E-700"), NumberUtils
.createNumber("1.1E-700F"));
}
assertEquals(
"createNumber(String) 16 failed",
new Long("10" + Integer.MAX_VALUE),
NumberUtils.createNumber("10" + Integer.MAX_VALUE + "L"));
assertEquals(
"createNumber(String) 17 failed",
new Long("10" + Integer.MAX_VALUE),
NumberUtils.createNumber("10" + Integer.MAX_VALUE));
assertEquals(
"createNumber(String) 18 failed",
new BigInteger("10" + Long.MAX_VALUE),
NumberUtils.createNumber("10" + Long.MAX_VALUE));
assertEquals("createNumber(String) 16 failed", new Long("10" + Integer.MAX_VALUE), NumberUtils
.createNumber("10" + Integer.MAX_VALUE + "L"));
assertEquals("createNumber(String) 17 failed", new Long("10" + Integer.MAX_VALUE), NumberUtils
.createNumber("10" + Integer.MAX_VALUE));
assertEquals("createNumber(String) 18 failed", new BigInteger("10" + Long.MAX_VALUE), NumberUtils
.createNumber("10" + Long.MAX_VALUE));
}
public void testCreateFloat() {