https://kotlinlang.org logo
#klaxon
Title
# klaxon
c

cedric

05/11/2018, 9:28 PM
@mingkangpan Should be fixed in 3.0.3
m

mingkangpan

05/14/2018, 7:30 AM
@cedric it still doesn't work
Copy code
@Test
    fun testParseRegistry() {
        val result = Klaxon().parse<Registry>(registryString)
        val vendors = result?.vendor!!
        assertEquals("example", result.name)
        assertEquals("John", result.firstName)
        assertEquals("example", vendors[0].name)
        assertEquals("Doe", vendors[0].sureName)
    }
Copy code
private class Registry(val name : String, val vendor : List<Vendor> = ArrayList()) {
    var firstName : String = ""
}
private class Vendor(val name : String) {
    val sureName = ""
}
Copy code
private const val registryString = "{\n  \"name\" : \"example\",\n  \"firstName\" : \"John\",\n  \"vendor\": [\n    {\n      \"name\": \"example\",\n      \"sureName\": \"Doe\"\n    }\n  ]\n}"
Copy code
java.lang.IllegalAccessException: Class com.beust.klaxon.JsonObjectConverter can not access a member of class at.willhaben.klaxon.Registry with modifiers "public final"
c

cedric

05/14/2018, 7:45 AM
Please file an issue with that failing test
m

mingkangpan

05/14/2018, 11:29 AM
done
3 Views