2
2
3
3
import java .util .*;
4
4
5
+ import org .junit .jupiter .api .Test ;
6
+
5
7
import com .fasterxml .jackson .annotation .*;
6
8
7
9
import com .fasterxml .jackson .core .Version ;
12
14
import com .fasterxml .jackson .databind .exc .UnrecognizedPropertyException ;
13
15
import com .fasterxml .jackson .databind .introspect .NopAnnotationIntrospector ;
14
16
15
- public class BuilderSimpleTest extends BaseMapTest
17
+ import static org .junit .jupiter .api .Assertions .*;
18
+
19
+ import static com .fasterxml .jackson .databind .testutil .DatabindTestUtil .*;
20
+
21
+ public class BuilderSimpleTest
16
22
{
17
23
// // Simple 2-property value class, builder with standard naming
18
24
@@ -303,6 +309,7 @@ private Value2354 build() {
303
309
304
310
private final ObjectMapper MAPPER = newJsonMapper ();
305
311
312
+ @ Test
306
313
public void testSimple () throws Exception
307
314
{
308
315
String json = a2q ("{'x':1,'y':2}" );
@@ -316,6 +323,7 @@ public void testSimple() throws Exception
316
323
}
317
324
318
325
// related to [databind#1214]
326
+ @ Test
319
327
public void testSimpleWithIgnores () throws Exception
320
328
{
321
329
// 'z' is unknown, and would fail by default:
@@ -344,6 +352,7 @@ public void testSimpleWithIgnores() throws Exception
344
352
assertEquals (value ._y , 3 );
345
353
}
346
354
355
+ @ Test
347
356
public void testMultiAccess () throws Exception
348
357
{
349
358
String json = a2q ("{'c':3,'a':2,'b':-9}" );
@@ -362,6 +371,7 @@ public void testMultiAccess() throws Exception
362
371
}
363
372
364
373
// test for Immutable builder, to ensure return value is used
374
+ @ Test
365
375
public void testImmutable () throws Exception
366
376
{
367
377
final String json = "{\" value\" :13}" ;
@@ -370,6 +380,7 @@ public void testImmutable() throws Exception
370
380
}
371
381
372
382
// test with custom 'with-prefix'
383
+ @ Test
373
384
public void testCustomWith () throws Exception
374
385
{
375
386
final String json = "{\" value\" :1}" ;
@@ -379,20 +390,23 @@ public void testCustomWith() throws Exception
379
390
380
391
// for [databind#761]
381
392
393
+ @ Test
382
394
public void testBuilderMethodReturnMoreGeneral () throws Exception
383
395
{
384
396
final String json = "{\" x\" :1}" ;
385
397
ValueInterface value = MAPPER .readValue (json , ValueInterface .class );
386
398
assertEquals (2 , value .getX ());
387
399
}
388
400
401
+ @ Test
389
402
public void testBuilderMethodReturnMoreSpecific () throws Exception
390
403
{
391
404
final String json = "{\" x\" :1}" ;
392
405
ValueInterface2 value = MAPPER .readValue (json , ValueInterface2 .class );
393
406
assertEquals (2 , value .getX ());
394
407
}
395
408
409
+ @ Test
396
410
public void testSelfBuilder777 () throws Exception
397
411
{
398
412
SelfBuilder777 result = MAPPER .readValue (a2q ("{'x':3}'" ),
@@ -401,6 +415,7 @@ public void testSelfBuilder777() throws Exception
401
415
assertEquals (3 , result .x );
402
416
}
403
417
418
+ @ Test
404
419
public void testWithAnySetter822 () throws Exception
405
420
{
406
421
final String json = "{\" extra\" :3,\" foobar\" :[ ],\" x\" :1,\" name\" :\" bob\" }" ;
@@ -416,6 +431,7 @@ public void testWithAnySetter822() throws Exception
416
431
assertTrue (((List <?>) ob ).isEmpty ());
417
432
}
418
433
434
+ @ Test
419
435
public void testPOJOConfigResolution1557 () throws Exception
420
436
{
421
437
final String json = "{\" value\" :1}" ;
@@ -425,6 +441,7 @@ public void testPOJOConfigResolution1557() throws Exception
425
441
}
426
442
427
443
// related to [databind#2354] (ensure private inner builder classes are ok)
444
+ @ Test
428
445
public void testPrivateInnerBuilder () throws Exception
429
446
{
430
447
String json = a2q ("{'value':13}" );
0 commit comments