Skip to content

Instantly share code, notes, and snippets.

@d108
Created June 10, 2019 01:54
Show Gist options
  • Save d108/409ecca30fd75f7c8215d14a2abb93d5 to your computer and use it in GitHub Desktop.
Save d108/409ecca30fd75f7c8215d14a2abb93d5 to your computer and use it in GitHub Desktop.
@Test fun testParseDaily1()
{
val cnt = 0
val dataKey = "Time Series (Daily)"
val klx = Klaxon()
val f = File(pathname).readText()
val parsed = klx.parseJsonObject(StringReader(f))
val timeSeries = parsed.filter {
it.key == dataKey
}.map {
it.value as JsonObject
}
timeSeries.first().values.forEach {
cnt.inc()
val day = klx.parseFromJsonObject<Daily>(it as JsonObject)
}
assertEquals(cnt, 0, "Expected fall-through.")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment