Skip to content

Commit 194378f

Browse files
authored
E Notation Number tests (#591)
1 parent 099f91a commit 194378f

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/test/java/com/fasterxml/jackson/dataformat/xml/deser/RootValueDeserTest.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.fasterxml.jackson.dataformat.xml.deser;
22

3+
import java.math.BigDecimal;
34
import java.math.BigInteger;
45

56
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
@@ -24,6 +25,14 @@ public void testNumbers() throws Exception
2425
_testScalar(BigInteger.valueOf(31337), "<BigInteger>31337</BigInteger>");
2526
}
2627

28+
public void testNumbersWithENotation() throws Exception
29+
{
30+
BigInteger bigInteger = new BigDecimal("2e308").toBigInteger();
31+
_testScalar(bigInteger, "<BigInteger>" + bigInteger + "</BigInteger>");
32+
BigDecimal bigDecimal = new BigDecimal("2e308");
33+
_testScalar(bigDecimal, "<BigDecimal>" + bigDecimal + "</BigDecimal>");
34+
}
35+
2736
private void _testScalar(Object input, String exp) throws Exception {
2837
_testScalar(input, input.getClass(), exp);
2938
}
@@ -32,7 +41,7 @@ private void _testScalar(Object input, Class<?> type, String exp) throws Excepti
3241
{
3342
String xml = MAPPER.writeValueAsString(input).trim();
3443
assertEquals(exp, xml);
35-
Object result = MAPPER.readValue(xml, input.getClass());
44+
Object result = MAPPER.readValue(xml, type);
3645
assertEquals(input, result);
3746
}
3847
}

0 commit comments

Comments
 (0)