2
2
3
3
import org .junit .jupiter .api .Test ;
4
4
5
- import com .fasterxml .jackson .core .JUnit5TestBase ;
6
- import com .fasterxml .jackson .core .JsonGenerator ;
7
- import com .fasterxml .jackson .core .JsonParseException ;
5
+ import com .fasterxml .jackson .core .*;
8
6
import com .fasterxml .jackson .core .io .ContentReference ;
9
7
10
8
import static org .junit .jupiter .api .Assertions .*;
14
12
*/
15
13
class JsonReadContextTest extends JUnit5TestBase
16
14
{
15
+ static class MyContext extends JsonReadContext {
16
+ public MyContext (JsonReadContext parent , int nestingDepth , DupDetector dups ,
17
+ int type , int lineNr , int colNr ) {
18
+ super (parent , nestingDepth , dups , type , lineNr , colNr );
19
+ }
20
+ }
21
+
17
22
@ Test
18
23
void setCurrentNameTwiceWithSameNameRaisesJsonParseException () throws Exception
19
- {
24
+ {
20
25
DupDetector dupDetector = DupDetector .rootDetector ((JsonGenerator ) null );
21
26
JsonReadContext jsonReadContext = new JsonReadContext ((JsonReadContext ) null , 0 ,
22
27
dupDetector , 2441 , 2441 , 2441 );
@@ -27,21 +32,21 @@ void setCurrentNameTwiceWithSameNameRaisesJsonParseException() throws Exception
27
32
} catch (JsonParseException e ) {
28
33
verifyException (e , "Duplicate field 'dupField'" );
29
34
}
30
- }
35
+ }
31
36
32
37
@ Test
33
38
void setCurrentName () throws Exception
34
- {
39
+ {
35
40
JsonReadContext jsonReadContext = JsonReadContext .createRootContext (0 , 0 , (DupDetector ) null );
36
41
jsonReadContext .setCurrentName ("abc" );
37
42
assertEquals ("abc" , jsonReadContext .getCurrentName ());
38
43
jsonReadContext .setCurrentName (null );
39
44
assertNull (jsonReadContext .getCurrentName ());
40
- }
45
+ }
41
46
42
47
@ Test
43
48
void reset ()
44
- {
49
+ {
45
50
DupDetector dupDetector = DupDetector .rootDetector ((JsonGenerator ) null );
46
51
JsonReadContext jsonReadContext = JsonReadContext .createRootContext (dupDetector );
47
52
final ContentReference bogusSrc = ContentReference .unknown ();
@@ -57,6 +62,12 @@ void reset()
57
62
assertEquals ("?" , jsonReadContext .typeDesc ());
58
63
assertEquals (500 , jsonReadContext .startLocation (bogusSrc ).getLineNr ());
59
64
assertEquals (200 , jsonReadContext .startLocation (bogusSrc ).getColumnNr ());
60
- }
65
+ }
61
66
62
- }
67
+ // [core#1421]
68
+ @ Test
69
+ void testExtension () {
70
+ MyContext context = new MyContext (null , 0 , null , 0 , 0 , 0 );
71
+ assertNotNull (context );
72
+ }
73
+ }
0 commit comments