Skip to content

Commit 0a8157c

Browse files
committed
Bit more testing wrt #2816
1 parent b358792 commit 0a8157c

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

src/test/java/com/fasterxml/jackson/failing/DeepNestingWithUntyped2816Test.java renamed to src/test/java/com/fasterxml/jackson/failing/DeepNestingDeser2816Test.java

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,42 @@
66
import com.fasterxml.jackson.databind.*;
77

88
// [databind#2816]
9-
public class DeepNestingWithUntyped2816Test extends BaseMapTest
9+
public class DeepNestingDeser2816Test extends BaseMapTest
1010
{
11-
// 2000 passes, 3000 fails
12-
private final static int TOO_DEEP_NESTING = 4000;
11+
// 2000 passes for all; 3000 fails for untyped, 5000 for tree/object,
12+
// 8000 for tree/array too
13+
private final static int TOO_DEEP_NESTING = 8000;
1314

1415
private final ObjectMapper MAPPER = newJsonMapper();
1516

16-
public void testWithArray() throws Exception
17+
public void testUntypedWithArray() throws Exception
1718
{
1819
final String doc = _nestedDoc(TOO_DEEP_NESTING, "[ ", "] ");
1920
Object ob = MAPPER.readValue(doc, Object.class);
2021
assertTrue(ob instanceof List<?>);
2122
}
2223

23-
public void testWithObject() throws Exception
24+
public void testUntypedWithObject() throws Exception
2425
{
2526
final String doc = "{"+_nestedDoc(TOO_DEEP_NESTING, "\"x\":{", "} ") + "}";
2627
Object ob = MAPPER.readValue(doc, Object.class);
2728
assertTrue(ob instanceof Map<?,?>);
2829
}
2930

31+
public void testTreeWithArray() throws Exception
32+
{
33+
final String doc = _nestedDoc(TOO_DEEP_NESTING, "[ ", "] ");
34+
JsonNode n = MAPPER.readTree(doc);
35+
assertTrue(n.isArray());
36+
}
37+
38+
public void testTreeWithObject() throws Exception
39+
{
40+
final String doc = "{"+_nestedDoc(TOO_DEEP_NESTING, "\"x\":{", "} ") + "}";
41+
JsonNode n = MAPPER.readTree(doc);
42+
assertTrue(n.isObject());
43+
}
44+
3045
private String _nestedDoc(int nesting, String open, String close) {
3146
StringBuilder sb = new StringBuilder(nesting * (open.length() + close.length()));
3247
for (int i = 0; i < nesting; ++i) {

0 commit comments

Comments
 (0)