// This file was automatically generated from json.md by Knit tool. Do not edit. package example.test import org.junit.Test import kotlinx.knit.test.* class JsonTest { @Test fun testExampleJson01() { captureOutput("ExampleJson01") { example.exampleJson01.main() }.verifyOutputLines( "{", " \"name\": \"kotlinx.serialization\",", " \"language\": \"Kotlin\"", "}" ) } @Test fun testExampleJson02() { captureOutput("ExampleJson02") { example.exampleJson02.main() }.verifyOutputLines( "Project(name=kotlinx.serialization, status=SUPPORTED, votes=9000)" ) } @Test fun testExampleJson03() { captureOutput("ExampleJson03") { example.exampleJson03.main() }.verifyOutputLines( "Project(name=kotlinx.serialization)" ) } @Test fun testExampleJson04() { captureOutput("ExampleJson04") { example.exampleJson04.main() }.verifyOutputLines( "Project(name=kotlinx.serialization)", "Project(name=kotlinx.coroutines)" ) } @Test fun testExampleJson05() { captureOutput("ExampleJson05") { example.exampleJson05.main() }.verifyOutputLines( "Project(name=kotlinx.serialization, language=Kotlin)" ) } @Test fun testExampleJson06() { captureOutput("ExampleJson06") { example.exampleJson06.main() }.verifyOutputLines( "{\"name\":\"kotlinx.serialization\",\"language\":\"Kotlin\",\"website\":null}" ) } @Test fun testExampleJson07() { captureOutput("ExampleJson07") { example.exampleJson07.main() }.verifyOutputLines( "{\"name\":\"kotlinx.serialization\",\"language\":\"Kotlin\"}", "Project(name=kotlinx.serialization, language=Kotlin, version=1.2.2, website=null, description=null)" ) } @Test fun testExampleJson08() { captureOutput("ExampleJson08") { example.exampleJson08.main() }.verifyOutputLines( "[{\"name\":\"kotlinx.serialization\"},\"Serialization\",{\"name\":\"kotlinx.coroutines\"},\"Coroutines\"]" ) } @Test fun testExampleJson09() { captureOutput("ExampleJson09") { example.exampleJson09.main() }.verifyOutputLines( "{\"value\":NaN}" ) } @Test fun testExampleJson10() { captureOutput("ExampleJson10") { example.exampleJson10.main() }.verifyOutputLines( "{\"#class\":\"owned\",\"name\":\"kotlinx.coroutines\",\"owner\":\"kotlin\"}" ) } @Test fun testExampleJson11() { captureOutput("ExampleJson11") { example.exampleJson11.main() }.verifyOutputLines( "{\"message\":{\"message_type\":\"my.app.BaseMessage\",\"message\":\"not found\"},\"error\":{\"message_type\":\"my.app.GenericError\",\"error_code\":404}}" ) } @Test fun testExampleJson12() { captureOutput("ExampleJson12") { example.exampleJson12.main() }.verifyOutputLines( "{\"name\":\"kotlinx.coroutines\",\"owner\":\"kotlin\"}" ) } @Test fun testExampleJson13() { captureOutput("ExampleJson13") { example.exampleJson13.main() }.verifyOutputLines( "CasesList(cases=[VALUE_A, VALUE_B])" ) } @Test fun testExampleJson14() { captureOutput("ExampleJson14") { example.exampleJson14.main() }.verifyOutputLines( "{\"project_name\":\"kotlinx.serialization\",\"project_owner\":\"Kotlin\"}" ) } @Test fun testExampleJson15() { captureOutput("ExampleJson15") { example.exampleJson15.main() }.verifyOutputLines( "{\"name\":\"kotlinx.serialization\",\"language\":\"Kotlin\"}" ) } @Test fun testExampleJson16() { captureOutput("ExampleJson16") { example.exampleJson16.main() }.verifyOutputLines( "9042" ) } @Test fun testExampleJson17() { captureOutput("ExampleJson17") { example.exampleJson17.main() }.verifyOutputLines( "{\"name\":\"kotlinx.serialization\",\"owner\":{\"name\":\"kotlin\"},\"forks\":[{\"votes\":42},{\"votes\":9000}]}" ) } @Test fun testExampleJson18() { captureOutput("ExampleJson18") { example.exampleJson18.main() }.verifyOutputLines( "Project(name=kotlinx.serialization, language=Kotlin)" ) } @Test fun testExampleJson19() { captureOutput("ExampleJson19") { example.exampleJson19.main() }.verifyOutputLines( "{", " \"pi_double\": 3.141592653589793,", " \"pi_string\": \"3.141592653589793238462643383279\"", "}" ) } @Test fun testExampleJson20() { captureOutput("ExampleJson20") { example.exampleJson20.main() }.verifyOutputLines( "{", " \"pi_literal\": 3.141592653589793238462643383279,", " \"pi_double\": 3.141592653589793,", " \"pi_string\": \"3.141592653589793238462643383279\"", "}" ) } @Test fun testExampleJson21() { captureOutput("ExampleJson21") { example.exampleJson21.main() }.verifyOutputLines( "3.141592653589793238462643383279" ) } @Test fun testExampleJson22() { captureOutput("ExampleJson22") { example.exampleJson22.main() }.verifyOutputLinesStart( "Exception in thread \"main\" kotlinx.serialization.json.internal.JsonEncodingException: Creating a literal unquoted value of 'null' is forbidden. If you want to create JSON null literal, use JsonNull object, otherwise, use JsonPrimitive" ) } @Test fun testExampleJson23() { captureOutput("ExampleJson23") { example.exampleJson23.main() }.verifyOutputLines( "Project(name=kotlinx.serialization, users=[User(name=kotlin)])", "Project(name=kotlinx.serialization, users=[User(name=kotlin), User(name=jetbrains)])" ) } @Test fun testExampleJson24() { captureOutput("ExampleJson24") { example.exampleJson24.main() }.verifyOutputLines( "{\"name\":\"kotlinx.serialization\",\"users\":{\"name\":\"kotlin\"}}" ) } @Test fun testExampleJson25() { captureOutput("ExampleJson25") { example.exampleJson25.main() }.verifyOutputLines( "{\"name\":\"kotlinx.serialization\",\"language\":\"Kotlin\"}", "{\"name\":\"kotlinx.serialization\"}" ) } @Test fun testExampleJson26() { captureOutput("ExampleJson26") { example.exampleJson26.main() }.verifyOutputLines( "[{\"name\":\"kotlinx.serialization\",\"owner\":\"kotlin\"},{\"name\":\"example\"}]", "[OwnedProject(name=kotlinx.serialization, owner=kotlin), BasicProject(name=example)]" ) } @Test fun testExampleJson27() { captureOutput("ExampleJson27") { example.exampleJson27.main() }.verifyOutputLines( "[{\"name\":\"kotlinx.serialization\"},{\"error\":\"Not found\"}]", "[Ok(data=Project(name=kotlinx.serialization)), Error(message=Not found)]" ) } @Test fun testExampleJson28() { captureOutput("ExampleJson28") { example.exampleJson28.main() }.verifyOutputLines( "UnknownProject(name=example, details={\"type\":\"unknown\",\"maintainer\":\"Unknown\",\"license\":\"Apache 2.0\"})" ) } }