File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed 
src/test/kotlin/tools/jackson/module/kotlin/test/github Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change 1+ package  tools.jackson.module.kotlin.test.github 
2+ 
3+ import  com.fasterxml.jackson.annotation.JsonTypeInfo 
4+ import  tools.jackson.module.kotlin.readValue 
5+ import  tools.jackson.module.kotlin.jsonMapper 
6+ import  kotlin.test.Test 
7+ import  kotlin.test.assertEquals 
8+ 
9+ @JsonTypeInfo(use =  JsonTypeInfo .Id .NAME , property =  " _type"  )
10+ private  sealed  class  BaseClass 
11+ 
12+ private  data class  ChildClass (val  text :  String ) : BaseClass()
13+ 
14+ class  GitHub844  {
15+     @Test
16+     fun  test () {
17+         val  json =  """ 
18+         { 
19+             "_type": "ChildClass", 
20+             "text": "Test" 
21+         } 
22+         """  
23+ 
24+         val  jacksonObjectMapper =  jsonMapper()
25+         val  message =  jacksonObjectMapper.readValue<BaseClass >(json)
26+ 
27+         assertEquals(ChildClass (" Test"  ), message)
28+     }
29+ }
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments