Skip to content

Instantly share code, notes, and snippets.

@d108
Created June 10, 2019 02:41
Show Gist options
  • Save d108/9899fcd8b94337e39ca22badc8fc2e14 to your computer and use it in GitHub Desktop.
Save d108/9899fcd8b94337e39ca22badc8fc2e14 to your computer and use it in GitHub Desktop.
@Test fun testParseDaily2()
{
val expected = 13
val klx = Klaxon()
val dataKey = "Time Series (Daily)"
val days = klx.parseJsonObject(StringReader(File(pathname).readText()))
.filter { it.key == dataKey }
.map { it.value as JsonObject }.first().values
.map { klx.parseFromJsonObject<Daily>(it as JsonObject)?.close }
assertEquals(days.size, expected, "Bad count of " + days.size + ", expected " + expected + ".")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment