@@ -18,8 +18,7 @@ public class TestNextXxx
18
18
/* Wrappers to test InputStream vs Reader
19
19
/********************************************************
20
20
*/
21
-
22
- // [JACKSON-653]
21
+
23
22
public void testIsNextTokenName () throws Exception
24
23
{
25
24
_testIsNextTokenName1 (false );
@@ -30,14 +29,21 @@ public void testIsNextTokenName() throws Exception
30
29
_testIsNextTokenName3 (true );
31
30
}
32
31
33
- // [Issue#34]
32
+ // for [core#220]: problem with `nextFieldName(str)`, indented content
33
+ public void testNextNameWithIndentation () throws Exception
34
+ {
35
+ _testNextFieldNameIndent (false );
36
+ _testNextFieldNameIndent (true );
37
+ }
38
+
39
+ // [core#34]
34
40
public void testIssue34 () throws Exception
35
41
{
36
42
_testIssue34 (false );
37
43
_testIssue34 (true );
38
44
}
39
45
40
- // [Issue #38] with nextFieldName
46
+ // [core #38] with nextFieldName
41
47
public void testIssue38 () throws Exception
42
48
{
43
49
_testIssue38 (false );
@@ -51,7 +57,7 @@ public void testNextNameWithLongContent() throws Exception
51
57
_testLong (jf , false );
52
58
_testLong (jf , true );
53
59
}
54
-
60
+
55
61
/*
56
62
/********************************************************
57
63
/* Actual test code
@@ -206,6 +212,25 @@ private void _testIsNextTokenName3(boolean useStream) throws Exception
206
212
jp .close ();
207
213
}
208
214
215
+ private void _testNextFieldNameIndent (boolean useStream ) throws Exception
216
+ {
217
+ final String DOC = "{\n \" name\" : \n [\n ]\n }" ;
218
+ JsonFactory f = new JsonFactory ();
219
+ JsonParser p = useStream ?
220
+ f .createParser (new ByteArrayInputStream (DOC .getBytes ("UTF-8" )))
221
+ : f .createParser (new StringReader (DOC ));
222
+ assertToken (JsonToken .START_OBJECT , p .nextToken ());
223
+ assertTrue (p .nextFieldName (new SerializedString ("name" )));
224
+
225
+ assertToken (JsonToken .START_ARRAY , p .nextToken ());
226
+ assertToken (JsonToken .END_ARRAY , p .nextToken ());
227
+ assertToken (JsonToken .END_OBJECT , p .nextToken ());
228
+
229
+ assertNull (p .nextToken ());
230
+
231
+ p .close ();
232
+ }
233
+
209
234
private void _testIssue34 (boolean useStream ) throws Exception
210
235
{
211
236
final int TESTROUNDS = 223 ;
0 commit comments