File tree 1 file changed +31
-0
lines changed
src/test/java/com/fasterxml/jackson/failing
1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change
1
+ package com .fasterxml .jackson .failing ;
2
+
3
+ import com .fasterxml .jackson .core .JUnit5TestBase ;
4
+ import com .fasterxml .jackson .core .JsonPointer ;
5
+ import org .junit .jupiter .api .Test ;
6
+
7
+ import static org .junit .jupiter .api .Assertions .assertEquals ;
8
+
9
+ class JsonPointer1328Test extends JUnit5TestBase
10
+ {
11
+ // 5k enough on some systems to reproduce; use 10k
12
+ private final static int DEPTH = 10_000 ;
13
+
14
+ // [core#1328]: verify efficient operation of JsonPointer.head()
15
+ @ Test
16
+ void deepHead ()
17
+ {
18
+ final String INPUT = repeat ("/a" , DEPTH );
19
+ JsonPointer ptr = JsonPointer .compile (INPUT );
20
+ assertEquals (repeat ("/a" , DEPTH - 1 ), ptr .head ().toString ());
21
+ }
22
+
23
+ private final static String repeat (String part , int count ) {
24
+ StringBuilder sb = new StringBuilder (count * part .length ());
25
+ while (--count >= 0 ) {
26
+ sb .append (part );
27
+ }
28
+ return sb .toString ();
29
+ }
30
+
31
+ }
You can’t perform that action at this time.
0 commit comments