File tree Expand file tree Collapse file tree 2 files changed +38
-10
lines changed
src/test/java/com/fasterxml/jackson Expand file tree Collapse file tree 2 files changed +38
-10
lines changed Original file line number Diff line number Diff line change @@ -334,14 +334,4 @@ public void testIssue1125WithDefault() throws Exception
334
334
assertEquals (5 , impl .b );
335
335
assertEquals (9 , impl .def );
336
336
}
337
-
338
- // [databind#1311]
339
- public void testSubtypeAssignmentCheck () throws Exception
340
- {
341
- ObjectMapper mapper = new ObjectMapper ();
342
- mapper .registerSubtypes (Factory1311ImplA .class , Factory1311ImplB .class );
343
- Factory1311ImplB result = mapper .readValue ("{\" type\" :\" implB\" }" , Factory1311ImplB .class );
344
- assertNotNull (result );
345
- assertEquals (Factory1311ImplB .class , result .getClass ());
346
- }
347
337
}
Original file line number Diff line number Diff line change
1
+ package com .fasterxml .jackson .failing ;
2
+
3
+ import com .fasterxml .jackson .annotation .JsonTypeInfo ;
4
+ import com .fasterxml .jackson .annotation .JsonTypeName ;
5
+
6
+ import com .fasterxml .jackson .databind .ObjectMapper ;
7
+
8
+ // Not sure if this is valid, but for what it's worth, shows
9
+ // the thing wrt [databind#1311]. May be removed if we can't find
10
+ // improvements.
11
+ public class TestSubtypes1311 extends com .fasterxml .jackson .databind .BaseMapTest
12
+ {
13
+ // [databind#1311]
14
+ @ JsonTypeInfo (property = "type" , use = JsonTypeInfo .Id .NAME , defaultImpl = Factory1311ImplA .class )
15
+ interface Factory1311 { }
16
+
17
+ @ JsonTypeName ("implA" )
18
+ static class Factory1311ImplA implements Factory1311 { }
19
+
20
+ @ JsonTypeName ("implB" )
21
+ static class Factory1311ImplB implements Factory1311 { }
22
+
23
+ /*
24
+ /**********************************************************
25
+ /* Unit tests
26
+ /**********************************************************
27
+ */
28
+
29
+ // [databind#1311]
30
+ public void testSubtypeAssignmentCheck () throws Exception
31
+ {
32
+ ObjectMapper mapper = new ObjectMapper ();
33
+ mapper .registerSubtypes (Factory1311ImplA .class , Factory1311ImplB .class );
34
+ Factory1311ImplB result = mapper .readValue ("{\" type\" :\" implB\" }" , Factory1311ImplB .class );
35
+ assertNotNull (result );
36
+ assertEquals (Factory1311ImplB .class , result .getClass ());
37
+ }
38
+ }
You can’t perform that action at this time.
0 commit comments