-
Notifications
You must be signed in to change notification settings - Fork 511
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
31 additions
and
0 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
27 changes: 27 additions & 0 deletions
27
kotlin/src/test/kotlin/com/alibaba/fastjson2/issues/Issue3288.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,27 @@ | ||
package com.alibaba.fastjson2.issues | ||
|
||
import com.alibaba.fastjson2.JSON | ||
import com.alibaba.fastjson2.toJSONString | ||
import org.junit.jupiter.api.Assertions.assertEquals | ||
import org.junit.jupiter.api.Test | ||
|
||
class Issue3288 { | ||
@JvmInline | ||
value class TestBean(val a: Int) | ||
|
||
data class Test2( | ||
val b: TestBean | ||
) | ||
|
||
@Test | ||
fun test() { | ||
val s1 = "{\"a\":1}" | ||
assertEquals(s1, TestBean(1).toJSONString()) | ||
assertEquals(s1, JSON.parseObject(s1, TestBean::class.java).toJSONString()) | ||
assertEquals(s1, TestBean(1).toJSONString()) | ||
val s2 = "{\"b\":2}" | ||
assertEquals(s2, JSON.parseObject(s2, Test2::class.java) | ||
.toJSONString()) | ||
assertEquals(s2, JSON.parseObject(s2, Test2::class.java).toJSONString()) | ||
} | ||
} |