#!/bin/sh
# Generated by JetBrains Toolbox 1.16.1212 at Fri Jan 24 07:08:01 2020
open -a "/Users/maochanz/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/193.1212.39/IntelliJ IDEA.app/Contents/MacOS/idea" "$@"
~/bin/studio
#!/bin/sh
# Generated by JetBrains Toolbox 1.16.1212 at Fri Jan 24 07:08:01 2020
open -a "/Users/maochanz/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/191.1212548/Android Studio.app/Contents/MacOS/studio" "$@"
@Serializable
data class User(
val name: String,
val email: String,
val age: Int = 13,
val role: Role = Role.Viewer
)
enum class Role { Viewer, Editor, Owner }
class JsonUnitTest {
private val jsonString = """
{
"name" : "John Doe",
"email" : "john.doe@email.com"
}
""".trimIndent()
@Test
fun jsonTest() {
val user = Json.parse(User.serializer(), jsonString)
assertEquals("John Doe", user.name)
assertEquals(Role.Viewer, user.role)
assertEquals(13, user.age)
// User(name=John Doe,
// email=john.doe@email.com,
// age=13,
// role=Viewer)
}
}