3
3
import java .io .*;
4
4
import java .util .*;
5
5
6
+ import org .junit .jupiter .api .Test ;
7
+
6
8
import com .fasterxml .jackson .core .*;
7
9
import com .fasterxml .jackson .core .type .TypeReference ;
8
10
9
- import com .fasterxml .jackson .databind .BaseMapTest ;
10
11
import com .fasterxml .jackson .databind .MappingIterator ;
11
12
import com .fasterxml .jackson .databind .ObjectMapper ;
12
13
import com .fasterxml .jackson .databind .ObjectReader ;
13
14
import com .fasterxml .jackson .databind .json .JsonMapper ;
15
+ import com .fasterxml .jackson .databind .testutil .DatabindTestUtil ;
16
+
17
+ import static org .junit .jupiter .api .Assertions .*;
14
18
15
19
@ SuppressWarnings ("resource" )
16
- public class ReadValuesTest extends BaseMapTest
20
+ public class ReadValuesTest extends DatabindTestUtil
17
21
{
18
22
static class Bean {
19
23
public int a ;
@@ -44,6 +48,7 @@ private enum Source {
44
48
45
49
private final ObjectMapper MAPPER = newJsonMapper ();
46
50
51
+ @ Test
47
52
public void testRootBeans () throws Exception
48
53
{
49
54
for (Source src : Source .values ()) {
@@ -111,6 +116,7 @@ private void _testRootBeans(Source srcType) throws Exception
111
116
it .close ();
112
117
}
113
118
119
+ @ Test
114
120
public void testRootBeansInArray () throws Exception
115
121
{
116
122
final String JSON = "[{\" a\" :6}, {\" a\" :-7}]" ;
@@ -140,6 +146,7 @@ public void testRootBeansInArray() throws Exception
140
146
assertEquals (4 , set .iterator ().next ().a );
141
147
}
142
148
149
+ @ Test
143
150
public void testRootMaps () throws Exception
144
151
{
145
152
final String JSON = "{\" a\" :3}{\" a\" :27} " ;
@@ -164,6 +171,7 @@ public void testRootMaps() throws Exception
164
171
/**********************************************************
165
172
*/
166
173
174
+ @ Test
167
175
public void testRootBeansWithParser () throws Exception
168
176
{
169
177
final String JSON = "{\" a\" :3}{\" a\" :27} " ;
@@ -180,6 +188,7 @@ public void testRootBeansWithParser() throws Exception
180
188
assertFalse (it .hasNext ());
181
189
}
182
190
191
+ @ Test
183
192
public void testRootArraysWithParser () throws Exception
184
193
{
185
194
final String JSON = "[1][3]" ;
@@ -201,6 +210,7 @@ public void testRootArraysWithParser() throws Exception
201
210
assertFalse (it .hasNext ());
202
211
}
203
212
213
+ @ Test
204
214
public void testHasNextWithEndArray () throws Exception {
205
215
final String JSON = "[1,3]" ;
206
216
JsonParser jp = MAPPER .createParser (JSON );
@@ -221,6 +231,7 @@ public void testHasNextWithEndArray() throws Exception {
221
231
assertFalse (it .hasNext ());
222
232
}
223
233
234
+ @ Test
224
235
public void testHasNextWithEndArrayManagedParser () throws Exception {
225
236
final String JSON = "[1,3]" ;
226
237
@@ -241,6 +252,7 @@ public void testHasNextWithEndArrayManagedParser() throws Exception {
241
252
/**********************************************************
242
253
*/
243
254
255
+ @ Test
244
256
public void testNonRootBeans () throws Exception
245
257
{
246
258
final String JSON = "{\" leaf\" :[{\" a\" :3},{\" a\" :27}]}" ;
@@ -265,6 +277,7 @@ public void testNonRootBeans() throws Exception
265
277
jp .close ();
266
278
}
267
279
280
+ @ Test
268
281
public void testNonRootMapsWithParser () throws Exception
269
282
{
270
283
final String JSON = "[{\" a\" :3},{\" a\" :27}]" ;
@@ -290,6 +303,7 @@ public void testNonRootMapsWithParser() throws Exception
290
303
jp .close ();
291
304
}
292
305
306
+ @ Test
293
307
public void testNonRootMapsWithObjectReader () throws Exception
294
308
{
295
309
String JSON = "[{ \" hi\" : \" ho\" , \" neighbor\" : \" Joe\" },\n "
@@ -309,26 +323,31 @@ public void testNonRootMapsWithObjectReader() throws Exception
309
323
assertFalse (iterator .hasNext ());
310
324
}
311
325
326
+ @ Test
312
327
public void testObjectReaderWithJsonParserFastDoubleParser () throws Exception
313
328
{
314
329
testObjectReaderWithFastDoubleParser (true );
315
330
}
316
331
332
+ @ Test
317
333
public void testObjectReaderWithJsonReadFeatureFastDoubleParser () throws Exception
318
334
{
319
335
testObjectReaderWithFastDoubleParser (false );
320
336
}
321
337
338
+ @ Test
322
339
public void testObjectReaderWithJsonParserFastFloatParser () throws Exception
323
340
{
324
341
testObjectReaderWithFastFloatParser (true );
325
342
}
326
343
344
+ @ Test
327
345
public void testObjectReaderWithJsonReadFeatureFastFloatParser () throws Exception
328
346
{
329
347
testObjectReaderWithFastFloatParser (false );
330
348
}
331
349
350
+ @ Test
332
351
public void testNonRootArraysUsingParser () throws Exception
333
352
{
334
353
final String JSON = "[[1],[3]]" ;
@@ -354,6 +373,7 @@ public void testNonRootArraysUsingParser() throws Exception
354
373
p .close ();
355
374
}
356
375
376
+ @ Test
357
377
public void testEmptyIterator () throws Exception
358
378
{
359
379
MappingIterator <Object > empty = MappingIterator .emptyIterator ();
0 commit comments