ASF Bugzilla – Attachment 21831 Details for
Bug 43656
ELSupport.coerceToType won't handle null for java.lang.Number
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
Testcase against ELSupport.coerceToNumber
CoerceToNumberTest.java (text/plain), 1.58 KB, created by
Konstantin Kolinko
on 2008-04-18 20:19:52 UTC
(
hide
)
Description:
Testcase against ELSupport.coerceToNumber
Filename:
MIME Type:
Creator:
Konstantin Kolinko
Created:
2008-04-18 20:19:52 UTC
Size:
1.58 KB
patch
obsolete
>package tests; > >import java.math.BigDecimal; >import java.math.BigInteger; > >import junit.framework.Test; >import junit.framework.TestCase; >import junit.framework.TestSuite; >import junit.textui.TestRunner; > >import org.apache.el.lang.ELSupport; > >public class CoerceToNumberTest extends TestCase { > public static void main(String args[]) { > TestRunner.run(suite()); > } > > public static Test suite() { > TestSuite suite = new TestSuite(); > suite.addTest(new TestSuite(CoerceToNumberTest.class)); > return suite; > } > > 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())); > } >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 43656
: 21831 |
22354
|
22355
|
24144
|
24145
|
24692