Skip to content

Commit 792a60b

Browse files
committed
Test changes to align with jackson-core
1 parent d23d682 commit 792a60b

File tree

1 file changed

+14
-16
lines changed

1 file changed

+14
-16
lines changed

src/test/java/com/fasterxml/jackson/databind/deser/TestBigNumbers.java

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
package com.fasterxml.jackson.databind.deser;
22

3+
import java.math.BigDecimal;
4+
import java.math.BigInteger;
5+
36
import com.fasterxml.jackson.core.JsonFactory;
47
import com.fasterxml.jackson.core.StreamReadConstraints;
8+
import com.fasterxml.jackson.core.exc.StreamReadException;
9+
510
import com.fasterxml.jackson.databind.BaseMapTest;
6-
import com.fasterxml.jackson.databind.JsonMappingException;
711
import com.fasterxml.jackson.databind.ObjectMapper;
812
import com.fasterxml.jackson.databind.json.JsonMapper;
913

10-
import java.math.BigDecimal;
11-
import java.math.BigInteger;
12-
1314
public class TestBigNumbers extends BaseMapTest
1415
{
1516
static class BigDecimalWrapper {
@@ -59,10 +60,9 @@ public void testDouble() throws Exception
5960
{
6061
try {
6162
MAPPER.readValue(generateJson("d"), DoubleWrapper.class);
62-
fail("expected JsonMappingException");
63-
} catch (JsonMappingException jsonMappingException) {
64-
assertTrue("unexpected exception message: " + jsonMappingException.getMessage(),
65-
jsonMappingException.getMessage().startsWith("Malformed numeric value ([number with 1200 characters])"));
63+
fail("expected StreamReadException");
64+
} catch (StreamReadException e) {
65+
verifyException(e, "Invalid numeric value ", "exceeds the maximum length");
6666
}
6767
}
6868

@@ -77,10 +77,9 @@ public void testBigDecimal() throws Exception
7777
{
7878
try {
7979
MAPPER.readValue(generateJson("number"), BigDecimalWrapper.class);
80-
fail("expected JsonMappingException");
81-
} catch (JsonMappingException jsonMappingException) {
82-
assertTrue("unexpected exception message: " + jsonMappingException.getMessage(),
83-
jsonMappingException.getMessage().startsWith("Malformed numeric value ([number with 1200 characters])"));
80+
fail("expected StreamReadException");
81+
} catch (StreamReadException e) {
82+
verifyException(e, "Invalid numeric value ", "exceeds the maximum length");
8483
}
8584
}
8685

@@ -96,10 +95,9 @@ public void testBigInteger() throws Exception
9695
{
9796
try {
9897
MAPPER.readValue(generateJson("number"), BigIntegerWrapper.class);
99-
fail("expected JsonMappingException");
100-
} catch (JsonMappingException jsonMappingException) {
101-
assertTrue("unexpected exception message: " + jsonMappingException.getMessage(),
102-
jsonMappingException.getMessage().startsWith("Malformed numeric value ([number with 1200 characters])"));
98+
fail("expected StreamReadException");
99+
} catch (StreamReadException e) {
100+
verifyException(e, "Invalid numeric value ", "exceeds the maximum length");
103101
}
104102
}
105103

0 commit comments

Comments
 (0)