From: markt Date: Sat, 19 Apr 2008 09:44:35 +0000 (+0000) Subject: Add test case for bug 43656. Based on a patch from Konstantin Kolinko. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=e95081fabdeb9683ae8d7dd645bfa3e12d3ac32c;p=tomcat7.0 Add test case for bug 43656. Based on a patch from Konstantin Kolinko. git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@649783 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/test/org/apache/el/lang/TestELSupport.java b/test/org/apache/el/lang/TestELSupport.java new file mode 100644 index 000000000..df3a82ad7 --- /dev/null +++ b/test/org/apache/el/lang/TestELSupport.java @@ -0,0 +1,46 @@ +package org.apache.el.lang; + +import java.math.BigDecimal; +import java.math.BigInteger; + +import junit.framework.TestCase; + +public class TestELSupport extends TestCase { + public void testBigDecimal() { + testIsSame(new BigDecimal( + "0.123456789012345678901234567890123456789012345678901234567890123456789")); + } + + public void testBigInteger() { + testIsSame(new BigInteger( + "1234567890123456789012345678901234567890123456789012345678901234567890")); + } + + public void testLong() { + testIsSame(Long.valueOf(0x0102030405060708L)); + } + + public void testInteger() { + testIsSame(Integer.valueOf(0x01020304)); + } + + public void testShort() { + testIsSame(Short.valueOf((short) 0x0102)); + } + + public void testByte() { + testIsSame(Byte.valueOf((byte) 0xEF)); + } + + public void testDouble() { + testIsSame(Double.valueOf(0.123456789012345678901234)); + } + + public void testFloat() { + testIsSame(Float.valueOf(0.123456F)); + } + + private static void testIsSame(Object value) { + assertEquals(value, ELSupport.coerceToNumber(value, value.getClass())); + } +}