-
Notifications
You must be signed in to change notification settings - Fork 176
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 #432 from Kotlin/issue-431-fix
- Loading branch information
Showing
3 changed files
with
53 additions
and
8 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
32 changes: 32 additions & 0 deletions
32
src/test/kotlin/wu/seal/jsontokotlin/regression/Issue431Test.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,32 @@ | ||
package wu.seal.jsontokotlin.regression | ||
|
||
import com.winterbe.expekt.should | ||
import org.junit.Test | ||
import wu.seal.jsontokotlin.generateKotlinClassCode | ||
import wu.seal.jsontokotlin.model.DefaultValueStrategy | ||
import wu.seal.jsontokotlin.model.TargetJsonConverter | ||
import wu.seal.jsontokotlin.test.TestConfig | ||
import wu.seal.jsontokotlin.utils.BaseTest | ||
import wu.seal.jsontokotlin.utils.resetJsonToKotlinRandom | ||
|
||
class Issue431Test : BaseTest() { | ||
@Test | ||
fun testIssue431() { | ||
TestConfig.apply { | ||
isCommentOff = true | ||
targetJsonConvertLib = TargetJsonConverter.None | ||
defaultValueStrategy = DefaultValueStrategy.None | ||
isNestedClassModel = false | ||
} | ||
val json = """{"list":[{}]}""" | ||
val expected = """ | ||
data class Test( | ||
val list: List<Item0> | ||
) | ||
class Item0 | ||
""".trimIndent() | ||
resetJsonToKotlinRandom() | ||
json.generateKotlinClassCode("Test").should.equal(expected) | ||
} | ||
} |
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