-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #244 from ProjectMapK/develop
Release 2024-11-23 16:34:29 +0000
- Loading branch information
Showing
10 changed files
with
127 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/test/kotlin/io/github/projectmapk/jackson/module/kogera/zPorted/test/github/GitHub757.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package io.github.projectmapk.jackson.module.kogera.zPorted.test.github | ||
|
||
import com.fasterxml.jackson.databind.json.JsonMapper | ||
import io.github.projectmapk.jackson.module.kogera.KotlinFeature | ||
import io.github.projectmapk.jackson.module.kogera.KotlinModule | ||
import io.github.projectmapk.jackson.module.kogera.convertValue | ||
import org.junit.jupiter.api.Assertions.assertNull | ||
import org.junit.jupiter.api.Test | ||
|
||
class GitHub757 { | ||
@Test | ||
fun test() { | ||
val kotlinModule = KotlinModule.Builder() | ||
.enable(KotlinFeature.StrictNullChecks) | ||
.build() | ||
val mapper = JsonMapper.builder() | ||
.addModule(kotlinModule) | ||
.build() | ||
val convertValue = mapper.convertValue<String?>(null) | ||
assertNull(convertValue) | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
src/test/kotlin/io/github/projectmapk/jackson/module/kogera/zPorted/test/github/GitHub844.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package io.github.projectmapk.jackson.module.kogera.zPorted.test.github | ||
|
||
import com.fasterxml.jackson.annotation.JsonTypeInfo | ||
import com.fasterxml.jackson.databind.ObjectMapper | ||
import io.github.projectmapk.jackson.module.kogera.readValue | ||
import io.github.projectmapk.jackson.module.kogera.registerKotlinModule | ||
import org.junit.jupiter.api.Assertions.assertEquals | ||
import org.junit.jupiter.api.Test | ||
|
||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "_type") | ||
private sealed class BaseClass | ||
|
||
private data class ChildClass(val text: String) : BaseClass() | ||
|
||
class GitHub844 { | ||
@Test | ||
fun test() { | ||
val json = """ | ||
{ | ||
"_type": "ChildClass", | ||
"text": "Test" | ||
} | ||
""" | ||
|
||
val jacksonObjectMapper = ObjectMapper().registerKotlinModule() | ||
val message = jacksonObjectMapper.readValue<BaseClass>(json) | ||
|
||
assertEquals(ChildClass("Test"), message) | ||
} | ||
} |